Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Includes Phil's patches to the guest build environment document
[palacios.git] / geekos / scripts / pad
1 #! /usr/bin/perl
2
3 # Pad a file with zero bytes to make its length
4 # an even multiple of some value.
5
6 # $Revision: 1.1 $
7
8 use strict qw(refs vars);
9 use FileHandle;
10
11 if ( scalar(@ARGV) != 2 ) {
12     print STDERR "usage: pad <filename> <multiple>\n";
13     exit 1;
14 }
15
16 my $filename = shift @ARGV;
17 my $multiple = shift @ARGV;
18
19 my $size = (-s $filename);
20 die "Couldn't get size of $filename: $!" if ( !defined $size );
21
22 my $num_pad = ($multiple - ($size % $multiple)) % $multiple;
23
24 my $buf = chr(0) x $num_pad;
25
26 my $fh = new FileHandle(">>$filename");
27 die "Couldn't open $filename: $!" if ( !defined $fh );
28 binmode $fh;
29 syswrite $fh, $buf, $num_pad, 0;
30 $fh->close();