[net.unix] 'cpio' utility needed

mark@laidbak.UUCP (Mark Brukhartz) (08/02/85)

I have created a utility called "afio" which manipulates cpio-format
archives. Among other features, it knows how to skip past unreadable
or otherwise corrupt portions of archives.

I plan to post "afio" to "net.sources" in a about a month (once the
most recent changes have been tested). If you have a desperate need,
however, please send me mail; I'll send an advance copy.

					Mark Brukhartz
					..!ihnp4!laidbak!mark

PS: The latest "afio" manual page follows. Please mail comments to
    "..!ihnp4!laidbak!mark". Thank you.



AFIO(1)             UNIX Programmer's Manual              AFIO(1)



NAME
     afio - manipulate archives and files

SYNOPSIS
     afio -o [ -fhlmruvz ] [ -(bcs) n ] archive
     afio -t [ -kuvz ] [ -(bcs) n ] [ -y prefix ] archive
     afio -i [ -dkmnruvwxz ] [ -(bcs) n ] [ -y prefix ] archive
     afio -p [ -dhlmnuvwxz ] dir [ ... ]

DESCRIPTION
     Afio manipulates groups of files, copying  them  within  the
     (collective)  filesystem  or  between  the filesystem and an
     afio archive. Note that afio archives are portable, as  they
     contain  only  ASCII-formatted  header information. They are
     also compatible with ASCII cpio(1) archives (ala cpio -c).

     With -o, reads pathnames from the  standard  input,  writing
     the specified files to the given archive.

     With -t, reads the specified archive,  writing  a  table-of-
     contents to the standard output.

     With -i, reads the specified archive and installs the  files
     relative to the current working directory.

     With -p, copies files directly from one part of the filesys-
     tem to another.  Input pathnames are taken from the standard
     input.  Files are copied to each (of possibly several)  des-
     tination directories.

     Creates missing directories as necessary,  with  permissions
     to match their parents.

     Skips obviously corrupt sections of input archives.

     Supports multi-volume archives during interactive  operation
     (i.e.,  when  /dev/tty is accessible and SIGINT is not being
     ignored).

     Options:

     -b size     Read or  write  size-character  archive  blocks.
                 Suffices  of b, k and m denote multiples of 512,
                 1024 and  1048576,  respectively.   Defaults  to
                 5120 for compatibility with cpio(1).

     -c count    Buffer count archive blocks between  I/O  opera-
                 tions. A large count is recommended with stream-
                 ing magnetic tape drives.

     -d          Don't create missing directories.




Printed 8/1/85                                                  1






AFIO(1)             UNIX Programmer's Manual              AFIO(1)



     -f          Spawn a child process to actually write  to  the
                 archive;  provides  a  (clumsy)  form of double-
                 buffering.  Requires -s for multi-volume archive
                 support.

     -h          Follow symbolic links, treating them as ordinary
                 files and directories.

     -k          Skip corrupt data at the beginning of an archive
                 (rather  than  complaining  about unrecognizable
                 input).  Allows input to begin in the middle  of
                 a multi-volume archive.

     -l          With -o, resolves links at output time,  writing
                 only one copy of data per unique file.

                 With -t, reports hard links.

                 With -p, attempts  to  link  files  rather  than
                 copying them.

     -m          Mark output files with a common  current  times-
                 tamp  rather  than  with input file modification
                 times.

     -n          Protect newer  existing  files  (comparing  file
                 modification times).

     -r          Treat  absolute  pathnames  within  archives  as
                 relative ones.

     -s limit    Restrict each portion of a multi-volume  archive
                 to limit characters.  Recognizes the same multi-
                 pliers as -b.  Useful with finite-length devices
                 which do not return short counts at end of media
                 (sigh); output to magnetic tape typically  falls
                 into this category.

     -u          Report files with unseen links.

     -v          Verbose. Report pathnames as they are processed.
                 With  -t, gives an ls -l style report (including
                 link information).

     -w          Protect unwritable files (such as mode 644 owned
                 by  someone  else  or any mode 444).  Otherwise,
                 writing is attempted via  chmod(),  or  unlink()
                 and  creat().   Note  that multiply-linked files
                 will not be unlinked in any case.   This  option
                 is ineffective for the super-user.

     -x          Retain   file   ownership   and    setuid/setgid



Printed 8/1/85                                                  2






AFIO(1)             UNIX Programmer's Manual              AFIO(1)



                 permissions.    This  is  the  default  for  the
                 super-user; he may use -X to override it.

     -y prefix   Restrict processing to names beginning with pre-
                 fix.   Specify once for each prefix to be recog-
                 nized.

     -z          Print execution statistics. This  is  meant  for
                 human  consumption;  use  by  other  programs is
                 officially discouraged.

     Recognizes obsolete binary cpio(1) archives upon input (with
     -i and -t), but cannot write them.

     Generates sparse filesystem blocks (with lseek(2)) when pos-
     sible.

     Optimizes pathnames with respect to the current  and  parent
     directories.  For  example,  ./src/sh/../misc/afio.c becomes
     src/misc/afio.c.

     Pads the final block of an archive to the output block  size
     (see  -b)  with  character-special  devices  or  to  a  512-
     character boundary with other archive file  types.  This  is
     necessary for compatibility with cpio(1).

BUGS
     Can't handle pathnames longer than 255 characters,  or  with
     more than 63 meaningful elements.

     No sequence checks are  applied  when  reading  multi-volume
     archives.   Sequence  errors generally masquerade as corrupt
     archives.

     Corrupt archives are resynchronized by searching for a valid
     magic  number.  This  is  quite  naive,  but,  much  like  a
     disassembler, almost always works.

     Degenerate uses of symbolic links are  mangled  by  pathname
     optimization.   For  example,  assuming  that "usr.src" is a
     symbolic    link     to     "/usr/src",     the     pathname
     "usr.src/../bin/cu"  would  be  mis-optimized  into "bin/cu"
     (rather than "/usr/bin/cu").

WISH LIST
     Selective retrieval by full regular expression.

     Appending to or otherwise updating an existing archive.

SEE ALSO
     cpio(1), find(1), tar(1), tp(1).




Printed 8/1/85                                                  3






AFIO(1)             UNIX Programmer's Manual              AFIO(1)



AUTHOR
     Mark Brukhartz
     ..!ihnp4!laidbak!mark




















































Printed 8/1/85                                                  4