Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pack(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cat

pack

PURPOSE

     Compresses files.

SYNOPSIS
     pack [ - ] [ -f ] name ...

     pcat name ...

     unpack name ...


DESCRIPTION

       pack

     The  pack command  stores the  specified file  in a  com-
     pressed form.   The input  file is  replaced by  a packed
     file  with a  name derived  from the  original file  name
     (file.z), with the same  access modes, access and modifi-
     cation dates, and owner as  the original file.  The input
     file  name must  contain no  more than  12 characters  to
     allow  space for  the  added  .z extension.   Directories
     cannot be compressed.

     If pack cannot create a smaller file, it stops processing
     and reports that it is  unable to save space.  (A failure
     to  save space,  generally  happens with  small files  or
     files with  uniform character distribution.)   The amount
     of space saved depends on the  size of the input file and
     the character frequency distribution.  Because a decoding
     tree forms the first part of  each .z file, you will gen-
     erally not be able to  save space with files smaller than
     three blocks.  Typically, text files are reduced 25 to 40
     percent.

     The exit value of the pack command is the number of files
     that it  could not pack.   Packing is not done  under any
     one of the following conditions:

     o   The file is already packed.
     o   The input file name has more than 12 characters.
     o   The file has links.
     o   The file is a directory.
     o   The file cannot be opened.
     o   No storage blocks are saved by packing.
     o   A file called file.z already exists.
     o   The .z file cannot be created.
     o   An I/O error occurs during processing.

     Note:  Both pcat and unpack  operate only on files ending
     in .z.   As a result, when  you specify a file  name that
     does not  end in .z, pcat  and unpack add the  suffix and
     search the directory for a file name with that suffix.

       pcat

     The pcat command reads the specified files, unpacks them,
     and writes them to standard output.

       unpack

     The unpack is the reverse  of the pack command.  It reads
     the input files,  expands them, and writes  them to their
     original file name, the name without the .z suffix.

     The exit  value of  pcat is  the number  of files  it was
     unable to unpack.   A file cannot be unpacked  if any one
     of the following occurs:

     o   The file name (exclusive of  the .z) has more than 12
         characters.
     o   The file cannot be opened.
     o   The file is not a packed file.

     The unpack  command expands  files created by  pack.  For
     each file  specified, unpack  searches for a  file called
     file.z.  If this  file is a packed  file, unpack replaces
     it by its expanded version.  The unpack command names the
     new file name  by removing the .z suffix  from file.  The
     new file has the same  access modes, access and modifica-
     tion dates, and owner as the original packed file.

     The exit value is the  number of files the unpack command
     was unable to  unpack.  A file cannot be  unpacked if any
     one of the following occurs:

     o   The file cannot be opened.
     o   The file is not a packed file.
     o   A file with the unpacked file name already exists.
     o   The unpacked file cannot be created.

     Note:  The  unpack command  writes a warning  to standard
     output if  the file it  is unpacking has links.   The new
     unpacked file has a different i-node than the packed file
     from  which it  was  created.  However,  any other  files
     linked to  the packed file's original  i-node still exist
     and are still packed.

FLAG

     -  Displays statistics about the input files. The statis-
        tics are calculated from  a Huffman minimum redundancy
        code tree built on  a byte-by-byte basis.  Repeating -
        (minus) on the command line toggles this function.

EXAMPLES

     1.  To compress files:

           pack  chap1  chap2

         This compresses  "chap1" and "chap2",  replacing them
         with files named "chap1".z  and "chap2".z.  pack dis-
         plays the percent decrease in size for each file.
     2.  To display statistics about the amount of compression
         done:

           pack  -  chap1  -  chap2

         This compresses "chap1" and "chap2" and displays sta-
         tistics about  "chap1", but  not about  "chap2".  The
         first -  (minus) turns on the  statistic display, and
         the second turns it off.
     3.  To display compressed files:

           pcat  chap1.z  chap2  |  pg

         This  displays  the  compressed files  "chap1.z"  and
         "chap2".z on the screen in expanded form, a page at a
         time (| "pg").   Note that pcat  added the .z  to the
         end of "chap2", even though we did not enter it.
     4.  To use  a compressed file without  expanding the copy
         stored on disk:

           pcat  chap1.z  |  grep  'Greece'

         This pipes the contents  of "chap1.z" in its expanded
         form to the grep command.  See page  for a discussion
         of piping.
     5.  To expand compressed files:

           unpack  chap1.z  chap2

         This  expands  the  compressed  files  "chap1.z"  and
         "chap2".z,  replacing them  with files  named "chap1"
         and  "chap2".  Note  that  you can  give unpack  file
         names either with or without the .z suffix.

RELATED INFORMATION

     The following command:  "cat."

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026