freshen to upstream CVS head
[debian/pax] / pax.1
diff --git a/pax.1 b/pax.1
index acfb48979ad27aad7e7572cb31509665ff56ee9d..d9ef442bbf62c467170c96a90bf6ebf458472a1f 100644 (file)
--- a/pax.1
+++ b/pax.1
@@ -1,4 +1,4 @@
-.\"    $OpenBSD: pax.1,v 1.7 1998/09/23 00:13:49 aaron Exp $
+.\"    $OpenBSD: pax.1,v 1.54 2008/06/11 07:42:50 jmc Exp $
 .\"    $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
 .\"
 .\"
 .\"    @(#)pax.1       8.4 (Berkeley) 4/18/94
 .\"
-.Dd April 18, 1994
+.Dd $Mdocdate: June 11 2008 $
 .Dt PAX 1
-.Os BSD 4.4
+.Os
 .Sh NAME
 .Nm pax
 .Nd read and write file archives and copy directory hierarchies
 .Sh SYNOPSIS
-.Nm pax
-.Op Fl cdnv
 .Bk -words
+.Nm pax
+.Op Fl 0cdjnOvz
+.Op Fl E Ar limit
 .Op Fl f Ar archive
-.Ek
-.Bk -words
+.Op Fl G Ar group
 .Op Fl s Ar replstr
-.Ar ...
-.Ek
-.Bk -words
+.Op Fl T Ar range
 .Op Fl U Ar user
-.Ar ...
-.Ek
-.Bk -words
-.Op Fl G Ar group
-.Ar ...
-.Ek
-.Bk -words
-.Oo
-.Fl T
-.Op Ar from_date
-.Op Ar ,to_date
-.Oc
-.Ar ...
-.Ek
 .Op Ar pattern ...
 .Nm pax
 .Fl r
-.Op Fl cdiknuvDYZ
-.Bk -words
+.Op Fl 0cDdijknOuvYZz
+.Op Fl E Ar limit
 .Op Fl f Ar archive
-.Ek
-.Bk -words
+.Op Fl G Ar group
 .Op Fl o Ar options
-.Ar ...
-.Ek
-.Bk -words
 .Op Fl p Ar string
-.Ar ...
-.Ek
-.Bk -words
 .Op Fl s Ar replstr
-.Ar ...
-.Ek
-.Op Fl E Ar limit
-.Bk -words
+.Op Fl T Ar range
 .Op Fl U Ar user
-.Ar ...
-.Ek
-.Bk -words
-.Op Fl G Ar group
-.Ar ...
-.Ek
-.Bk -words
-.Oo
-.Fl T
-.Op Ar from_date
-.Op Ar ,to_date
-.Oc
-.Ar ...
-.Ek
 .Op Ar pattern ...
 .Nm pax
 .Fl w
-.Op Fl dituvHLPX
-.Bk -words
+.Op Fl 0adHijLOPtuvXz
+.Op Fl B Ar bytes
 .Op Fl b Ar blocksize
-.Ek
-.Oo
-.Op Fl a
 .Op Fl f Ar archive
-.Oc
-.Bk -words
-.Op Fl x Ar format
-.Ek
-.Bk -words
-.Op Fl s Ar replstr
-.Ar ...
-.Ek
-.Bk -words
+.Op Fl G Ar group
 .Op Fl o Ar options
-.Ar ...
-.Ek
-.Bk -words
+.Op Fl s Ar replstr
+.Op Fl T Ar range
 .Op Fl U Ar user
-.Ar ...
-.Ek
-.Bk -words
-.Op Fl G Ar group
-.Ar ...
-.Ek
-.Bk -words
-.Op Fl B Ar bytes
-.Ek
-.Bk -words
-.Oo
-.Fl T
-.Op Ar from_date
-.Op Ar ,to_date
-.Op Ar /[c][m]
-.Oc
-.Ar ...
-.Ek
+.Op Fl x Ar format
 .Op Ar file ...
 .Nm pax
-.Fl r
-.Fl w
-.Op Fl diklntuvDHLPXYZ
-.Bk -words
+.Fl rw
+.Op Fl 0DdHijkLlnOPtuvXYZ
+.Op Fl G Ar group
 .Op Fl p Ar string
-.Ar ...
-.Ek
-.Bk -words
 .Op Fl s Ar replstr
-.Ar ...
-.Ek
-.Bk -words
+.Op Fl T Ar range
 .Op Fl U Ar user
-.Ar ...
-.Ek
-.Bk -words
-.Op Fl G Ar group
-.Ar ...
-.Ek
-.Bk -words
-.Oo
-.Fl T
-.Op Ar from_date
-.Op Ar ,to_date
-.Op Ar /[c][m]
-.Oc
-.Ar ...
-.Ek
 .Op Ar file ...
 .Ar directory
+.Ek
 .Sh DESCRIPTION
-.Nm pax
-will read, write, and list the members of an archive file,
+.Nm
+will read, write, and list the members of an archive file
 and will copy directory hierarchies.
-.Nm pax 
-operation is independent of the specific archive format,
+.Nm
+operation is independent of the specific archive format
 and supports a wide variety of different archive formats.
 A list of supported archive formats can be found under the description of the
 .Fl x
@@ -196,30 +103,29 @@ The presence of the
 and the
 .Fl w
 options specifies which of the following functional modes
-.Nm pax
+.Nm
 will operate under:
 .Em list , read , write ,
 and
 .Em copy .
 .Bl -tag -width 6n
-.It <none>
+.It \*(Ltnone\*(Gt
 .Em List .
-.Nm pax
-will write to
-.Dv standard output
+.Nm
+will write to standard output
 a table of contents of the members of the archive file read from
-.Dv standard input ,
-whose pathnames match the specified
-.Ar patterns .
+standard input, whose pathnames match the specified
+.Ar pattern
+arguments.
 The table of contents contains one filename per line
 and is written using single line buffering.
 .It Fl r
 .Em Read .
-.Nm pax
-extracts the members of the archive file read from the
-.Dv standard input ,
-with pathnames matching the specified 
-.Ar patterns .
+.Nm
+extracts the members of the archive file read from the standard input,
+with pathnames matching the specified
+.Ar pattern
+arguments.
 The archive format and blocking is automatically determined on input.
 When an extracted file is a directory, the entire file hierarchy
 rooted at that directory is extracted.
@@ -230,32 +136,30 @@ the extracted files are discussed in more detail under the
 option.
 .It Fl w
 .Em Write .
-.Nm pax
-writes an archive containing the 
+.Nm
+writes an archive containing the
 .Ar file
-operands to
-.Dv standard output
+operands to standard output
 using the specified archive format.
-When no 
+When no
 .Ar file
-operands are specified, a list of files to copy with one per line is read from 
-.Dv standard input .
-When a 
+operands are specified, a list of files to copy with one per line is read from
+standard input.
+When a
 .Ar file
 operand is also a directory, the entire file hierarchy rooted
 at that directory will be included.
-.It Fl r Fl w
+.It Fl rw
 .Em Copy .
-.Nm pax
+.Nm
 copies the
 .Ar file
 operands to the destination
 .Ar directory .
-When no 
+When no
 .Ar file
 operands are specified, a list of files to copy with one per line is read from
-the
-.Dv standard input .
+the standard input.
 When a
 .Ar file
 operand is also a directory the entire file
@@ -268,7 +172,7 @@ the original and the copied files (see the
 .Fl l
 option below).
 .Pp
-.Em Warning :
+.Sy Warning :
 The destination
 .Ar directory
 must not be one of the
@@ -286,12 +190,12 @@ While processing a damaged archive during a
 or
 .Em list
 operation,
-.Nm pax
+.Nm
 will attempt to recover from media defects and will search through the archive
 to locate and process the largest number of archive members possible (see the
 .Fl E
 option for more details on error handling).
-.Sh OPERANDS
+.Pp
 The
 .Ar directory
 operand specifies a destination directory pathname.
@@ -299,7 +203,7 @@ If the
 .Ar directory
 operand does not exist, or it is not writable by the user,
 or it is not of type directory,
-.Nm pax
+.Nm
 will exit with a non-zero exit status.
 .Pp
 The
@@ -307,22 +211,21 @@ The
 operand is used to select one or more pathnames of archive members.
 Archive members are selected using the pattern matching notation described
 by
-.Xr fnmatch 3 .
-When the 
+.Xr glob 3 .
+When the
 .Ar pattern
 operand is not supplied, all members of the archive will be selected.
-When a 
+When a
 .Ar pattern
 matches a directory, the entire file hierarchy rooted at that directory will
 be selected.
 When a
 .Ar pattern
 operand does not select at least one archive member,
-.Nm pax
+.Nm
 will write these
 .Ar pattern
-operands in a diagnostic message to
-.Dv standard error
+operands in a diagnostic message to standard error
 and then exit with a non-zero exit status.
 .Pp
 The
@@ -331,63 +234,47 @@ operand specifies the pathname of a file to be copied or archived.
 When a
 .Ar file
 operand does not select at least one archive member,
-.Nm pax
+.Nm
 will write these
 .Ar file
-operand pathnames in a diagnostic message to
-.Dv standard error
+operand pathnames in a diagnostic message to standard error
 and then exit with a non-zero exit status.
-.Sh OPTIONS
-The following options are supported:
-.Bl -tag -width 4n
-.It Fl r
-Read an archive file from
-.Dv standard input
-and extract the specified
-.Ar files .
-If any intermediate directories are needed in order to extract an archive
-member, these directories will be created as if
-.Xr mkdir 2
-was called with the bitwise inclusive
-.Dv OR 
-of
-.Dv S_IRWXU , S_IRWXG ,
-and
-.Dv S_IRWXO 
-as the mode argument.
-When the selected archive format supports the specification of linked
-files and these files cannot be linked while the archive is being extracted,
-.Nm pax
-will write a diagnostic message to
-.Dv standard error
-and exit with a non-zero exit status at the completion of operation.
-.It Fl w
-Write files to the
-.Dv standard output
-in the specified archive format.
-When no
-.Ar file
-operands are specified,
-.Dv standard input
-is read for a list of pathnames with one per line without any leading or
-trailing
-.Aq blanks .
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl 0
+Use the NUL
+.Pq Ql \e0
+character as a pathname terminator, instead of newline
+.Pq Ql \en .
+This applies only to the pathnames read from standard input in
+the write and copy modes,
+and to the pathnames written to standard output in list mode.
+This option is expected to be used in concert with the
+.Fl print0
+function in
+.Xr find 1
+or the
+.Fl 0
+flag in
+.Xr xargs 1 .
 .It Fl a
-Append
-.Ar files
+Append the given
+.Ar file
+operands
 to the end of an archive that was previously written.
 If an archive format is not specified with a
 .Fl x
 option, the format currently being used in the archive will be selected.
 Any attempt to append to an archive in a format different from the
-format already used in the archive will cause 
-.Nm pax
+format already used in the archive will cause
+.Nm
 to exit immediately
 with a non-zero exit status.
 The blocking size used in the archive volume where writing starts
 will continue to be used for the remainder of that archive volume.
 .Pp
-.Em Warning :
+.Sy Warning :
 Many storage devices are not able to support the operations necessary
 to perform an append operation.
 Any attempt to append to an archive stored on such a device may damage the
@@ -395,6 +282,28 @@ archive or have other unpredictable results.
 Tape drives in particular are more likely to not support an append operation.
 An archive stored in a regular file system file or on a disk device will
 usually support an append operation.
+.It Fl B Ar bytes
+Limit the number of bytes written to a single archive volume to
+.Ar bytes .
+The
+.Ar bytes
+limit can end with
+.Sq Li m ,
+.Sq Li k ,
+or
+.Sq Li b
+to specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.
+A pair of
+.Ar bytes
+limits can be separated by
+.Sq Li x
+to indicate a product.
+.Pp
+.Em Warning :
+Only use this option when writing an archive to a device which supports
+an end of file read condition based on last (or largest) write offset
+(such as a regular file or a tape drive).
+The use of this option with a floppy or hard disk is not recommended.
 .It Fl b Ar blocksize
 When
 .Em writing
@@ -404,7 +313,7 @@ bytes per write to the archive file.
 The
 .Ar blocksize
 must be a multiple of 512 bytes with a maximum of 64512 bytes.
-Archives larger than 32256 bytes violate the
+Archive block sizes larger than 32256 bytes violate the
 .Tn POSIX
 standard and will not be portable to all systems.
 A
@@ -421,7 +330,7 @@ can be separated by
 to indicate a product.
 A specific archive device may impose additional restrictions on the size
 of blocking it will support.
-When blocking is not specified, the default 
+When blocking is not specified, the default
 .Ar blocksize
 is dependent on the specific archive format being used (see the
 .Fl x
@@ -434,28 +343,81 @@ those specified by the
 and
 .Ar file
 operands.
+.It Fl D
+This option is the same as the
+.Fl u
+option, except that the file inode change time is checked instead of the
+file modification time.
+The file inode change time can be used to select files whose inode information
+(e.g., UID, GID, etc.) is newer than a copy of the file in the destination
+.Ar directory .
 .It Fl d
 Cause files of type directory being copied or archived, or archive members of
 type directory being extracted, to match only the directory file or archive
 member and not the file hierarchy rooted at the directory.
+.It Fl E Ar limit
+Limit the number of consecutive read faults while trying to read a flawed
+archive to
+.Ar limit .
+With a positive
+.Ar limit ,
+.Nm
+will attempt to recover from an archive read error and will
+continue processing starting with the next file stored in the archive.
+A
+.Ar limit
+of 0 will cause
+.Nm
+to stop operation after the first read error is detected on an archive volume.
+A
+.Ar limit
+of
+.Li NONE
+will cause
+.Nm
+to attempt to recover from read errors forever.
+The default
+.Ar limit
+is a small positive number of retries.
+.Pp
+.Em Warning :
+Using this option with
+.Li NONE
+should be used with extreme caution as
+.Nm
+may get stuck in an infinite loop on a very badly flawed archive.
 .It Fl f Ar archive
 Specify
 .Ar archive
 as the pathname of the input or output archive, overriding the default
-.Dv standard input
-(for
+standard input (for
 .Em list
 and
 .Em read )
-or
-.Dv standard output
+or standard output
 (for
 .Em write ) .
 A single archive may span multiple files and different archive devices.
 When required,
-.Nm pax
+.Nm
 will prompt for the pathname of the file or device of the next volume in the
 archive.
+.It Fl G Ar group
+Select a file based on its
+.Ar group
+name, or when starting with a
+.Cm # ,
+a numeric GID.
+A
+.Ql \e
+can be used to escape the
+.Cm # .
+Multiple
+.Fl G
+options may be supplied and checking stops with the first match.
+.It Fl H
+Follow only command-line symbolic links while performing a physical file
+system traversal.
 .It Fl i
 Interactively rename files or archive members.
 For each archive member matching a
@@ -463,27 +425,36 @@ For each archive member matching a
 operand or each file matching a
 .Ar file
 operand,
-.Nm pax
+.Nm
 will prompt to
 .Pa /dev/tty
-giving the name of the file, its file mode and its modification time.
-.Nm pax
+giving the name of the file, its file mode, and its modification time.
+.Nm
 will then read a line from
 .Pa /dev/tty .
 If this line is blank, the file or archive member is skipped.
 If this line consists of a single period, the
 file or archive member is processed with no modification to its name.
 Otherwise, its name is replaced with the contents of the line.
-.Nm pax
-will immediately exit with a non-zero exit status if 
-.Dv <EOF>
+.Nm
+will immediately exit with a non-zero exit status if
+.Dv EOF
 is encountered when reading a response or if
 .Pa /dev/tty
 cannot be opened for reading and writing.
+.It Fl j
+Use bzip2 to compress (decompress) the archive while writing (reading).
+The bzip2 utility must be installed separately.
+Incompatible with
+.Fl a .
 .It Fl k
 Do not overwrite existing files.
+.It Fl L
+Follow all symbolic links to perform a logical file system traversal.
 .It Fl l
-(The lowercase letter ``ell.'') Link files.
+(The lowercase letter
+.Dq ell . )
+Link files.
 In the
 .Em copy
 mode
@@ -498,8 +469,15 @@ No more than one archive member is matched for each
 .Ar pattern .
 When members of type directory are matched, the file hierarchy rooted at that
 directory is also matched (unless
-.Fl d 
+.Fl d
 is also specified).
+.It Fl O
+Force the archive to be one volume.
+If a volume ends prematurely,
+.Nm
+will not prompt for a new volume.
+This option can be useful for
+automated tasks where error recovery cannot be performed by a human.
 .It Fl o Ar options
 Information to modify the algorithm for extracting or writing archive files
 which is specific to the archive format specified by
@@ -507,7 +485,21 @@ which is specific to the archive format specified by
 In general,
 .Ar options
 take the form:
-.Cm name=value .
+.Ar name Ns = Ns Ar value .
+.Pp
+The following options are available for the old
+.Bx
+.Em tar
+format:
+.Pp
+.Bl -tag -width Ds -compact
+.It Cm nodir
+.It Cm write_opt=nodir
+When writing archives, omit the storage of directories.
+.El
+.It Fl P
+Do not follow symbolic links, perform a physical file system traversal.
+This is the default mode.
 .It Fl p Ar string
 Specify one or more file characteristic options (privileges).
 The
@@ -520,25 +512,25 @@ and
 .Cm p .
 Multiple characteristics can be concatenated within the same string
 and multiple
-.Fl p 
+.Fl p
 options can be specified.
-The meaning of the specification characters are as follows:
+The meanings of the specification characters are as follows:
 .Bl -tag -width 2n
 .It Cm a
 Do not preserve file access times.
 By default, file access times are preserved whenever possible.
 .It Cm e
-.Sq Preserve everything ,
+.Dq Preserve everything ,
 the user ID, group ID, file mode bits,
 file access time, and file modification time.
 This is intended to be used by
 .Em root ,
 someone with all the appropriate privileges, in order to preserve all
 aspects of the files as they are recorded in the archive.
-The 
+The
 .Cm e
 flag is the sum of the
-.Cm o 
+.Cm o
 and
 .Cm p
 flags.
@@ -548,10 +540,10 @@ By default, file modification times are preserved whenever possible.
 .It Cm o
 Preserve the user ID and group ID.
 .It Cm p
-.Sq Preserve
+.Dq Preserve
 the file mode bits.
-This intended to be used by a
-.Em user 
+This is intended to be used by a
+.Em user
 with regular privileges who wants to preserve all aspects of the file other
 than the ownership.
 The file times are preserved by default, but two other flags are offered to
@@ -565,285 +557,130 @@ extracted file, subject to the permissions of the invoking
 process.
 Otherwise the attribute of the extracted file is determined as
 part of the normal file creation action.
-If neither the 
+If neither the
 .Cm e
 nor the
 .Cm o
 specification character is specified, or the user ID and group ID are not
 preserved for any reason,
-.Nm pax
+.Nm
 will not set the
-.Dv S_ISUID 
+.Dv S_ISUID
 .Em ( setuid )
 and
 .Dv S_ISGID
 .Em ( setgid )
 bits of the file mode.
 If the preservation of any of these items fails for any reason,
-.Nm pax
-will write a diagnostic message to
-.Dv standard error .
+.Nm
+will write a diagnostic message to standard error.
 Failure to preserve these items will affect the final exit status,
 but will not cause the extracted file to be deleted.
 If the file characteristic letters in any of the string option-arguments are
 duplicated or conflict with each other, the one(s) given last will take
 precedence.
 For example, if
-.Dl Fl p Ar eme
+.Fl p Ar eme
 is specified, file modification times are still preserved.
-.It Fl s Ar replstr
-Modify the file or archive member names specified by the
-.Ar pattern
-or
+.It Fl r
+Read an archive file from standard input
+and extract the specified
 .Ar file
-operands according to the substitution expression
+operands.
+If any intermediate directories are needed in order to extract an archive
+member, these directories will be created as if
+.Xr mkdir 2
+was called with the bitwise inclusive
+.Tn OR
+of
+.Dv S_IRWXU , S_IRWXG ,
+and
+.Dv S_IRWXO
+as the mode argument.
+When the selected archive format supports the specification of linked
+files and these files cannot be linked while the archive is being extracted,
+.Nm
+will write a diagnostic message to standard error
+and exit with a non-zero exit status at the completion of operation.
+.It Fl s Ar replstr
+Modify the archive member names according to the substitution expression
 .Ar replstr ,
 using the syntax of the
 .Xr ed 1
 utility regular expressions.
-The format of these regular expressions are:
+.Ar file
+or
+.Ar pattern
+arguments may be given to restrict the list of archive members to those
+specified.
+.Pp
+The format of these regular expressions is:
+.Pp
 .Dl /old/new/[gp]
+.Pp
 As in
 .Xr ed 1 ,
-.Cm old
-is a basic regular expression and
-.Cm new
-can contain an ampersand (&), \\n (where n is a digit) back-references,
+.Ar old
+is a basic regular expression (see
+.Xr re_format 7 )
+and
+.Ar new
+can contain an ampersand
+.Pq Ql & ,
+.Ql \e Ns Em n
+(where
+.Em n
+is a digit) back-references,
 or subexpression matching.
 The
-.Cm old
-string may also contain
-.Dv <newline>
-characters.
-Any non-null character can be used as a delimiter (/ is shown here).
+.Ar old
+string may also contain newline characters.
+Any non-null character can be used as a delimiter
+.Po
+.Ql /
+is shown here
+.Pc .
 Multiple
 .Fl s
 expressions can be specified.
 The expressions are applied in the order they are specified on the
 command line, terminating with the first successful substitution.
+.Pp
 The optional trailing
 .Cm g
-continues to apply the substitution expression to the pathname substring
+continues to apply the substitution expression to the pathname substring,
 which starts with the first character following the end of the last successful
-substitution. The first unsuccessful substitution stops the operation of the
+substitution.
+The first unsuccessful substitution stops the operation of the
 .Cm g
 option.
 The optional trailing
 .Cm p
 will cause the final result of a successful substitution to be written to
-.Dv standard error
-in the following format:
-.Dl <original pathname> >> <new pathname>
+standard error in the following format:
+.Pp
+.D1 Em original-pathname No \*(Gt\*(Gt Em new-pathname
+.Pp
 File or archive member names that substitute to the empty string
 are not selected and will be skipped.
-.It Fl t
-Reset the access times of any file or directory read or accessed by
-.Nm pax
-to be the same as they were before being read or accessed by
-.Nm pax .
-.It Fl u
-Ignore files that are older (having a less recent file modification time)
-than a pre-existing file or archive member with the same name.
-During
-.Em read ,
-an archive member with the same name as a file in the file system will be
-extracted if the archive member is newer than the file.
-During
-.Em write ,
-a file system member with the same name as an archive member will be
-written to the archive if it is newer than the archive member.
-During
-.Em copy ,
-the file in the destination hierarchy is replaced by the file in the source
-hierarchy or by a link to the file in the source hierarchy if the file in
-the source hierarchy is newer.
-.It Fl v
-During a
-.Em list
-operation, produce a verbose table of contents using the format of the
-.Xr ls 1
-utility with the
-.Fl l
-option.
-For pathnames representing a hard link to a previous member of the archive,
-the output has the format:
-.Dl <ls -l listing> == <link name>
-For pathnames representing a symbolic link, the output has the format:
-.Dl <ls -l listing> => <link name>
-Where <ls -l listing> is the output format specified by the 
-.Xr ls 1
-utility when used with the
-.Fl l
-option.
-Otherwise for all the other operational modes
-.Po Em read , write , Li and Em copy
-.Pc ,
-pathnames are written and flushed to
-.Dv standard error
-without a trailing
-.Dv <newline>
-as soon as processing begins on that file or
-archive member.
-The trailing
-.Dv <newline> ,
-is not buffered, and is written only after the file has been read or written.
-.It Fl x Ar format
-Specify the output archive format, with the default format being
-.Ar ustar .
-.Nm pax
-currently supports the following formats:
-.Bl -tag -width "sv4cpio"
-.It Ar cpio
-The extended cpio interchange format specified in the
-.St -p1003.2
-standard.
-The default blocksize for this format is 5120 bytes.
-Inode and device information about a file (used for detecting file hard links
-by this format) which may be truncated by this format is detected by
-.Nm pax
-and is repaired.
-.It Ar bcpio
-The old binary cpio format.
-The default blocksize for this format is 5120 bytes.
-This format is not very portable and should not be used when other formats
-are available.
-Inode and device information about a file (used for detecting file hard links
-by this format) which may be truncated by this format is detected by
-.Nm pax
-and is repaired.
-.It Ar sv4cpio
-The System V release 4 cpio.
-The default blocksize for this format is 5120 bytes.
-Inode and device information about a file (used for detecting file hard links
-by this format) which may be truncated by this format is detected by
-.Nm pax
-and is repaired.
-.It Ar sv4crc
-The System V release 4 cpio with file crc checksums.
-The default blocksize for this format is 5120 bytes.
-Inode and device information about a file (used for detecting file hard links
-by this format) which may be truncated by this format is detected by
-.Nm pax
-and is repaired.
-.It Ar tar
-The old BSD tar format as found in BSD4.3.
-The default blocksize for this format is 10240 bytes.
-Pathnames stored by this format must be 100 characters or less in length.
-Only
-.Em regular
-files,
-.Em  hard links , soft links ,
-and
-.Em  directories
-will be archived (other file system types are not supported).
-For backwards compatibility with even older tar formats, a
-.Fl o
-option can be used when writing an archive to omit the storage of directories.
-This option takes the form:
-.Dl Fl o Cm write_opt=nodir
-.It Ar ustar
-The extended tar interchange format specified in the
-.St -p1003.2
-standard.
-The default blocksize for this format is 10240 bytes.
-Pathnames stored by this format must be 250 characters or less in length.
-.El
-.Pp
-.Nm pax
-will detect and report any file that it is unable to store or extract
-as the result of any specific archive format restrictions.
-The individual archive formats may impose additional restrictions on use.
-Typical archive format restrictions include (but are not limited to):
-file pathname length, file size, link pathname length, and the type of the
-file.
-.It Fl B Ar bytes
-Limit the number of bytes written to a single archive volume to
-.Ar bytes .
-The
-.Ar bytes
-limit can end with
-.Sq Li m ,
-.Sq Li k ,
-or
-.Sq Li b
-to specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.
-A pair of
-.Ar bytes
-limits can be separated by
-.Sq Li x
-to indicate a product.
-.Pp
-.Em Warning :
-Only use this option when writing an archive to a device which supports
-an end of file read condition based on last (or largest) write offset
-(such as a regular file or a tape drive). 
-The use of this option with a floppy or hard disk is not recommended.
-.It Fl D
-This option is the same as the
-.Fl u
-option, except that the file inode change time is checked instead of the
-file modification time.
-The file inode change time can be used to select files whose inode information
-(e.g. UID, GID, etc.) is newer than a copy of the file in the destination
-.Ar directory .
-.It Fl E Ar limit
-Limit the number of consecutive read faults while trying to read a flawed
-archive to
-.Ar limit .
-With a positive
-.Ar limit ,
-.Nm pax
-will attempt to recover from an archive read error and will
-continue processing starting with the next file stored in the archive.
-A
-.Ar limit
-of 0 will cause
-.Nm pax
-to stop operation after the first read error is detected on an archive volume.
-A
-.Ar limit
-of
-.Li NONE
-will cause
-.Nm pax 
-to attempt to recover from read errors forever.
-The default 
-.Ar limit
-is a small positive number of retries.
-.Pp
-.Em Warning: 
-Using this option with
-.Li NONE
-should be used with extreme caution as
-.Nm pax
-may get stuck in an infinite loop on a very badly flawed archive.
-.It Fl G Ar group
-Select a file based on its
-.Ar group
-name, or when starting with a
-.Cm # ,
-a numeric gid.
-A '\\' can be used to escape the
-.Cm # .
-Multiple 
-.Fl G
-options may be supplied and checking stops with the first match.
-.It Fl H
-Follow only command line symbolic links while performing a physical file
-system traversal.
-.It Fl L
-Follow all symbolic links to perform a logical file system traversal.
-.It Fl P
-Do not follow symbolic links, perform a physical file system traversal.
-This is the default mode.
-.It Fl T Ar [from_date][,to_date][/[c][m]]
+.It Fl T Ar range
 Allow files to be selected based on a file modification or inode change
-time falling within a specified time range of 
+time falling within the specified time range.
+The range has the format:
+.Sm off
+.Bd -filled -offset indent
+.Oo Ar from_date Oc Oo ,
+.Ar to_date Oc Oo /
+.Oo Cm c Oc Op Cm m Oc
+.Ed
+.Sm on
+.Pp
+The dates specified by
 .Ar from_date
 to
 .Ar to_date
-(the dates are inclusive).
-If only a 
+are inclusive.
+If only a
 .Ar from_date
 is supplied, all files with a modification or inode change time
 equal to or younger are selected.
@@ -851,7 +688,7 @@ If only a
 .Ar to_date
 is supplied, all files with a modification or inode change time
 equal to or older will be selected.
-When the 
+When the
 .Ar from_date
 is equal to the
 .Ar to_date ,
@@ -859,94 +696,239 @@ only files with a modification or inode change time of exactly that
 time will be selected.
 .Pp
 When
-.Nm pax
-is in the 
+.Nm
+is in the
 .Em write
 or
 .Em copy
 mode, the optional trailing field
-.Ar [c][m]
+.Oo Cm c Oc Op Cm m
 can be used to determine which file time (inode change, file modification or
 both) are used in the comparison.
 If neither is specified, the default is to use file modification time only.
 The
-.Ar m
+.Cm m
 specifies the comparison of file modification time (the time when
 the file was last written).
 The
-.Ar c
+.Cm c
 specifies the comparison of inode change time (the time when the file
-inode was last changed; e.g. a change of owner, group, mode, etc).
-When 
-.Ar c
+inode was last changed; e.g., a change of owner, group, mode, etc).
+When
+.Cm c
 and
-.Ar m
+.Cm m
 are both specified, then the modification and inode change times are
 both compared.
+.Pp
 The inode change time comparison is useful in selecting files whose
 attributes were recently changed or selecting files which were recently
 created and had their modification time reset to an older time (as what
 happens when a file is extracted from an archive and the modification time
 is preserved).
 Time comparisons using both file times is useful when
-.Nm pax
+.Nm
 is used to create a time based incremental archive (only files that were
 changed during a specified time range will be archived).
 .Pp
 A time range is made up of six different fields and each field must contain two
 digits.
 The format is:
-.Dl [yy[mm[dd[hh]]]]mm[.ss]
+.Pp
+.Dl [[[[[cc]yy]mm]dd]HH]MM[.SS]
+.Pp
 Where
-.Cm yy
+.Ar cc
+is the first two digits of the year (the century),
+.Ar yy
 is the last two digits of the year,
 the first
-.Cm mm
+.Ar mm
 is the month (from 01 to 12),
-.Cm dd
+.Ar dd
 is the day of the month (from 01 to 31),
-.Cm hh
+.Ar HH
 is the hour of the day (from 00 to 23),
-the second
-.Cm mm
+.Ar MM
 is the minute (from 00 to 59),
 and
-.Cm ss
+.Ar SS
 is the seconds (from 00 to 59).
 The minute field
-.Cm mm
+.Ar MM
 is required, while the other fields are optional and must be added in the
 following order:
-.Dl Cm hh , dd , mm , yy .
-The 
-.Cm ss
+.Ar HH , dd , mm ,
+.Ar yy , cc .
+.Pp
+The
+.Ar SS
 field may be added independently of the other fields.
 Time ranges are relative to the current time, so
-.Dl Fl T Ar 1234/cm
+.Ic -T 1234/cm
 would select all files with a modification or inode change time
 of 12:34 PM today or later.
-Multiple 
+Multiple
 .Fl T
 time range can be supplied and checking stops with the first match.
+.It Fl t
+Reset the access times of any file or directory read or accessed by
+.Nm
+to be the same as they were before being read or accessed by
+.Nm pax .
 .It Fl U Ar user
 Select a file based on its
 .Ar user
 name, or when starting with a
 .Cm # ,
 a numeric UID.
-A '\\' can be used to escape the
+A
+.Ql \e
+can be used to escape the
 .Cm # .
-Multiple 
+Multiple
 .Fl U
 options may be supplied and checking stops with the first match.
+.It Fl u
+Ignore files that are older (having a less recent file modification time)
+than a pre-existing file or archive member with the same name.
+During
+.Em read ,
+an archive member with the same name as a file in the file system will be
+extracted if the archive member is newer than the file.
+During
+.Em write ,
+a file system member with the same name as an archive member will be
+written to the archive if it is newer than the archive member.
+During
+.Em copy ,
+the file in the destination hierarchy is replaced by the file in the source
+hierarchy or by a link to the file in the source hierarchy if the file in
+the source hierarchy is newer.
+.It Fl v
+During a
+.Em list
+operation, produce a verbose table of contents using the format of the
+.Xr ls 1
+utility with the
+.Fl l
+option.
+For pathnames representing a hard link to a previous member of the archive,
+the output has the format:
+.Pp
+.Dl Em ls -l listing Li == Em link-name
+.Pp
+For pathnames representing a symbolic link, the output has the format:
+.Pp
+.Dl Em ls -l listing Li =\*(Gt Em link-name
+.Pp
+Where
+.Em ls -l listing
+is the output format specified by the
+.Xr ls 1
+utility when used with the
+.Fl l
+option.
+Otherwise for all the other operational modes
+.Po Em read , write , No and Em copy
+.Pc ,
+pathnames are written and flushed to standard error
+without a trailing newline
+as soon as processing begins on that file or
+archive member.
+The trailing newline
+is not buffered and is written only after the file has been read or written.
+.It Fl w
+Write files to the standard output
+in the specified archive format.
+When no
+.Ar file
+operands are specified, standard input
+is read for a list of pathnames with one per line without any leading or
+trailing
+.Aq blanks .
 .It Fl X
 When traversing the file hierarchy specified by a pathname,
 do not descend into directories that have a different device ID.
 See the
-.Li st_dev 
+.Li st_dev
 field as described in
 .Xr stat 2
 for more information about device IDs.
+.It Fl x Ar format
+Specify the output archive format, with the default format being
+.Cm ustar .
+.Nm
+currently supports the following formats:
+.Bl -tag -width "sv4cpio"
+.It Cm bcpio
+The old binary cpio format.
+The default blocksize for this format is 5120 bytes.
+This format is not very portable and should not be used when other formats
+are available.
+Inode and device information about a file (used for detecting file hard links
+by this format), which may be truncated by this format, is detected by
+.Nm
+and is repaired.
+.It Cm cpio
+The extended cpio interchange format specified in the
+.St -p1003.2
+standard.
+The default blocksize for this format is 5120 bytes.
+Inode and device information about a file (used for detecting file hard links
+by this format), which may be truncated by this format, is detected by
+.Nm
+and is repaired.
+.It Cm sv4cpio
+The System V release 4 cpio.
+The default blocksize for this format is 5120 bytes.
+Inode and device information about a file (used for detecting file hard links
+by this format), which may be truncated by this format, is detected by
+.Nm
+and is repaired.
+.It Cm sv4crc
+The System V release 4 cpio with file CRC checksums.
+The default blocksize for this format is 5120 bytes.
+Inode and device information about a file (used for detecting file hard links
+by this format), which may be truncated by this format, is detected by
+.Nm
+and is repaired.
+.It Cm tar
+The old
+.Bx
+tar format as found in
+.Bx 4.3 .
+The default blocksize for this format is 10240 bytes.
+Pathnames stored by this format must be 100 characters or less in length.
+Only
+.Em regular
+files,
+.Em hard links , soft links ,
+and
+.Em directories
+will be archived (other file system types are not supported).
+For backwards compatibility with even older tar formats, a
+.Fl o
+option can be used when writing an archive to omit the storage of directories.
+This option takes the form:
+.Pp
+.Dl Fl o Cm write_opt=nodir
+.It Cm ustar
+The extended tar interchange format specified in the
+.St -p1003.2
+standard.
+The default blocksize for this format is 10240 bytes.
+Filenames stored by this format must be 100 characters or less in length;
+the total pathname must be 255 characters or less.
+.El
+.Pp
+.Nm
+will detect and report any file that it is unable to store or extract
+as the result of any specific archive format restrictions.
+The individual archive formats may impose additional restrictions on use.
+Typical archive format restrictions include (but are not limited to):
+file pathname length, file size, link pathname length, and the type of the
+file.
 .It Fl Y
 This option is the same as the
 .Fl D
@@ -957,11 +939,18 @@ This option is the same as the
 .Fl u
 option, except that the modification time is checked using the
 pathname created after all the file name modifications have completed.
+.It Fl z
+Use
+.Xr gzip 1
+to compress (decompress) the archive while writing (reading).
+Incompatible with
+.Fl a .
 .El
 .Pp
 The options that operate on the names of files or archive members
 .Po Fl c ,
 .Fl i ,
+.Fl j ,
 .Fl n ,
 .Fl s ,
 .Fl u ,
@@ -999,7 +988,7 @@ Then the
 and
 .Fl Z
 options will be applied based on the final pathname.
-Finally, the 
+Finally, the
 .Fl v
 option will write the names resulting from these modifications.
 .Pp
@@ -1015,13 +1004,13 @@ based only on the user specified pathnames as modified by the
 .Fl D ,
 .Fl G ,
 .Fl T ,
-and 
+and
 .Fl U
 options (the
 .Fl D
 option only applies during a copy operation).
 Then any
-.Fl s 
+.Fl s
 and
 .Fl i
 options will modify in that order, the names of these selected files.
@@ -1044,135 +1033,131 @@ options are specified along with the
 .Fl n
 option, a file is not considered selected unless it is newer
 than the file to which it is compared.
+.Sh ENVIRONMENT
+.Bl -tag -width Fl
+.It Ev TMPDIR
+Path in which to store temporary files.
+.El
 .Sh EXAMPLES
-The command:
-.Dl pax -w -f /dev/rst0 .\ 
-copies the contents of the current directory to the device
-.Pa /dev/rst0 .
+Copy the contents of the current directory to the device
+.Pa /dev/rst0 :
 .Pp
-The command:
-.Dl pax -v -f filename
-gives the verbose table of contents for an archive stored in
-.Pa filename .
+.Dl $ pax -w -f /dev/rst0 \&.
 .Pp
-The following commands:
-.Dl mkdir newdir
-.Dl cd olddir
-.Dl pax -rw .\ newdir
-will copy the entire
+Give the verbose table of contents for an archive stored in
+.Pa filename :
+.Pp
+.Dl $ pax -v -f filename
+.Pp
+This sequence of commands will copy the entire
 .Pa olddir
 directory hierarchy to
-.Pa newdir .
+.Pa newdir :
+.Bd -literal -offset indent
+$ mkdir newdir
+$ cd olddir
+$ pax -rw . ../newdir
+.Ed
+.Pp
+Extract files from the archive
+.Pa a.pax .
+Files rooted in
+.Pa /usr
+are extracted relative to the current working directory;
+all other files are extracted to their unmodified path.
 .Pp
-The command:
-.Dl pax -r -s ',^//*usr//*,,' -f a.pax
-reads the archive 
-.Pa a.pax ,
-with all files rooted in ``/usr'' into the archive extracted relative to the
-current directory.
+.Dl $ pax -r -s ',^/usr/,,' -f a.pax
 .Pp
-The command:
-.Dl pax -rw -i .\ dest_dir
-can be used to interactively select the files to copy from the current
-directory to
-.Pa dest_dir .
+This can be used to interactively select the files to copy from the
+current directory to
+.Pa dest_dir :
 .Pp
-The command:
-.Dl pax -r -pe -U root -G bin -f a.pax
-will extract all files from the archive
+.Dl $ pax -rw -i \&. dest_dir
+.Pp
+Extract all files from the archive
 .Pa a.pax
 which are owned by
 .Em root
 with group
 .Em bin
-and will preserve all file permissions.
+and preserve all file permissions:
+.Pp
+.Dl "$ pax -r -pe -U root -G bin -f a.pax"
 .Pp
-The command:
-.Dl pax -r -w -v -Y -Z home /backup
-will update (and list) only those files in the destination directory
+Update (and list) only those files in the destination directory
 .Pa /backup
 which are older (less recent inode change or file modification times) than
 files with the same name found in the source file tree
-.Pa home .
-.Sh STANDARDS
-The
-.Nm pax
-utility is a superset of the
-.St -p1003.2
-standard.
-The options
-.Fl B ,
-.Fl D ,
-.Fl E ,
-.Fl G ,
-.Fl H ,
-.Fl L ,
-.Fl P ,
-.Fl T ,
-.Fl U ,
-.Fl Y ,
-.Fl Z ,
-the archive formats
-.Ar bcpio ,
-.Ar sv4cpio ,
-.Ar sv4crc ,
-.Ar tar ,
-and the flawed archive handling during
-.Ar list
-and
-.Ar read
-operations are extensions to the
-.Tn POSIX
-standard.
-.Sh SEE ALSO
-.Xr cpio 1 ,
-.Xr tar 1
-.Sh AUTHOR
-Keith Muller at the University of California, San Diego.
-.Sh ERRORS
-.Nm pax
+.Pa home :
+.Pp
+.Dl "$ pax -r -w -v -Y -Z home /backup"
+.Sh DIAGNOSTICS
+.Nm
 will exit with one of the following values:
-.Bl -tag -width 2n
+.Bl -tag -width 2n -offset indent
 .It 0
 All files were processed successfully.
-.It 1 
+.It 1
 An error occurred.
 .El
 .Pp
 Whenever
-.Nm pax
+.Nm
 cannot create a file or a link when reading an archive or cannot
 find a file when writing an archive, or cannot preserve the user ID,
 group ID, or file mode when the
 .Fl p
-option is specified, a diagnostic message is written to
-.Dv standard error
+option is specified, a diagnostic message is written to standard error
 and a non-zero exit status will be returned, but processing will continue.
 In the case where
-.Nm pax
+.Nm
 cannot create a link to a file,
-.Nm pax
+.Nm
 will not create a second copy of the file.
 .Pp
 If the extraction of a file from an archive is prematurely terminated by
 a signal or error,
-.Nm pax
+.Nm
 may have only partially extracted a file the user wanted.
 Additionally, the file modes of extracted files and directories
 may have incorrect file bits, and the modification and access times may be
 wrong.
 .Pp
 If the creation of an archive is prematurely terminated by a signal or error,
-.Nm pax
-may have only partially created the archive which may violate the specific
+.Nm
+may have only partially created the archive, which may violate the specific
 archive format specification.
 .Pp
 If while doing a
 .Em copy ,
-.Nm pax
+.Nm
 detects a file is about to overwrite itself, the file is not copied,
-a diagnostic message is written to
-.Dv standard error
+a diagnostic message is written to standard error
 and when
-.Nm pax
+.Nm
 completes it will exit with a non-zero exit status.
+.Sh SEE ALSO
+.Xr cpio 1 ,
+.Xr tar 1
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2004
+specification.
+.Pp
+The flags
+.Op Fl 0BDEGHjLOPTUYZz ,
+the archive formats
+.Em bcpio ,
+.Em sv4cpio ,
+.Em sv4crc ,
+.Em tar ,
+and the flawed archive handling during
+.Em list
+and
+.Em read
+operations
+are extensions to that specification.
+.Sh AUTHORS
+Keith Muller at the University of California, San Diego.