head     1.1;
branch   1.1.1;
access   ;
symbols  start:1.1.1.1 webdox:1.1.1;
locks    ; strict;
comment  @# @;


1.1
date     2003.03.15.00.57.44;  author redpain;  state Exp;
branches 1.1.1.1;
next     ;

1.1.1.1
date     2003.03.15.00.57.44;  author redpain;  state Exp;
branches ;
next     ;


desc
@@



1.1
log
@Initial revision
@
text
@#! /usr/bin/perl

# Pad a file with zero bytes to make its length
# an even multiple of some value.

# $Revision: 1.2 $

use strict qw(refs vars);
use FileHandle;

if ( scalar(@@ARGV) != 2 ) {
    print STDERR "usage: pad <filename> <multiple>\n";
    exit 1;
}

my $filename = shift @@ARGV;
my $multiple = shift @@ARGV;

my $size = (-s $filename);
die "Couldn't get size of $filename: $!" if ( !defined $size );

my $num_pad = ($multiple - ($size % $multiple)) % $multiple;

my $buf = chr(0) x $num_pad;

my $fh = new FileHandle(">>$filename");
die "Couldn't open $filename: $!" if ( !defined $fh );
binmode $fh;
syswrite $fh, $buf, $num_pad, 0;
$fh->close();
@


1.1.1.1
log
@Project Start
@
text
@@
