ARC unsqueeze fix
John Ruschmeyer
john at monuxa.UUCP
Fri Dec 19 07:42:38 AEST 1986
When the UNIX version of ARC was posted a while ago, I brought it up on
our systems here. Unlike a recent poster to this newsgroup, I had no
problem with the Lempel-Ziv (crunch) code, but never could get it to
correctly squeeze or unsqueeze a file in an archive.
Reading the source code, I noticed that the squeeze/unsqueeze code on ARC
is based on an earlier version of the recently-posted portable SQ/USQ
programs. Using code from that program I was able to fix the problem with
ARC not correctly unsqueezing a file in the archive (creating either a
zero-length file or giving the 'invalid decode tree' message).
NOTE: I am still having problems with the squeeze code on our system. For
some reason, trying to archive a file which would normally be squeezed on
the MS-DOS version of ARC results in it being compressed with some
less-efficient method. I think this is a bug, but it appears to be a
harmless one.
Context diffs for the unsqueeze fix follow:
*** arcusq.c.old Tue Dec 16 11:14:54 1986
--- arcusq.c Thu Dec 18 16:29:07 1986
***************
*** 35,41
static int get_int(f) /* get an integer */
FILE *f; /* file to get it from */
{
! return getc_unp(f) | (getc_unp(f)<<8);
}
init_usq(f) /* initialize Huffman unsqueezing */
--- 35,46 -----
static int get_int(f) /* get an integer */
FILE *f; /* file to get it from */
{
! int temp;
!
! temp = getc_unp(f); /* get low order byte */
! temp |= getc_unp(f) << 8;
! if (temp & 0x8000) temp |= (~0) << 15; /* propogate sign for big ints */
! return (temp);
}
init_usq(f) /* initialize Huffman unsqueezing */
--
Name: John Ruschmeyer
US Mail: Monmouth College, W. Long Branch, NJ 07764
Phone: (201) 571-3451
UUCP: ...!vax135!petsd!moncol!john ...!princeton!moncol!john
...!pesnta!moncol!john
Actually, I know a lot about what turns a woman off.
Now, if I could just stop doing it I'd be all set.
More information about the Comp.sources.bugs
mailing list