X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=misc%2Ftest_vm%2Fscripts%2Fpcat;fp=misc%2Ftest_vm%2Fscripts%2Fpcat;h=d58f9fdf63dae87260a16a7d2453d8aa0e8bb708;hp=0000000000000000000000000000000000000000;hb=ddc16b0737cf58f7aa90a69c6652cdf4090aec51;hpb=626595465a2c6987606a6bc697df65130ad8c2d3 diff --git a/misc/test_vm/scripts/pcat b/misc/test_vm/scripts/pcat new file mode 100755 index 0000000..d58f9fd --- /dev/null +++ b/misc/test_vm/scripts/pcat @@ -0,0 +1,23 @@ +#! /usr/bin/perl + +# A version of cat written in perl. + +use strict qw(refs vars); +use FileHandle; + +binmode STDOUT; + +my $buf = chr(0) x 1024; + +my $file; +while ( ($file = shift @ARGV) ) { + my $fh = new FileHandle("<$file"); + (defined $fh) || die "Couldn't open $file: $!\n"; + binmode $fh; + + my $n; + while ( ($n = sysread($fh, $buf, 1024)) > 0 ) { + syswrite( STDOUT, $buf, $n ); + } + $fh->close(); +}