Replace Minix tar with pax's tar
This commit is contained in:
parent
a4af231978
commit
4cb358d999
@ -1,21 +1,42 @@
|
|||||||
# Makefile for pax
|
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
CC = exec cc
|
# To install on versions prior to BSD 4.4 the following may have to be
|
||||||
CFLAGS = -O -D_POSIX_SOURCE -DNET2_STAT=1 -D_MINIX=1
|
# defined with CFLAGS +=
|
||||||
LDFLAGS= -i
|
#
|
||||||
|
# -DNET2_STAT Use NET2 or older stat structure. The version of the
|
||||||
|
# stat structure is easily determined by looking at the
|
||||||
|
# basic type of an off_t (often defined in the file:
|
||||||
|
# /usr/include/sys/types.h). If off_t is a long (and is
|
||||||
|
# NOT A quad) then you must define NET2_STAT.
|
||||||
|
# This define is important, as if you do have a quad_t
|
||||||
|
# off_t and define NET2_STAT, pax will compile but will
|
||||||
|
# NOT RUN PROPERLY.
|
||||||
|
#
|
||||||
|
# -DNET2_FTS Use the older NET2 fts. To identify the version,
|
||||||
|
# examine the file: /usr/include/fts.h. If FTS_COMFOLLOW
|
||||||
|
# is not defined then you must define NET2_FTS.
|
||||||
|
# Pax may not compile if this not (un)defined properly.
|
||||||
|
#
|
||||||
|
# -DNET2_REGEX Use the older regexp.h not regex.h. The regex version
|
||||||
|
# is determined by looking at the value returned by
|
||||||
|
# regexec() (man 3 regexec). If regexec return a 1 for
|
||||||
|
# success (and NOT a 0 for success) you have the older
|
||||||
|
# regex routines and must define NET2_REGEX.
|
||||||
|
# Pax may not compile if this not (un)defined properly.
|
||||||
|
|
||||||
all: pax
|
PROG= pax
|
||||||
|
SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \
|
||||||
|
gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c \
|
||||||
|
tables.c tar.c tty_subs.c fgetln.c
|
||||||
|
|
||||||
OBJ = ar_io.o ar_subs.o buf_subs.o cache.o cpio.o file_subs.o ftree.o \
|
MAN= pax.1 tar.1 cpio.1
|
||||||
gen_subs.o getoldopt.o options.o pat_rep.o pax.o sel_subs.o \
|
|
||||||
tables.o tar.o tty_subs.o fgetln.o
|
|
||||||
|
|
||||||
pax: $(OBJ)
|
BINDIR?=/usr/bin
|
||||||
$(CC) $(LDFLAGS) -o $@ $(OBJ)
|
LINKS+= ${BINDIR}/pax ${BINDIR}/tar
|
||||||
install -S 256k $@
|
LINKS+= ${BINDIR}/pax ${BINDIR}/cpio
|
||||||
|
|
||||||
install: pax
|
CFLAGS+= -O -D_POSIX_SOURCE -DNET2_STAT=1 -D_MINIX=1
|
||||||
install -cs -o bin pax /usr/bin/pax
|
LDFLAGS+= -i
|
||||||
|
|
||||||
clean:
|
.include <minix.prog.mk>
|
||||||
rm -f *.o *.bak core pax
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
make
|
|
304
commands/pax/cpio.1
Normal file
304
commands/pax/cpio.1
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
.\"-
|
||||||
|
.\" Copyright (c) 1997 SigmaSoft, Th. Lockert
|
||||||
|
.\" All rights reserved.
|
||||||
|
.\"
|
||||||
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
|
.\" modification, are permitted provided that the following conditions
|
||||||
|
.\" are met:
|
||||||
|
.\" 1. Redistributions of source code must retain the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer.
|
||||||
|
.\" 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 SigmaSoft, Th. Lockert.
|
||||||
|
.\" 4. The name of the author may not be used to endorse or promote products
|
||||||
|
.\" derived from this software without specific prior written permission
|
||||||
|
.\"
|
||||||
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
.\"
|
||||||
|
.\" $OpenBSD: cpio.1,v 1.16 2001/05/01 17:58:01 aaron Exp $
|
||||||
|
.\" $FreeBSD$
|
||||||
|
.\"
|
||||||
|
.Dd February 16, 1997
|
||||||
|
.Dt CPIO 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm cpio
|
||||||
|
.Nd copy file archives in and out
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Fl o
|
||||||
|
.Op Fl aABcLvzZ
|
||||||
|
.Op Fl C Ar bytes
|
||||||
|
.Op Fl F Ar archive
|
||||||
|
.Op Fl H Ar format
|
||||||
|
.Op Fl O Ar archive
|
||||||
|
.No < Ar name-list
|
||||||
|
.Op No > Ar archive
|
||||||
|
.Nm
|
||||||
|
.Fl i
|
||||||
|
.Op Fl bBcdfmrsStuvzZ6
|
||||||
|
.Op Fl C Ar bytes
|
||||||
|
.Op Fl E Ar file
|
||||||
|
.Op Fl F Ar archive
|
||||||
|
.Op Fl H Ar format
|
||||||
|
.Op Fl I Ar archive
|
||||||
|
.Op Ar pattern ...
|
||||||
|
.Op No < Ar archive
|
||||||
|
.Nm
|
||||||
|
.Fl p
|
||||||
|
.Op Fl adlLmuv
|
||||||
|
.Ar destination-directory
|
||||||
|
.No < Ar name-list
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
command copies files to and from a
|
||||||
|
.Nm
|
||||||
|
archive.
|
||||||
|
.Pp
|
||||||
|
The options are as follows:
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Fl o
|
||||||
|
Create an archive.
|
||||||
|
Reads the list of files to store in the
|
||||||
|
archive from standard input, and writes the archive on standard
|
||||||
|
output.
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Fl a
|
||||||
|
Reset the access times on files that have been copied to the
|
||||||
|
archive.
|
||||||
|
.It Fl A
|
||||||
|
Append to the specified archive.
|
||||||
|
.It Fl B
|
||||||
|
Set block size of output to 5120 bytes.
|
||||||
|
.It Fl c
|
||||||
|
Use
|
||||||
|
.Tn ASCII
|
||||||
|
format for
|
||||||
|
.Nm
|
||||||
|
header for portability.
|
||||||
|
.It Fl C Ar bytes
|
||||||
|
Set the block size of output to
|
||||||
|
.Ar bytes .
|
||||||
|
.It Fl F Ar archive
|
||||||
|
.It Fl O Ar archive
|
||||||
|
Use the specified file name as the archive to write to.
|
||||||
|
.It Fl H Ar format
|
||||||
|
Write the archive in the specified format.
|
||||||
|
Recognized formats are:
|
||||||
|
.Pp
|
||||||
|
.Bl -tag -width sv4cpio -compact
|
||||||
|
.It Cm bcpio
|
||||||
|
Old binary
|
||||||
|
.Nm
|
||||||
|
format.
|
||||||
|
.It Cm cpio
|
||||||
|
Old octal character
|
||||||
|
.Nm
|
||||||
|
format.
|
||||||
|
.It Cm sv4cpio
|
||||||
|
.Tn SVR4
|
||||||
|
hex
|
||||||
|
.Nm
|
||||||
|
format.
|
||||||
|
.It Cm tar
|
||||||
|
Old tar format.
|
||||||
|
.It Cm ustar
|
||||||
|
.Tn POSIX
|
||||||
|
ustar format.
|
||||||
|
.El
|
||||||
|
.It Fl L
|
||||||
|
Follow symbolic links.
|
||||||
|
.It Fl v
|
||||||
|
Be verbose about operations.
|
||||||
|
List filenames as they are written to the archive.
|
||||||
|
.It Fl z
|
||||||
|
Compress archive using
|
||||||
|
.Xr gzip 1
|
||||||
|
format.
|
||||||
|
.It Fl Z
|
||||||
|
Compress archive using
|
||||||
|
.Xr compress 1
|
||||||
|
format.
|
||||||
|
.El
|
||||||
|
.It Fl i
|
||||||
|
Restore files from an archive.
|
||||||
|
Reads the archive file from
|
||||||
|
standard input and extracts files matching the
|
||||||
|
.Ar patterns
|
||||||
|
that were specified on the command line.
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Fl b
|
||||||
|
Do byte and word swapping after reading in data from the
|
||||||
|
archive, for restoring archives created on systems with
|
||||||
|
a different byte order.
|
||||||
|
.It Fl B
|
||||||
|
Set the block size of the archive being read to 5120 bytes.
|
||||||
|
.It Fl c
|
||||||
|
Expect the archive headers to be in
|
||||||
|
.Tn ASCII
|
||||||
|
format.
|
||||||
|
.It Fl C Ar bytes
|
||||||
|
Read archive written with a block size of
|
||||||
|
.Ar bytes .
|
||||||
|
.It Fl d
|
||||||
|
Create any intermediate directories as needed during
|
||||||
|
restore.
|
||||||
|
.It Fl E Ar file
|
||||||
|
Read list of file name patterns to extract or list from
|
||||||
|
.Ar file .
|
||||||
|
.It Fl f
|
||||||
|
Restore all files except those matching the
|
||||||
|
.Ar patterns
|
||||||
|
given on the command line.
|
||||||
|
.It Fl F Ar archive , Fl I Ar archive
|
||||||
|
Use the specified file as the input for the archive.
|
||||||
|
.It Fl H Ar format
|
||||||
|
Read an archive of the specified format.
|
||||||
|
Recognized formats are:
|
||||||
|
.Pp
|
||||||
|
.Bl -tag -width sv4cpio -compact
|
||||||
|
.It Cm bcpio
|
||||||
|
Old binary
|
||||||
|
.Nm
|
||||||
|
format.
|
||||||
|
.It Cm cpio
|
||||||
|
Old octal character
|
||||||
|
.Nm
|
||||||
|
format.
|
||||||
|
.It Cm sv4cpio
|
||||||
|
.Tn SVR4
|
||||||
|
hex
|
||||||
|
.Nm
|
||||||
|
format.
|
||||||
|
.It Cm tar
|
||||||
|
Old tar format.
|
||||||
|
.It Cm ustar
|
||||||
|
.Tn POSIX
|
||||||
|
ustar format.
|
||||||
|
.El
|
||||||
|
.It Fl m
|
||||||
|
Restore modification times on files.
|
||||||
|
.It Fl r
|
||||||
|
Rename restored files interactively.
|
||||||
|
.It Fl s
|
||||||
|
Swap bytes after reading data from the archive.
|
||||||
|
.It Fl S
|
||||||
|
Swap words after reading data from the archive.
|
||||||
|
.It Fl t
|
||||||
|
Only list the contents of the archive, no files or
|
||||||
|
directories will be created.
|
||||||
|
.It Fl u
|
||||||
|
Overwrite files even when the file in the archive is
|
||||||
|
older than the one that will be overwritten.
|
||||||
|
.It Fl v
|
||||||
|
Be verbose about operations.
|
||||||
|
List filenames as they are copied in from the archive.
|
||||||
|
.It Fl z
|
||||||
|
Uncompress archive using
|
||||||
|
.Xr gzip 1
|
||||||
|
format.
|
||||||
|
.It Fl Z
|
||||||
|
Uncompress archive using
|
||||||
|
.Xr compress 1
|
||||||
|
format.
|
||||||
|
.It Fl 6
|
||||||
|
Process old-style
|
||||||
|
.Nm
|
||||||
|
format archives.
|
||||||
|
.El
|
||||||
|
.It Fl p
|
||||||
|
Copy files from one location to another in a single pass.
|
||||||
|
The list of files to copy are read from standard input and
|
||||||
|
written out to a directory relative to the specified
|
||||||
|
.Ar directory
|
||||||
|
argument.
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Fl a
|
||||||
|
Reset the access times on files that have been copied.
|
||||||
|
.It Fl d
|
||||||
|
Create any intermediate directories as needed to write
|
||||||
|
the files at the new location.
|
||||||
|
.It Fl l
|
||||||
|
When possible, link files rather than creating an
|
||||||
|
extra copy.
|
||||||
|
.It Fl L
|
||||||
|
Follow symbolic links.
|
||||||
|
.It Fl m
|
||||||
|
Restore modification times on files.
|
||||||
|
.It Fl u
|
||||||
|
Overwrite files even when the original file being copied is
|
||||||
|
older than the one that will be overwritten.
|
||||||
|
.It Fl v
|
||||||
|
Be verbose about operations.
|
||||||
|
List filenames as they are copied.
|
||||||
|
.El
|
||||||
|
.El
|
||||||
|
.Sh ENVIRONMENT
|
||||||
|
.Bl -tag -width TMPDIR
|
||||||
|
.It Ev TMPDIR
|
||||||
|
Path in which to store temporary files.
|
||||||
|
.El
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
utility will exit with one of the following values:
|
||||||
|
.Bl -tag -width 2n
|
||||||
|
.It 0
|
||||||
|
All files were processed successfully.
|
||||||
|
.It 1
|
||||||
|
An error occurred.
|
||||||
|
.El
|
||||||
|
.Pp
|
||||||
|
Whenever
|
||||||
|
.Nm
|
||||||
|
cannot create a file or a link when extracting an archive or cannot
|
||||||
|
find a file while writing an archive, or cannot preserve the user
|
||||||
|
ID, group ID, file mode, or access and modification times when the
|
||||||
|
.Fl p
|
||||||
|
option is specified, a diagnostic message is written to standard
|
||||||
|
error and a non-zero exit value will be returned, but processing
|
||||||
|
will continue.
|
||||||
|
In the case where
|
||||||
|
.Nm
|
||||||
|
cannot create a link to a file,
|
||||||
|
.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
|
||||||
|
may have only partially extracted the 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
|
||||||
|
may have only partially created the archive which may violate the
|
||||||
|
specific archive format specification.
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr pax 1 ,
|
||||||
|
.Xr tar 1
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Keith Muller
|
||||||
|
at the University of California, San Diego.
|
||||||
|
.Sh BUGS
|
||||||
|
The
|
||||||
|
.Fl s
|
||||||
|
and
|
||||||
|
.Fl S
|
||||||
|
options are currently not implemented.
|
@ -579,6 +579,13 @@ pax_options(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tar_set_action(int op)
|
||||||
|
{
|
||||||
|
if (act != ERROR && act != op)
|
||||||
|
tar_usage();
|
||||||
|
act = op;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* tar_options()
|
* tar_options()
|
||||||
@ -625,7 +632,7 @@ tar_options(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* create an archive
|
* create an archive
|
||||||
*/
|
*/
|
||||||
act = ARCHIVE;
|
tar_set_action(ARCHIVE);
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
/*
|
/*
|
||||||
@ -691,7 +698,7 @@ tar_options(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* append to the archive
|
* append to the archive
|
||||||
*/
|
*/
|
||||||
act = APPND;
|
tar_set_action(APPND);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
/*
|
/*
|
||||||
@ -706,7 +713,7 @@ tar_options(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* list contents of the tape
|
* list contents of the tape
|
||||||
*/
|
*/
|
||||||
act = LIST;
|
tar_set_action(LIST);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
/*
|
/*
|
||||||
@ -725,7 +732,7 @@ tar_options(int argc, char **argv)
|
|||||||
* extract an archive, preserving mode,
|
* extract an archive, preserving mode,
|
||||||
* and mtime if possible.
|
* and mtime if possible.
|
||||||
*/
|
*/
|
||||||
act = EXTRACT;
|
tar_set_action(EXTRACT);
|
||||||
pmtime = 1;
|
pmtime = 1;
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
@ -812,6 +819,10 @@ tar_options(int argc, char **argv)
|
|||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
|
/* Tar requires an action. */
|
||||||
|
if (act == ERROR)
|
||||||
|
tar_usage();
|
||||||
|
|
||||||
/* Traditional tar behaviour (pax uses stderr unless in list mode) */
|
/* Traditional tar behaviour (pax uses stderr unless in list mode) */
|
||||||
if (fstdin == 1 && act == ARCHIVE)
|
if (fstdin == 1 && act == ARCHIVE)
|
||||||
listf = stderr;
|
listf = stderr;
|
||||||
|
1193
commands/pax/pax.1
Normal file
1193
commands/pax/pax.1
Normal file
File diff suppressed because it is too large
Load Diff
@ -67,7 +67,7 @@ static int gen_init(void);
|
|||||||
/*
|
/*
|
||||||
* Variables that can be accessed by any routine within pax
|
* Variables that can be accessed by any routine within pax
|
||||||
*/
|
*/
|
||||||
int act = DEFOP; /* read/write/append/copy */
|
int act = ERROR; /* read/write/append/copy */
|
||||||
FSUB *frmt = NULL; /* archive format type */
|
FSUB *frmt = NULL; /* archive format type */
|
||||||
int cflag; /* match all EXCEPT pattern/file */
|
int cflag; /* match all EXCEPT pattern/file */
|
||||||
int cwdfd; /* starting cwd */
|
int cwdfd; /* starting cwd */
|
||||||
|
@ -56,12 +56,12 @@
|
|||||||
/*
|
/*
|
||||||
* Pax modes of operation
|
* Pax modes of operation
|
||||||
*/
|
*/
|
||||||
|
#define ERROR -1 /* nothing selected */
|
||||||
#define LIST 0 /* List the file in an archive */
|
#define LIST 0 /* List the file in an archive */
|
||||||
#define EXTRACT 1 /* extract the files in an archive */
|
#define EXTRACT 1 /* extract the files in an archive */
|
||||||
#define ARCHIVE 2 /* write a new archive */
|
#define ARCHIVE 2 /* write a new archive */
|
||||||
#define APPND 3 /* append to the end of an archive */
|
#define APPND 3 /* append to the end of an archive */
|
||||||
#define COPY 4 /* copy files to destination dir */
|
#define COPY 4 /* copy files to destination dir */
|
||||||
#define DEFOP LIST /* if no flags default is to LIST */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device type of the current archive volume
|
* Device type of the current archive volume
|
||||||
|
310
commands/pax/tar.1
Normal file
310
commands/pax/tar.1
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
.\"-
|
||||||
|
.\" Copyright (c) 1996 SigmaSoft, Th. Lockert
|
||||||
|
.\" All rights reserved.
|
||||||
|
.\"
|
||||||
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
|
.\" modification, are permitted provided that the following conditions
|
||||||
|
.\" are met:
|
||||||
|
.\" 1. Redistributions of source code must retain the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer.
|
||||||
|
.\" 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 SigmaSoft, Th. Lockert.
|
||||||
|
.\" 4. The name of the author may not be used to endorse or promote products
|
||||||
|
.\" derived from this software without specific prior written permission
|
||||||
|
.\"
|
||||||
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
.\"
|
||||||
|
.\" $OpenBSD: tar.1,v 1.33 2001/05/01 17:58:01 aaron Exp $
|
||||||
|
.\" $FreeBSD$
|
||||||
|
.\"
|
||||||
|
.Dd February 7, 2001
|
||||||
|
.Dt TAR 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm tar
|
||||||
|
.Nd tape archiver
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sm off
|
||||||
|
.Op Fl
|
||||||
|
.Brq Cm crtux
|
||||||
|
.Op Cm befhjmopqsvwyzHLOPXZ014578
|
||||||
|
.Sm on
|
||||||
|
.Op Ar blocksize
|
||||||
|
.Op Ar archive
|
||||||
|
.Op Ar replstr
|
||||||
|
.\" XXX how to do this right?
|
||||||
|
.Op Fl C Ar directory
|
||||||
|
.Op Fl I Ar file
|
||||||
|
.Op Ar
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
command creates, adds files to, or extracts files from an
|
||||||
|
archive file in
|
||||||
|
.Nm
|
||||||
|
format.
|
||||||
|
A
|
||||||
|
.Nm
|
||||||
|
archive is often stored on a magnetic tape, but can be
|
||||||
|
stored equally well on a floppy, CD-ROM, or in a regular disk file.
|
||||||
|
.Pp
|
||||||
|
One of the following flags must be present:
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Fl c
|
||||||
|
Create new archive, or overwrite an existing archive,
|
||||||
|
adding the specified files to it.
|
||||||
|
.It Fl r
|
||||||
|
Append the named new files to existing archive.
|
||||||
|
Note that this will only work on media on which an end-of-file mark
|
||||||
|
can be overwritten.
|
||||||
|
.It Fl t
|
||||||
|
List contents of archive.
|
||||||
|
If any files are named on the
|
||||||
|
command line, only those files will be listed.
|
||||||
|
.It Fl u
|
||||||
|
Alias for
|
||||||
|
.Fl r .
|
||||||
|
.It Fl x
|
||||||
|
Extract files from archive.
|
||||||
|
If any files are named on the
|
||||||
|
command line, only those files will be extracted from the
|
||||||
|
archive.
|
||||||
|
If more than one copy of a file exists in the
|
||||||
|
archive, later copies will overwrite earlier copies during
|
||||||
|
extraction.
|
||||||
|
The file mode and modification time are preserved
|
||||||
|
if possible.
|
||||||
|
The file mode is subject to modification by the
|
||||||
|
.Xr umask 2 .
|
||||||
|
.El
|
||||||
|
.Pp
|
||||||
|
In addition to the flags mentioned above, any of the following
|
||||||
|
flags may be used:
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Fl b Ar "blocking factor"
|
||||||
|
Set blocking factor to use for the archive, with 512 byte blocks.
|
||||||
|
The default is 20, the maximum is 126.
|
||||||
|
Archives with a blocking factor larger 63 violate the
|
||||||
|
.Tn POSIX
|
||||||
|
standard and will not be portable to all systems.
|
||||||
|
.It Fl e
|
||||||
|
Stop after first error.
|
||||||
|
.It Fl f Ar archive
|
||||||
|
Filename where the archive is stored.
|
||||||
|
Defaults to
|
||||||
|
.Pa /dev/sa0 .
|
||||||
|
.It Fl h
|
||||||
|
Follow symbolic links as if they were normal files
|
||||||
|
or directories.
|
||||||
|
.It Fl j
|
||||||
|
Compress archives using
|
||||||
|
.Xr bzip2 1 .
|
||||||
|
.It Fl m
|
||||||
|
Do not preserve modification time.
|
||||||
|
.It Fl O
|
||||||
|
Write old-style
|
||||||
|
.Pq non- Ns Tn POSIX
|
||||||
|
archives.
|
||||||
|
.It Fl o
|
||||||
|
Do not write directory information that the older (V7) style
|
||||||
|
.Nm
|
||||||
|
is unable to decode.
|
||||||
|
This implies the
|
||||||
|
.Fl O
|
||||||
|
flag.
|
||||||
|
.It Fl p
|
||||||
|
Preserve user and group ID as well as file mode regardless of
|
||||||
|
the current
|
||||||
|
.Xr umask 2 .
|
||||||
|
The setuid and setgid bits are only preserved if the user is
|
||||||
|
the superuser.
|
||||||
|
Only meaningful in conjunction with the
|
||||||
|
.Fl x
|
||||||
|
flag.
|
||||||
|
.It Fl q
|
||||||
|
Select the first archive member that matches each
|
||||||
|
.Ar pattern
|
||||||
|
operand.
|
||||||
|
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.
|
||||||
|
.It Fl s Ar replstr
|
||||||
|
Modify the file or archive member names specified by the
|
||||||
|
.Ar pattern
|
||||||
|
or
|
||||||
|
.Ar file
|
||||||
|
operands 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:
|
||||||
|
.Dl /old/new/[gp]
|
||||||
|
As in
|
||||||
|
.Xr ed 1 ,
|
||||||
|
.Cm old
|
||||||
|
is a basic regular expression and
|
||||||
|
.Cm new
|
||||||
|
can contain an ampersand
|
||||||
|
.Pq Ql & ,
|
||||||
|
.Li \e Ns Ar n
|
||||||
|
(where
|
||||||
|
.Ar n
|
||||||
|
is a digit) back-references,
|
||||||
|
or subexpression matching.
|
||||||
|
The
|
||||||
|
.Cm old
|
||||||
|
string may also contain newline characters.
|
||||||
|
Any non-null character can be used as a delimiter
|
||||||
|
.Ql ( /
|
||||||
|
is shown here).
|
||||||
|
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.
|
||||||
|
The optional trailing
|
||||||
|
.Cm g
|
||||||
|
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
|
||||||
|
.Cm g
|
||||||
|
option.
|
||||||
|
The optional trailing
|
||||||
|
.Cm p
|
||||||
|
will cause the final result of a successful substitution to be written to
|
||||||
|
standard error
|
||||||
|
in the following format:
|
||||||
|
.Pp
|
||||||
|
.Dl <original pathname> >> <new pathname>
|
||||||
|
.Pp
|
||||||
|
File or archive member names that substitute to the empty string
|
||||||
|
are not selected and will be skipped.
|
||||||
|
.It Fl v
|
||||||
|
Verbose operation mode.
|
||||||
|
.It Fl w
|
||||||
|
Interactively rename files.
|
||||||
|
This option causes
|
||||||
|
.Nm
|
||||||
|
to prompt the user for the filename to use when storing or
|
||||||
|
extracting files in an archive.
|
||||||
|
.It Fl y
|
||||||
|
Compress archives using
|
||||||
|
.Xr bzip2 1 .
|
||||||
|
.It Fl z
|
||||||
|
Compress archive using
|
||||||
|
.Xr gzip 1 .
|
||||||
|
.It Fl C Ar directory
|
||||||
|
This is a positional argument which sets the working directory for the
|
||||||
|
following files.
|
||||||
|
When extracting, files will be extracted into
|
||||||
|
the specified directory; when creating, the specified files will be matched
|
||||||
|
from the directory.
|
||||||
|
.It Fl H
|
||||||
|
Follow symlinks given on command line only.
|
||||||
|
.It Fl L
|
||||||
|
Follow all symlinks.
|
||||||
|
.It Fl P
|
||||||
|
Do not strip leading slashes
|
||||||
|
.Pq Ql /
|
||||||
|
from pathnames.
|
||||||
|
The default is to strip leading slashes.
|
||||||
|
.It Fl I Ar file
|
||||||
|
This is a positional argument which reads the names of files to
|
||||||
|
archive or extract from the given file, one per line.
|
||||||
|
.It Fl X
|
||||||
|
Do not cross mount points in the file system.
|
||||||
|
.It Fl Z
|
||||||
|
Compress archive using
|
||||||
|
.Xr compress 1 .
|
||||||
|
.El
|
||||||
|
.Pp
|
||||||
|
The options
|
||||||
|
.Op Fl 014578
|
||||||
|
can be used to select one of the compiled-in backup devices,
|
||||||
|
.Pa /dev/rst Ns Ar N .
|
||||||
|
.Sh ENVIRONMENT
|
||||||
|
.Bl -tag -width TMPDIR
|
||||||
|
.It Ev TMPDIR
|
||||||
|
Path in which to store temporary files.
|
||||||
|
.It Ev TAPE
|
||||||
|
Default tape device to use instead of
|
||||||
|
.Pa /dev/sa0 .
|
||||||
|
.El
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -tag -width "/dev/sa0"
|
||||||
|
.It Pa /dev/sa0
|
||||||
|
default archive name
|
||||||
|
.El
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
utility will exit with one of the following values:
|
||||||
|
.Bl -tag -width 2n
|
||||||
|
.It 0
|
||||||
|
All files were processed successfully.
|
||||||
|
.It 1
|
||||||
|
An error occurred.
|
||||||
|
.El
|
||||||
|
.Pp
|
||||||
|
Whenever
|
||||||
|
.Nm
|
||||||
|
cannot create a file or a link when extracting an archive or cannot
|
||||||
|
find a file while writing an archive, or cannot preserve the user
|
||||||
|
ID, group ID, file mode, or access and modification times when the
|
||||||
|
.Fl p
|
||||||
|
option is specified, a diagnostic message is written to standard
|
||||||
|
error and a non-zero exit value will be returned, but processing
|
||||||
|
will continue.
|
||||||
|
In the case where
|
||||||
|
.Nm
|
||||||
|
cannot create a link to a file,
|
||||||
|
.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
|
||||||
|
may have only partially extracted the 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
|
||||||
|
may have only partially created the archive which may violate the
|
||||||
|
specific archive format specification.
|
||||||
|
.Sh COMPATIBILITY
|
||||||
|
The
|
||||||
|
.Fl L
|
||||||
|
flag is not portable to other versions of
|
||||||
|
.Nm
|
||||||
|
where it may have a different meaning.
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr cpio 1 ,
|
||||||
|
.Xr pax 1
|
||||||
|
.Sh HISTORY
|
||||||
|
A
|
||||||
|
.Nm
|
||||||
|
command first appeared in
|
||||||
|
.At v7 .
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Keith Muller
|
||||||
|
at the University of California, San Diego.
|
@ -180,7 +180,6 @@ ALL = \
|
|||||||
synctree \
|
synctree \
|
||||||
sysenv \
|
sysenv \
|
||||||
tail \
|
tail \
|
||||||
tar \
|
|
||||||
tcpd \
|
tcpd \
|
||||||
tcpdp \
|
tcpdp \
|
||||||
tcpstat \
|
tcpstat \
|
||||||
@ -775,10 +774,6 @@ tail: tail.c
|
|||||||
$(CCLD) -o $@ $<
|
$(CCLD) -o $@ $<
|
||||||
@install -S 16kw $@
|
@install -S 16kw $@
|
||||||
|
|
||||||
tar: tar.c
|
|
||||||
$(CCLD) -o $@ $<
|
|
||||||
@install -S 256kw $@
|
|
||||||
|
|
||||||
tcpd: tcpd.c
|
tcpd: tcpd.c
|
||||||
$(CCLD) -o $@ -DPARANOID=0 tcpd.c
|
$(CCLD) -o $@ -DPARANOID=0 tcpd.c
|
||||||
@install -S 8kw $@
|
@install -S 8kw $@
|
||||||
@ -1075,7 +1070,6 @@ install: \
|
|||||||
/usr/bin/sysenv \
|
/usr/bin/sysenv \
|
||||||
/bin/sysenv \
|
/bin/sysenv \
|
||||||
/usr/bin/tail \
|
/usr/bin/tail \
|
||||||
/usr/bin/tar \
|
|
||||||
/usr/bin/tcpd \
|
/usr/bin/tcpd \
|
||||||
/usr/bin/tcpdp \
|
/usr/bin/tcpdp \
|
||||||
/usr/bin/tcpstat \
|
/usr/bin/tcpstat \
|
||||||
@ -1603,9 +1597,6 @@ install: \
|
|||||||
/usr/bin/tail: tail
|
/usr/bin/tail: tail
|
||||||
install -cs -o bin $> $@
|
install -cs -o bin $> $@
|
||||||
|
|
||||||
/usr/bin/tar: tar
|
|
||||||
install -cs -o bin $> $@
|
|
||||||
|
|
||||||
/usr/bin/tcpd: tcpd
|
/usr/bin/tcpd: tcpd
|
||||||
install -cs -o bin $> $@
|
install -cs -o bin $> $@
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user