bill@camco.Celestial.COM (Bill Campbell) (05/10/91)
I am trying to build an archive of compressed files on an MS-DOS
system using a perl script. The guts are:
open(INPUT, "filelist"); # opens input file list
open(ARCHIVE, "archive");
binmode(ARCHIVE);
$buf_size = 512;
while(<INPUT>) {
chop;
system("compress < $_ > tmpfile.Z");
$comp_size = (stat('tmpfile.Z'))[7];
&write_file_header(); # contains, names, sizes...
open(WORKFILE, "tmpfile.Z");
binmode(WORKFILE);
$\ = ''; # don't insert anything after each write
while(sysread(WORKFILE, $buffer, $buf_size) > 0) {
print ARCHIVE $buffer;
undef($buffer); # strange stuff remaining on short
# read if I don't do this.
}
close(WORKFILE);
}
close(INPUT);....
This works fine on Xenix/Unix systems, but the MS-DOS version has
one of two problems:
1. It frequently says that it is out of memory compressing
from stdin. I have recompiled compress for 12-bit
compression and it does this less frequently, but it
still does it.
2. The compressed file is longer than it should be. It
appears that it might be created as a text file rather
than binary when the standard output is redirected to the
file.
I'm using compress,v 4.3d compiled with Xenix cc -dos in large model.
I don't know much about MS-DOS (by choice), and don't understand
why this should fail in this manner. Compressing in-place works
fine under MS-DOS.
Does anybody know what I'm doing wrong?
Thanks
--
INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software
UUCP: ...!thebes!camco!bill 6641 East Mercer Way
uunet!camco!bill Mercer Island, WA 98040; (206) 947-5591