
AFIO(1)							AFIO(1)

NAME
       afio - manipulate archives and files

SYNOPSIS
       afio -o [ options ] archive
       afio -t [ options ] archive
       afio -i [ options ] archive
       afio -p [ options ] directory [ ... ]

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, for GNU cpio(1) also cpio -H odc).

       With -o, reads  pathnames  from	the  standard  input  and
       writes an archive.

       With  -t,  reads an archive and writes a table-of-contents
       to the standard output.

       With -i, installs the contents of an archive  relative  to
       the working directory.

       With  -p,  reads	pathnames  from  the  standard input and
       copies the files to each directory.

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

       Generates  sparse  filesystem  blocks (with lseek(2)) when
       possible.

       Removes leading slashes from pathnames when reading, writ-
       ing,  and cataloging an archive, unless instructed not to.

       Supports multi-volume archives during  interactive  opera-
       tion  (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 oper-
		    ations.  A	large  count  is recommended with
		    streaming magnetic tape drives.

								1

AFIO(1)							AFIO(1)

       -d	   Don't create missing directories.

       -e bound	Pad the archive to a multiple of bound  char-
		    acters.   Recognizes the same suffices as -s.
		    Defaults to 1x (the -b block size)	for  com-
		    patibility with cpio(1).

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

       -g	   Change  to	input  file  directories.  Avoids
		    quadratic filesystem behavior with long simi-
		    lar pathnames. Requires  all  absolute  path-
		    names, including those for the -o archive and
		    the -p directories.

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

       -j	   Don't generate sparse filesystem blocks.

       -k	   Skip  corrupt  data	at  the  beginning of an
		    archive (rather than complaining about unrec-
		    ognizable input).

       -l	   With  -o,  write file contents with each hard
		    link.

		    With -t, report hard links.

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

       -m	   Mark  output  files	with  a  common  current
		    timestamp (rather than with input file  modi-
		    fication times).

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

       -s limit	Restrict  each  portion  of	a   multi-volume
		    archive  to limit characters.  Recognizes the
		    same suffices as  -b.   Also,  the	suffix	x
		    denotes  a multiple of the -b block size (and
		    must follow any  -b	specification).   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.

								2

AFIO(1)							AFIO(1)

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

       -w filename  Treats each line in filename as  an	-y  pat-
		    tern, see -y.

       -x	   Retain  file ownership and setuid/setgid per-
		    missions.  This is the default for the super-
		    user; he may use -X to override it.

       -y pattern   Restrict  processing of archive read to names
		    matching shell pattern pattern.  Specify once
		    for each pattern to be recognized.	Use -Y to
		    supply patterns which  are	not  to	be  pro-
		    cessed.    -Y  overrides  -y  if  a	filename
		    matches both.  Unless the -S option is given,
		    leading  slashes  are  ignored  when matching
		    patterns,	e.g.	/etc/passwd	matches
		    etc/passwd.	See also -w and -W.

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

       -A     Do  not  turn  absolute  paths into relative paths.
	      That is don't remove the leading slash.

       -E filename
	      Read file extensions, separated by whitespace, from
	      filename.	Files	with these extentions are not to
	      be compressed when using the -Z  option.	filename
	      may  contain comments preceded by a #.  If no -E is
	      given, files with the extentions	.Z  .z	.gz  .arc
	      .gif  .zip  .zoo .lha .jpeg .jpg .tpz .taz .tgz and
	      .tzg will not be compressed.

       -F     This is a floppy disk, -s is required.  Uses shared
	      memory  if  compiled in otherwise mallocs as needed
	      (a 3b1 will not be able to malloc the needed memory
	      w/o shared memory), afio assumes either way you can
	      malloc/shmalloc a chunck of memory the size of  one
	      disk. Examples: 795k: 3.5" (720k drive), 316k (360k
	      drive)
	      At the end of each disk this message occurs:
	       Ready for disk [#] on [output]
				     (remove the disk when the light goes out)
	       Type "go" (or "GO") when ready to proceed (or "quit" to abort):

       -G factor
	      Specifies the  gzip(1)  compression  speed  factor,
	      used  when  compressing  files  with the -Z option.
	      Factor 1 is the fastest with least  compression,	9

								3

AFIO(1)							AFIO(1)

	      is  slowest  with	best  compression.   The default
	      value is 6.  See also the gzip(1) manual page.   If
	      you  have	a  slow machine or a fast backup medium,
	      you may want to specify a low value for  factor  to
	      speed  up the backup.  On large (>200k) files, -G 1
	      typically zips twice as fast as -G 6,  while  still
	      achieving	a  better  result than compress(1).  The
	      zip speed for small files is mainly  determined  by
	      the invocation time of gzip (1), see the -T option.

       -K     Verify the output against what  is  in  the  memory
	      copy  of the disk (-F required).	If the writing or
	      verifying fails the following  menu  pops	up  (the
	      hidden option "quit" will also exit from the backup
	      at this point).
		  [Writing/Verify] of disk [disk #] has FAILED
						       (try option #3 first ])!
		   Enter 1 to RETRY this disk
		   Enter 2 to REFORMAT this disk before a RETTRY
		   Enter quit to ABORT this backup

       -L Log_file_path
	      Specify the name of the file to log errors and  the
	      final totals to.

       -M size
	      Specifies	the  maximum amount of memory to use for
	      the temporary storage of compression  results  when
	      using  the  -Z  option.  The  default  is	-M 2m (2
	      megabytes).  If the compressed version of a file is
	      larger  than  this  (or if afio runs out of virtual
	      memory), gzip(1) is run  twice  of  the  file,  the
	      first  time  to determine the length of the result,
	      the second time to get the compressed data  itself.

       -R Disk format command string
	      This is the command that is run when you enter 2 to
	      reformat	the  disk.   The  default  (/bin/fdformat
	      /dev/fd0H1440)  can  be changed to a given system's
	      default by editing the Makefile.

       -S     Do not ignore leading slashes when matching -y  and
	      -Y patterns. See also -A.

       -T threshold
	      Only  compress  a	file when using the -Z option if
	      its length is at least threshold.	The  default  is
	      -T  0k.	This is useful if you have a slow machine
	      or a fast backup medium.	Specifying  -T	3k  typi-
	      cally  halves the number of invocations of gzip(1),
	      saving some 30% computation time, while creating an
	      archive that is only 5% longer.  The combination -T
	      8k -G 1 typically saves 70%  computation	time  and
	      gives  a 20% size increase.  The latter combination

								4

AFIO(1)							AFIO(1)

	      may be a good alternative to not using -Z	at  all.
	      These  figures of course depend heavily on the kind
	      of files in the archive and  the	processor  -  i/o
	      speed ratio on your machine.

       -W filename
	      Treats  each line in filename as an -Y pattern, see
	      -y.

       -Y pattern
	      See -y.

       -Z     Gzip the files on the  way  out,	in,  and  passing
	      without  links (valid w/ or w/o -F or -K), requires
	      gzip(1) to be in your path.

       Special-case archive names:

	  o  Specify - to read or write	the  standard	input  or
	     output,  respectively.   This  disables multi-volume
	     archive handling.

	  o  Prefix a command  string  to  be  executed	with  an
	     exclamation  mark (!).  The command is executed once
	     for each archive volume, with its standard input  or
	     output  piped  to afio.  It is expected to produce a
	     zero exit code when all is well.

	  o  Use system:file to access an archive in file on sys-
	     tem.  This is really just a special case of pipelin-
	     ing.   It	requires  a  4.2BSD-style  remote   shell
	     (rsh(1C)) and a remote copy of afio.

	  o  Anything  else specifies a local file or device.  An
	     output file will be created if it does  not  already
	     exist.

       Recognizes  obsolete  binary  cpio(1)  archives (including
       those from machines with reversed byte order), but  cannot
       write them.

       Recovers	from archive corruption by searching for a valid
       magic number. This is rather simplistic, but, much like	a
       disassembler, almost always works.

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

EXAMPLE
	    AT&T  3b1 (all one line)	find /u/bstore -print |
       \	  afio	-ovzFZK	-L/u/store/BackupLog	\
       -R'/etc/iv  -i  /dev/rfp020  /usr/lib/iv/FDnl' -s$DISKSIZE
       /dev/rfp021

								5

AFIO(1)							AFIO(1)

BUGS
       There are too many options.

       Restricts pathnames to 1023 characters and 255  meaningful
       elements.

       There  is  no  sequence	information  within  multi-volume
       archives.  Input sequence errors generally  masquerade  as
       data  corruption.   A  solution would probably be mutually
       exclusive with cpio(1) compatibility.

       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" is mis-optimized into "bin/cu" (rather
       than "/usr/bin/cu").

       The Linux floppy drivers currently (that is kernel version
       0.99 pl13) do not allow afio to find out if a floppy write
       error has happened.  Afio will happily fail to  backup  to
       (say)  a	write	protected  disk	and  not report anything
       wrong!  The only way to find out about write errors is  by
       watching	the kernel messages, or by switching on the ver-
       ify (-K) option.

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

AUTHOR
       Mark Brukhartz
       ..!ihnp4!laidbak!mdb
       Jeff Buhrt (floppy/compression extensions)
       uunet!sawmill!prslnk!buhrt

