2 * Copyright (c) 1992 Keith Muller.
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
7 * Keith Muller of the University of California, San Diego.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #define _POSIX_SOURCE 1
39 static char sccsid
[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
44 #include <sys/types.h>
55 #include <sys/types.h>
68 * Routines which handle command line options
72 #define getline pax_getline
75 static char flgch
[] = FLGCH
; /* list of all possible flags */
76 static OPLIST
*ophead
= NULL
; /* head for format specific options -x */
77 static OPLIST
*optail
= NULL
; /* option tail */
79 static int no_op(void);
80 static void printflg(unsigned int);
81 static int c_frmt(const void *, const void *);
82 static off_t
str_offt(char *);
83 static char *getline(FILE *fp
);
84 static void pax_options(int, char **);
85 static void pax_usage(void);
86 static void tar_options(int, char **);
87 static void tar_usage(void);
88 static void cpio_options(int, char **);
89 static void cpio_usage(void);
91 /* errors from getline */
92 #define GETLINE_FILE_CORRUPT 1
93 #define GETLINE_OUT_OF_MEM 2
94 static int getline_error
;
97 #define GZIP_CMD "gzip" /* command to run as gzip */
98 #define COMPRESS_CMD "compress" /* command to run as compress */
99 #define BZIP2_CMD "bzip2" /* command to run as gzip */
102 * Format specific routine table - MUST BE IN SORTED ORDER BY NAME
103 * (see pax.h for description of each function)
105 * name, blksz, hdsz, udev, hlk, blkagn, inhead, id, st_read,
106 * read, end_read, st_write, write, end_write, trail,
107 * rd_data, wr_data, options
111 /* 0: OLD BINARY CPIO */
112 {"bcpio", 5120, sizeof(HD_BCPIO
), 1, 0, 0, 1, bcpio_id
, cpio_strd
,
113 bcpio_rd
, bcpio_endrd
, cpio_stwr
, bcpio_wr
, cpio_endwr
, cpio_trail
,
114 NULL
, rd_wrfile
, wr_rdfile
, bad_opt
},
116 /* 1: OLD OCTAL CHARACTER CPIO */
117 {"cpio", 5120, sizeof(HD_CPIO
), 1, 0, 0, 1, cpio_id
, cpio_strd
,
118 cpio_rd
, cpio_endrd
, cpio_stwr
, cpio_wr
, cpio_endwr
, cpio_trail
,
119 NULL
, rd_wrfile
, wr_rdfile
, bad_opt
},
121 /* 2: SVR4 HEX CPIO */
122 {"sv4cpio", 5120, sizeof(HD_VCPIO
), 1, 0, 0, 1, vcpio_id
, cpio_strd
,
123 vcpio_rd
, vcpio_endrd
, cpio_stwr
, vcpio_wr
, cpio_endwr
, cpio_trail
,
124 NULL
, rd_wrfile
, wr_rdfile
, bad_opt
},
126 /* 3: SVR4 HEX CPIO WITH CRC */
127 {"sv4crc", 5120, sizeof(HD_VCPIO
), 1, 0, 0, 1, crc_id
, crc_strd
,
128 vcpio_rd
, vcpio_endrd
, crc_stwr
, vcpio_wr
, cpio_endwr
, cpio_trail
,
129 NULL
, rd_wrfile
, wr_rdfile
, bad_opt
},
132 {"tar", 10240, BLKMULT
, 0, 1, BLKMULT
, 0, tar_id
, no_op
,
133 tar_rd
, tar_endrd
, no_op
, tar_wr
, tar_endwr
, NULL
, tar_trail
,
134 rd_wrfile
, wr_rdfile
, tar_opt
},
137 {"ustar", 10240, BLKMULT
, 0, 1, BLKMULT
, 0, ustar_id
, ustar_strd
,
138 ustar_rd
, tar_endrd
, ustar_stwr
, ustar_wr
, tar_endwr
, NULL
, tar_trail
,
139 rd_wrfile
, wr_rdfile
, bad_opt
},
141 #define F_OCPIO 0 /* format when called as cpio -6 */
142 #define F_ACPIO 1 /* format when called as cpio -c */
143 #define F_CPIO 3 /* format when called as cpio */
144 #define F_OTAR 4 /* format when called as tar -o */
145 #define F_TAR 5 /* format when called as tar */
146 #define DEFLT 5 /* default write format from list above */
149 * ford is the archive search order used by get_arc() to determine what kind
150 * of archive we are dealing with. This helps to properly id archive formats
151 * some formats may be subsets of others....
153 int ford
[] = {5, 4, 3, 2, 1, 0, -1 };
157 * figure out if we are pax, tar or cpio. Call the appropriate options
162 options(int argc
, char **argv
)
166 * Are we acting like pax, tar or cpio (based on argv[0])
168 if ((argv0
= strrchr(argv
[0], '/')) != NULL
)
173 if (strcmp(NM_TAR
, argv0
) == 0) {
174 tar_options(argc
, argv
);
177 else if (strcmp(NM_CPIO
, argv0
) == 0) {
178 cpio_options(argc
, argv
);
182 * assume pax as the default
185 pax_options(argc
, argv
);
191 * look at the user specified flags. set globals as required and check if
192 * the user specified a legal set of flags. If not, complain and exit
196 pax_options(int argc
, char **argv
)
200 unsigned int flg
= 0;
201 unsigned int bflg
= 0;
206 * process option flags
208 while ((c
=getopt(argc
,argv
,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ"))
222 if ((wrblksz
= (int)str_offt(optarg
)) <= 0) {
223 paxwarn(1, "Invalid block size %s", optarg
);
229 * inverse match on patterns
236 * match only dir on extract, not the subtree at dir
243 * filename where the archive is stored
250 * interactive file rename
257 * do not clobber files that exist
264 * try to link src to dest with copy (-rw)
271 * select first match for a pattern only
278 * pass format specific options
281 if (opt_add(optarg
) < 0)
286 * specify file characteristic options
288 for (pt
= optarg
; *pt
!= '\0'; ++pt
) {
292 * do not preserve access time
298 * preserve user id, group id, file
299 * mode, access/modification times
308 * do not preserve modification time
320 * preserver file mode bits
325 paxwarn(1, "Invalid -p string: %c", *pt
);
340 * file name substitution name pattern
342 if (rep_add(optarg
) < 0) {
350 * preserve access time on file system nodes we read
357 * ignore those older files
364 * verbose operation mode
377 * specify an archive format on write
380 if ((frmt
= (FSUB
*)bsearch((void *)&tmp
, (void *)fsub
,
381 sizeof(fsub
)/sizeof(FSUB
), sizeof(FSUB
), c_frmt
)) != NULL
) {
385 paxwarn(1, "Unknown -x format: %s", optarg
);
386 (void)fputs("pax: Known -x formats are:", stderr
);
387 for (i
= 0; i
< (sizeof(fsub
)/sizeof(FSUB
)); ++i
)
388 (void)fprintf(stderr
, " %s", fsub
[i
].name
);
389 (void)fputs("\n\n", stderr
);
394 * use gzip. Non standard option.
396 gzip_program
= GZIP_CMD
;
400 * non-standard option on number of bytes written on a
401 * single archive volume.
403 if ((wrlimit
= str_offt(optarg
)) <= 0) {
404 paxwarn(1, "Invalid write limit %s", optarg
);
407 if (wrlimit
% BLKMULT
) {
408 paxwarn(1, "Write limit is not a %d byte multiple",
416 * On extraction check file inode change time before the
417 * modification of the file name. Non standard option.
424 * non-standard limit on read faults
425 * 0 indicates stop after first error, values
426 * indicate a limit, "NONE" try forever
429 if (strcmp(NONE
, optarg
) == 0)
431 else if ((maxflt
= atoi(optarg
)) < 0) {
432 paxwarn(1, "Error count value must be positive");
438 * non-standard option for selecting files within an
439 * archive by group (gid or name)
441 if (grp_add(optarg
) < 0) {
449 * follow command line symlinks only
463 * do NOT follow symlinks (default)
470 * non-standard option for selecting files within an
471 * archive by modification time range (lower,upper)
473 if (trng_add(optarg
) < 0) {
481 * non-standard option for selecting files within an
482 * archive by user (uid or name)
484 if (usr_add(optarg
) < 0) {
492 * do not pass over mount points in the file system
499 * On extraction check file inode change time after the
500 * modification of the file name. Non standard option.
507 * On extraction check modification time after the
508 * modification of the file name. Non standard option.
520 * figure out the operation mode of pax read,write,extract,copy,append
521 * or list. check that we have not been given a bogus set of flags
522 * for the operation mode.
528 } else if (ISEXTRACT(flg
)) {
531 } else if (ISARCHIVE(flg
)) {
534 } else if (ISAPPND(flg
)) {
537 } else if (ISCOPY(flg
)) {
548 * if we are writing (ARCHIVE) we use the default format if the user
549 * did not specify a format. when we write during an APPEND, we will
550 * adopt the format of the existing archive if none was supplied.
552 if (!(flg
& XF
) && (act
== ARCHIVE
))
553 frmt
= &(fsub
[DEFLT
]);
556 * process the args as they are interpreted by the operation mode
561 for (; optind
< argc
; optind
++)
562 if (pat_add(argv
[optind
], NULL
) < 0)
566 if (optind
>= argc
) {
567 paxwarn(0, "Destination directory was not supplied");
575 for (; optind
< argc
; optind
++)
576 if (ftree_add(argv
[optind
], 0) < 0)
579 * no read errors allowed on updates/append operation!
587 tar_set_action(int op
)
589 if (act
!= ERROR
&& act
!= op
)
596 * look at the user specified flags. set globals as required and check if
597 * the user specified a legal set of flags. If not, complain and exit
601 tar_options(int argc
, char **argv
)
607 int incfiles_max
= 0;
612 struct incfile
*incfiles
= NULL
;
615 * Set default values.
620 * process option flags
622 while ((c
= getoldopt(argc
, argv
,
623 "b:cef:hjmopqruts:vwxyzBC:HI:LOPXZ014578")) != -1) {
627 * specify blocksize in 512-byte blocks
629 if ((wrblksz
= (int)str_offt(optarg
)) <= 0) {
630 paxwarn(1, "Invalid block size %s", optarg
);
633 wrblksz
*= 512; /* XXX - check for int oflow */
639 tar_set_action(ARCHIVE
);
643 * stop after first error
649 * filename where the archive is stored
651 if ((optarg
[0] == '-') && (optarg
[1]== '\0')) {
671 * use bzip2. Non standard option.
673 gzip_program
= BZIP2_CMD
;
677 * do not preserve modification time
682 if (opt_add("write_opt=nodir") < 0)
689 * preserve uid/gid and file mode, regardless of umask
696 * select first match for a pattern only
703 * append to the archive
705 tar_set_action(APPND
);
709 * file name substitution name pattern
711 if (rep_add(optarg
) < 0) {
718 * list contents of the tape
720 tar_set_action(LIST
);
724 * verbose operation mode
730 * interactive file rename
736 * extract an archive, preserving mode,
737 * and mtime if possible.
739 tar_set_action(EXTRACT
);
744 * use gzip. Non standard option.
746 gzip_program
= GZIP_CMD
;
750 * Nothing to do here, this is pax default
758 * follow command line symlinks only
763 if (++nincfiles
> incfiles_max
) {
764 incfiles_max
= nincfiles
+ 3;
765 incfiles
= realloc(incfiles
,
766 sizeof(*incfiles
) * incfiles_max
);
767 if (incfiles
== NULL
) {
768 paxwarn(0, "Unable to allocate space "
773 incfiles
[nincfiles
- 1].file
= optarg
;
774 incfiles
[nincfiles
- 1].dir
= chdname
;
784 * do not remove leading '/' from pathnames
790 * do not pass over mount points in the file system
798 gzip_program
= COMPRESS_CMD
;
826 /* Tar requires an action. */
830 /* Traditional tar behaviour (pax uses stderr unless in list mode) */
831 if (fstdin
== 1 && act
== ARCHIVE
)
836 /* Traditional tar behaviour (pax wants to read file list from stdin) */
837 if ((act
== ARCHIVE
|| act
== APPND
) && argc
== 0 && nincfiles
== 0)
841 * if we are writing (ARCHIVE) specify tar, otherwise run like pax
842 * (unless -o specified)
844 if (act
== ARCHIVE
|| act
== APPND
)
845 frmt
= &(fsub
[Oflag
? F_OTAR
: F_TAR
]);
847 paxwarn(1, "The -O/-o options are only valid when writing an archive");
848 tar_usage(); /* only valid when writing */
852 * process the args as they are interpreted by the operation mode
860 char *file
, *dir
= NULL
;
862 while (nincfiles
|| *argv
!= NULL
) {
864 * If we queued up any include files,
865 * pull them in now. Otherwise, check
866 * for -I and -C positional flags.
867 * Anything else must be a file to
871 file
= incfiles
->file
;
875 } else if (strcmp(*argv
, "-I") == 0) {
886 if (strcmp(file
, "-") == 0)
888 else if ((fp
= fopen(file
, "r")) == NULL
) {
889 paxwarn(1, "Unable to open file '%s' for read", file
);
892 while ((str
= getline(fp
)) != NULL
) {
893 if (pat_add(str
, dir
) < 0)
897 if (strcmp(file
, "-") != 0)
900 paxwarn(1, "Problem with file '%s'", file
);
903 } else if (strcmp(*argv
, "-C") == 0) {
907 } else if (pat_add(*argv
++, chdname
) < 0)
913 * if patterns were added, we are doing chdir()
914 * on a file-by-file basis, else, just one
915 * global chdir (if any) after opening input.
923 if (chdname
!= NULL
) { /* initial chdir() */
924 if (ftree_add(chdname
, 1) < 0)
928 while (nincfiles
|| *argv
!= NULL
) {
929 char *file
, *dir
= NULL
;
932 * If we queued up any include files, pull them in
933 * now. Otherwise, check for -I and -C positional
934 * flags. Anything else must be a file to include
938 file
= incfiles
->file
;
942 } else if (strcmp(*argv
, "-I") == 0) {
953 /* Set directory if needed */
955 if (ftree_add(dir
, 1) < 0)
959 if (strcmp(file
, "-") == 0)
961 else if ((fp
= fopen(file
, "r")) == NULL
) {
962 paxwarn(1, "Unable to open file '%s' for read", file
);
965 while ((str
= getline(fp
)) != NULL
) {
966 if (ftree_add(str
, 0) < 0)
969 if (strcmp(file
, "-") != 0)
972 paxwarn(1, "Problem with file '%s'",
976 } else if (strcmp(*argv
, "-C") == 0) {
979 if (ftree_add(*argv
++, 1) < 0)
981 } else if (ftree_add(*argv
++, 0) < 0)
985 * no read errors allowed on updates/append operation!
990 if (!fstdin
&& ((arcname
== NULL
) || (*arcname
== '\0'))) {
991 arcname
= getenv("TAPE");
992 if ((arcname
== NULL
) || (*arcname
== '\0'))
993 arcname
= _PATH_DEFTAPE
;
1007 slash
+= strspn(slash
, "/");
1008 slash
+= strcspn(slash
, "/");
1010 done
= (*slash
== '\0');
1013 if (stat(path
, &sb
)) {
1014 if (errno
!= ENOENT
|| mkdir(path
, 0777)) {
1015 paxwarn(1, "%s", path
);
1018 } else if (!S_ISDIR(sb
.st_mode
)) {
1019 syswarn(1, ENOTDIR
, "%s", path
);
1031 * look at the user specified flags. set globals as required and check if
1032 * the user specified a legal set of flags. If not, complain and exit
1036 cpio_options(int argc
, char **argv
)
1052 while ((c
=getopt(argc
,argv
,"abcdfiklmoprstuvzABC:E:F:H:I:LO:SZ6")) != -1)
1056 * preserve access time on files read
1062 * swap bytes and half-words when reading data
1069 frmt
= &(fsub
[F_ACPIO
]);
1073 * create directories as needed
1079 * invert meaning of pattern list
1085 * restore an archive
1093 * use links instead of copies when possible
1099 * preserve modification time
1108 frmt
= &(fsub
[F_CPIO
]);
1118 * interactively rename files
1124 * swap bytes after reading data
1129 * list contents of archive
1136 * replace newer files
1142 * verbose operation mode
1148 * use gzip. Non standard option.
1150 gzip_program
= GZIP_CMD
;
1160 * Use 5120 byte block size
1166 * set block size in bytes
1168 wrblksz
= atoi(optarg
);
1172 * file with patterns to extract or list
1174 if ((fp
= fopen(optarg
, "r")) == NULL
) {
1175 paxwarn(1, "Unable to open file '%s' for read", optarg
);
1178 while ((str
= getline(fp
)) != NULL
) {
1182 if (getline_error
) {
1183 paxwarn(1, "Problem with file '%s'", optarg
);
1191 * filename where the archive is stored
1193 if ((optarg
[0] == '-') && (optarg
[1]== '\0')) {
1195 * treat a - as stdin
1204 * specify an archive format on write
1207 if ((frmt
= (FSUB
*)bsearch((void *)&tmp
, (void *)fsub
,
1208 sizeof(fsub
)/sizeof(FSUB
), sizeof(FSUB
), c_frmt
)) != NULL
)
1210 paxwarn(1, "Unknown -H format: %s", optarg
);
1211 (void)fputs("cpio: Known -H formats are:", stderr
);
1212 for (i
= 0; i
< (sizeof(fsub
)/sizeof(FSUB
)); ++i
)
1213 (void)fprintf(stderr
, " %s", fsub
[i
].name
);
1214 (void)fputs("\n\n", stderr
);
1219 * follow symbolic links
1225 * swap halfwords after reading data
1230 * use compress. Non standard option.
1232 gzip_program
= COMPRESS_CMD
;
1236 * process Version 6 cpio format
1238 frmt
= &(fsub
[F_OCPIO
]);
1249 * process the args as they are interpreted by the operation mode
1254 while (*argv
!= NULL
)
1255 if (pat_add(*argv
++, NULL
) < 0)
1259 if (*argv
== NULL
) {
1260 paxwarn(0, "Destination directory was not supplied");
1264 if (mkpath(dirptr
) < 0)
1274 * no read errors allowed on updates/append operation!
1277 while ((str
= getline(stdin
)) != NULL
) {
1280 if (getline_error
) {
1281 paxwarn(1, "Problem while reading stdin");
1293 * print out those invalid flag sets found to the user
1297 printflg(unsigned int flg
)
1302 (void)fprintf(stderr
,"%s: Invalid combination of options:", argv0
);
1303 while ((nxt
= ffs(flg
)) != 0) {
1306 (void)fprintf(stderr
, " -%c", flgch
[pos
-1]);
1308 (void)putc('\n', stderr
);
1313 * comparison routine used by bsearch to find the format specified
1318 c_frmt(const void *a
, const void *b
)
1320 return(strcmp(((const FSUB
*)a
)->name
, ((const FSUB
*)b
)->name
));
1325 * called by format specific options routines to get each format specific
1326 * flag and value specified with -o
1328 * pointer to next OPLIST entry or NULL (end of list).
1336 if ((opt
= ophead
) != NULL
)
1337 ophead
= ophead
->fow
;
1343 * generic routine used to complain about a format specific options
1344 * when the format does not support options.
1355 * print all we were given
1357 paxwarn(1,"These format options are not supported");
1358 while ((opt
= opt_next()) != NULL
)
1359 (void)fprintf(stderr
, "\t%s = %s\n", opt
->name
, opt
->value
);
1366 * breaks the value supplied to -o into an option name and value. Options
1367 * are given to -o in the form -o name-value,name=value
1368 * multiple -o may be specified.
1370 * 0 if format in name=value format, -1 if -o is passed junk.
1374 opt_add(const char *str
)
1382 if ((str
== NULL
) || (*str
== '\0')) {
1383 paxwarn(0, "Invalid option name");
1386 if ((lstr
= strdup(str
)) == NULL
) {
1387 paxwarn(0, "Unable to allocate space for option list");
1390 frpt
= endpt
= lstr
;
1393 * break into name and values pieces and stuff each one into a
1394 * OPLIST structure. When we know the format, the format specific
1395 * option function will go through this list
1397 while ((frpt
!= NULL
) && (*frpt
!= '\0')) {
1398 if ((endpt
= strchr(frpt
, ',')) != NULL
)
1400 if ((pt
= strchr(frpt
, '=')) == NULL
) {
1401 paxwarn(0, "Invalid options format");
1405 if ((opt
= (OPLIST
*)malloc(sizeof(OPLIST
))) == NULL
) {
1406 paxwarn(0, "Unable to allocate space for option list");
1418 if (ophead
== NULL
) {
1419 optail
= ophead
= opt
;
1430 * Convert an expression of the following forms to an off_t > 0.
1431 * 1) A positive decimal number.
1432 * 2) A positive decimal number followed by a b (mult by 512).
1433 * 3) A positive decimal number followed by a k (mult by 1024).
1434 * 4) A positive decimal number followed by a m (mult by 512).
1435 * 5) A positive decimal number followed by a w (mult by sizeof int)
1436 * 6) Two or more positive decimal numbers (with/without k,b or w).
1437 * separated by x (also * for backwards compatibility), specifying
1438 * the product of the indicated values.
1440 * 0 for an error, a positive value o.w.
1450 num
= strtol(val
, &expr
, 0);
1451 if ((num
== LONG_MAX
) || (num
<= 0) || (expr
== val
))
1453 num
= strtoq(val
, &expr
, 0);
1454 if ((num
== QUAD_MAX
) || (num
<= 0) || (expr
== val
))
1495 num
*= str_offt(expr
+ 1);
1505 char *fgetln(FILE *f
, size_t *);
1513 name
= fgetln(f
, &len
);
1515 getline_error
= ferror(f
) ? GETLINE_FILE_CORRUPT
: 0;
1518 if (name
[len
-1] != '\n')
1522 getline_error
= GETLINE_OUT_OF_MEM
;
1525 memcpy(temp
, name
, len
-1);
1532 * for those option functions where the archive format has nothing to do.
1545 * print the usage summary to the user
1551 (void)fputs("usage: pax [-cdnvz] [-E limit] [-f archive] ", stderr
);
1552 (void)fputs("[-s replstr] ... [-U user] ...", stderr
);
1553 (void)fputs("\n [-G group] ... ", stderr
);
1554 (void)fputs("[-T [from_date][,to_date]] ... ", stderr
);
1555 (void)fputs("[pattern ...]\n", stderr
);
1556 (void)fputs(" pax -r [-cdiknuvzDYZ] [-E limit] ", stderr
);
1557 (void)fputs("[-f archive] [-o options] ... \n", stderr
);
1558 (void)fputs(" [-p string] ... [-s replstr] ... ", stderr
);
1559 (void)fputs("[-U user] ... [-G group] ...\n ", stderr
);
1560 (void)fputs("[-T [from_date][,to_date]] ... ", stderr
);
1561 (void)fputs(" [pattern ...]\n", stderr
);
1562 (void)fputs(" pax -w [-dituvzHLPX] [-b blocksize] ", stderr
);
1563 (void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr
);
1564 (void)fputs(" [-B bytes] [-s replstr] ... ", stderr
);
1565 (void)fputs("[-o options] ... [-U user] ...", stderr
);
1566 (void)fputs("\n [-G group] ... ", stderr
);
1567 (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr
);
1568 (void)fputs("[file ...]\n", stderr
);
1569 (void)fputs(" pax -r -w [-diklntuvDHLPXYZ] ", stderr
);
1570 (void)fputs("[-p string] ... [-s replstr] ...", stderr
);
1571 (void)fputs("\n [-U user] ... [-G group] ... ", stderr
);
1572 (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr
);
1573 (void)fputs("\n [file ...] directory\n", stderr
);
1579 * print the usage summary to the user
1585 (void)fputs("usage: tar [-]{crtux}[-befhjmopqsvwyzHLOPXZ014578] [blocksize] ",
1587 (void)fputs("[archive] [replstr] [-C directory] [-I file] [file ...]\n",
1594 * print the usage summary to the user
1600 (void)fputs("usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr
);
1601 (void)fputs(" [-F archive] < name-list [> archive]\n", stderr
);
1602 (void)fputs(" cpio -i [-bBcdfmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]\n", stderr
);
1603 (void)fputs(" [-I archive] [-F archive] [pattern...] [< archive]\n", stderr
);
1604 (void)fputs(" cpio -p [-adlLmuvV] destination-directory < name-list\n", stderr
);