[net.micro.cbm] Squeeze and Unsqueeze for the Commodore 64

prindle@nadc (08/20/85)

From: prindle@NADC

Some time ago there was a plea on this net for a C64 program to unsqueeze
squeezed files.  I have since modified (i.e. added conditionals to) the public
domain "sq" and "usq" C programs from the CPM archives on SIMTEL20 (originally
written by R. Greenlaw) to compile with C-Power (Copyright Pro-Line Software)
and execute on the C64.  Thanks to the way Mr. Greenlaw wrote the programs,
they do not "require" command line arguments, and may thus run stand-alone
on the C64 (i.e. LOAD "SQ",8  and RUN).  Since the sources are over 1400 lines
long, I am not going to post them to this net, but will mail them to anyone
on request.  The format of a squeezed file is Huffman encoded with a pre-
pended file name and decoding tree and apparently is quite standard.

Here is the Man page for the UNIX versions of "sq" and "usq"; the C64 versions
are identical in operation, although when run without the SHELL, they cannot
be passed command line arguments:

NAME
     sq, usq - squeeze (compress) files

SYNOPSYS
     sq [ file1 ] [ file2 ] ...
     usq [ -count ] [ -fcount ] [ file1 ] [ file2 ] ...

DESCRIPTION
     sq compresses one or more files, using a Huffman coding
     scheme.  usq decompresses or displays one or more files
     squeezed by sq. The algorithm is identical to the one used
     by the popular public domain 'SQ' programs, originally
     authored by Richard Greenlaw.

     sq will squeeze each file passed on the argument line.  It
     will append `.SQ' to the original file name to create the
     output file name.  If no file names are given, sq will
     prompt for file names from the standard input.  A message is
     printed for each file, tracing each pass of the compression
     process.

     usq will unsqueeze or display the files requested on the
     command line.  If no files are requested,  the file names
     are input from the standard input.  If no option is given,
     the file is unsqueezed to its original name.

     If the -count option is used, count lines are displayed from
     the start of the file, with all unprintable characters
     except CR, LF, TAB, and FF converted to periods.  The output
     is sent to the standard output.  If the -fcount option is
     used, the file is displayed with a formfeed appended to the
     preview of each file.

AUTHOR
     Richard Greenlaw (original), Theo Pozzy (ported versions)

BUGS
     The file naming convention is not a one-to-one mapping, so
     multiple files may be squeezed to the same output file name.
     Also, the output file name for usq cannot be overridden.

SEE ALSO
     compact(1)



Frank Prindle
Prindle@NADC