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 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
42 static const char rcsid[] =
43 "$FreeBSD: src/bin/pax/options.c,v 1.13.2.3 2001/08/01 05:03:11 obrien Exp $";
46 #include <sys/types.h>
63 * Routines which handle command line options
66 static char flgch[] = FLGCH; /* list of all possible flags */
67 static OPLIST *ophead = NULL; /* head for format specific options -x */
68 static OPLIST *optail = NULL; /* option tail */
70 static int no_op __P((void));
71 static void printflg __P((unsigned int));
72 static int c_frmt __P((const void *, const void *));
73 static off_t str_offt __P((char *));
74 static char *getline __P((FILE *fp));
75 static void pax_options __P((register int, register char **));
76 static void pax_usage __P((void));
77 static void tar_options __P((register int, register char **));
78 static void tar_usage __P((void));
79 static void cpio_options __P((register int, register char **));
80 static void cpio_usage __P((void));
82 /* errors from getline */
83 #define GETLINE_FILE_CORRUPT 1
84 #define GETLINE_OUT_OF_MEM 2
85 static int getline_error;
88 #define GZIP_CMD "gzip" /* command to run as gzip */
89 #define COMPRESS_CMD "compress" /* command to run as compress */
90 #define BZIP2_CMD "bzip2" /* command to run as gzip */
93 * Format specific routine table - MUST BE IN SORTED ORDER BY NAME
94 * (see pax.h for description of each function)
96 * name, blksz, hdsz, udev, hlk, blkagn, inhead, id, st_read,
97 * read, end_read, st_write, write, end_write, trail,
98 * rd_data, wr_data, options
102 /* 0: OLD BINARY CPIO */
103 {"bcpio", 5120, sizeof(HD_BCPIO), 1, 0, 0, 1, bcpio_id, cpio_strd,
104 bcpio_rd, bcpio_endrd, cpio_stwr, bcpio_wr, cpio_endwr, cpio_trail,
105 rd_wrfile, wr_rdfile, bad_opt},
107 /* 1: OLD OCTAL CHARACTER CPIO */
108 {"cpio", 5120, sizeof(HD_CPIO), 1, 0, 0, 1, cpio_id, cpio_strd,
109 cpio_rd, cpio_endrd, cpio_stwr, cpio_wr, cpio_endwr, cpio_trail,
110 rd_wrfile, wr_rdfile, bad_opt},
112 /* 2: SVR4 HEX CPIO */
113 {"sv4cpio", 5120, sizeof(HD_VCPIO), 1, 0, 0, 1, vcpio_id, cpio_strd,
114 vcpio_rd, vcpio_endrd, cpio_stwr, vcpio_wr, cpio_endwr, cpio_trail,
115 rd_wrfile, wr_rdfile, bad_opt},
117 /* 3: SVR4 HEX CPIO WITH CRC */
118 {"sv4crc", 5120, sizeof(HD_VCPIO), 1, 0, 0, 1, crc_id, crc_strd,
119 vcpio_rd, vcpio_endrd, crc_stwr, vcpio_wr, cpio_endwr, cpio_trail,
120 rd_wrfile, wr_rdfile, bad_opt},
123 {"tar", 10240, BLKMULT, 0, 1, BLKMULT, 0, tar_id, no_op,
124 tar_rd, tar_endrd, no_op, tar_wr, tar_endwr, tar_trail,
125 rd_wrfile, wr_rdfile, tar_opt},
128 {"ustar", 10240, BLKMULT, 0, 1, BLKMULT, 0, ustar_id, ustar_strd,
129 ustar_rd, tar_endrd, ustar_stwr, ustar_wr, tar_endwr, tar_trail,
130 rd_wrfile, wr_rdfile, bad_opt},
132 #define F_OCPIO 0 /* format when called as cpio -6 */
133 #define F_ACPIO 1 /* format when called as cpio -c */
134 #define F_CPIO 3 /* format when called as cpio */
135 #define F_OTAR 4 /* format when called as tar -o */
136 #define F_TAR 5 /* format when called as tar */
137 #define DEFLT 5 /* default write format from list above */
140 * ford is the archive search order used by get_arc() to determine what kind
141 * of archive we are dealing with. This helps to properly id archive formats
142 * some formats may be subsets of others....
144 int ford[] = {5, 4, 3, 2, 1, 0, -1 };
148 * figure out if we are pax, tar or cpio. Call the appropriate options
154 options(register int argc, register char **argv)
159 register char **argv;
164 * Are we acting like pax, tar or cpio (based on argv[0])
166 if ((argv0 = strrchr(argv[0], '/')) != NULL)
171 if (strcmp(NM_TAR, argv0) == 0)
172 return(tar_options(argc, argv));
173 else if (strcmp(NM_CPIO, argv0) == 0)
174 return(cpio_options(argc, argv));
176 * assume pax as the default
179 return(pax_options(argc, argv));
184 * look at the user specified flags. set globals as required and check if
185 * the user specified a legal set of flags. If not, complain and exit
190 pax_options(register int argc, register char **argv)
193 pax_options(argc, argv)
195 register 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 filesystem 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!
589 * look at the user specified flags. set globals as required and check if
590 * the user specified a legal set of flags. If not, complain and exit
595 tar_options(register int argc, register char **argv)
598 tar_options(argc, argv)
600 register 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 */
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
709 * file name substitution name pattern
711 if (rep_add(optarg) < 0) {
718 * list contents of the tape
724 * verbose operation mode
730 * interactive file rename
736 * extract an archive, preserving mode,
737 * and mtime if possible.
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 /* Traditional tar behaviour (pax uses stderr unless in list mode) */
827 if (fstdin == 1 && act == ARCHIVE)
832 /* Traditional tar behaviour (pax wants to read file list from stdin) */
833 if ((act == ARCHIVE || act == APPND) && argc == 0 && nincfiles == 0)
837 * if we are writing (ARCHIVE) specify tar, otherwise run like pax
838 * (unless -o specified)
840 if (act == ARCHIVE || act == APPND)
841 frmt = &(fsub[Oflag ? F_OTAR : F_TAR]);
843 paxwarn(1, "The -O/-o options are only valid when writing an archive");
844 tar_usage(); /* only valid when writing */
848 * process the args as they are interpreted by the operation mode
856 char *file, *dir = NULL;
858 while (nincfiles || *argv != NULL) {
860 * If we queued up any include files,
861 * pull them in now. Otherwise, check
862 * for -I and -C positional flags.
863 * Anything else must be a file to
867 file = incfiles->file;
871 } else if (strcmp(*argv, "-I") == 0) {
882 if (strcmp(file, "-") == 0)
884 else if ((fp = fopen(file, "r")) == NULL) {
885 paxwarn(1, "Unable to open file '%s' for read", file);
888 while ((str = getline(fp)) != NULL) {
889 if (pat_add(str, dir) < 0)
893 if (strcmp(file, "-") != 0)
896 paxwarn(1, "Problem with file '%s'", file);
899 } else if (strcmp(*argv, "-C") == 0) {
903 } else if (pat_add(*argv++, chdname) < 0)
909 * if patterns were added, we are doing chdir()
910 * on a file-by-file basis, else, just one
911 * global chdir (if any) after opening input.
919 if (chdname != NULL) { /* initial chdir() */
920 if (ftree_add(chdname, 1) < 0)
924 while (nincfiles || *argv != NULL) {
925 char *file, *dir = NULL;
928 * If we queued up any include files, pull them in
929 * now. Otherwise, check for -I and -C positional
930 * flags. Anything else must be a file to include
934 file = incfiles->file;
938 } else if (strcmp(*argv, "-I") == 0) {
949 /* Set directory if needed */
951 if (ftree_add(dir, 1) < 0)
955 if (strcmp(file, "-") == 0)
957 else if ((fp = fopen(file, "r")) == NULL) {
958 paxwarn(1, "Unable to open file '%s' for read", file);
961 while ((str = getline(fp)) != NULL) {
962 if (ftree_add(str, 0) < 0)
965 if (strcmp(file, "-") != 0)
968 paxwarn(1, "Problem with file '%s'",
972 } else if (strcmp(*argv, "-C") == 0) {
975 if (ftree_add(*argv++, 1) < 0)
977 } else if (ftree_add(*argv++, 0) < 0)
981 * no read errors allowed on updates/append operation!
986 if (!fstdin && ((arcname == NULL) || (*arcname == '\0'))) {
987 arcname = getenv("TAPE");
988 if ((arcname == NULL) || (*arcname == '\0'))
989 arcname = _PATH_DEFTAPE;
998 register char *slash;
1004 slash += strspn(slash, "/");
1005 slash += strcspn(slash, "/");
1007 done = (*slash == '\0');
1010 if (stat(path, &sb)) {
1011 if (errno != ENOENT || mkdir(path, 0777)) {
1012 paxwarn(1, "%s", path);
1015 } else if (!S_ISDIR(sb.st_mode)) {
1016 syswarn(1, ENOTDIR, "%s", path);
1028 * look at the user specified flags. set globals as required and check if
1029 * the user specified a legal set of flags. If not, complain and exit
1034 cpio_options(register int argc, register char **argv)
1037 cpio_options(argc, argv)
1039 register char **argv;
1055 while ((c=getopt(argc,argv,"abcdfiklmoprstuvzABC:E:F:H:I:LO:SZ6")) != -1)
1059 * preserve access time on files read
1065 * swap bytes and half-words when reading data
1072 frmt = &(fsub[F_ACPIO]);
1076 * create directories as needed
1082 * invert meaning of pattern list
1088 * restore an archive
1096 * use links instead of copies when possible
1102 * preserve modification time
1111 frmt = &(fsub[F_CPIO]);
1121 * interactively rename files
1127 * swap bytes after reading data
1132 * list contents of archive
1139 * replace newer files
1145 * verbose operation mode
1151 * use gzip. Non standard option.
1153 gzip_program = GZIP_CMD;
1163 * Use 5120 byte block size
1169 * set block size in bytes
1171 wrblksz = atoi(optarg);
1175 * file with patterns to extract or list
1177 if ((fp = fopen(optarg, "r")) == NULL) {
1178 paxwarn(1, "Unable to open file '%s' for read", optarg);
1181 while ((str = getline(fp)) != NULL) {
1185 if (getline_error) {
1186 paxwarn(1, "Problem with file '%s'", optarg);
1194 * filename where the archive is stored
1196 if ((optarg[0] == '-') && (optarg[1]== '\0')) {
1198 * treat a - as stdin
1207 * specify an archive format on write
1210 if ((frmt = (FSUB *)bsearch((void *)&tmp, (void *)fsub,
1211 sizeof(fsub)/sizeof(FSUB), sizeof(FSUB), c_frmt)) != NULL)
1213 paxwarn(1, "Unknown -H format: %s", optarg);
1214 (void)fputs("cpio: Known -H formats are:", stderr);
1215 for (i = 0; i < (sizeof(fsub)/sizeof(FSUB)); ++i)
1216 (void)fprintf(stderr, " %s", fsub[i].name);
1217 (void)fputs("\n\n", stderr);
1222 * follow symbolic links
1228 * swap halfwords after reading data
1233 * use compress. Non standard option.
1235 gzip_program = COMPRESS_CMD;
1239 * process Version 6 cpio format
1241 frmt = &(fsub[F_OCPIO]);
1252 * process the args as they are interpreted by the operation mode
1257 while (*argv != NULL)
1258 if (pat_add(*argv++, NULL) < 0)
1262 if (*argv == NULL) {
1263 paxwarn(0, "Destination directory was not supplied");
1267 if (mkpath(dirptr) < 0)
1277 * no read errors allowed on updates/append operation!
1280 while ((str = getline(stdin)) != NULL) {
1281 ftree_add(str, NULL);
1283 if (getline_error) {
1284 paxwarn(1, "Problem while reading stdin");
1296 * print out those invalid flag sets found to the user
1301 printflg(unsigned int flg)
1311 (void)fprintf(stderr,"%s: Invalid combination of options:", argv0);
1312 while ((nxt = ffs(flg)) != 0) {
1315 (void)fprintf(stderr, " -%c", flgch[pos-1]);
1317 (void)putc('\n', stderr);
1322 * comparison routine used by bsearch to find the format specified
1328 c_frmt(const void *a, const void *b)
1336 return(strcmp(((FSUB *)a)->name, ((FSUB *)b)->name));
1341 * called by format specific options routines to get each format specific
1342 * flag and value specified with -o
1344 * pointer to next OPLIST entry or NULL (end of list).
1357 if ((opt = ophead) != NULL)
1358 ophead = ophead->fow;
1364 * generic routine used to complain about a format specific options
1365 * when the format does not support options.
1376 register OPLIST *opt;
1381 * print all we were given
1383 paxwarn(1,"These format options are not supported");
1384 while ((opt = opt_next()) != NULL)
1385 (void)fprintf(stderr, "\t%s = %s\n", opt->name, opt->value);
1392 * breaks the value supplied to -o into a option name and value. options
1393 * are given to -o in the form -o name-value,name=value
1394 * multiple -o may be specified.
1396 * 0 if format in name=value format, -1 if -o is passed junk
1401 opt_add(register char *str)
1408 register OPLIST *opt;
1409 register char *frpt;
1411 register char *endpt;
1413 if ((str == NULL) || (*str == '\0')) {
1414 paxwarn(0, "Invalid option name");
1417 if ((str = strdup(str)) == NULL) {
1418 paxwarn(0, "Unable to allocate space for option list");
1424 * break into name and values pieces and stuff each one into a
1425 * OPLIST structure. When we know the format, the format specific
1426 * option function will go through this list
1428 while ((frpt != NULL) && (*frpt != '\0')) {
1429 if ((endpt = strchr(frpt, ',')) != NULL)
1431 if ((pt = strchr(frpt, '=')) == NULL) {
1432 paxwarn(0, "Invalid options format");
1436 if ((opt = (OPLIST *)malloc(sizeof(OPLIST))) == NULL) {
1437 paxwarn(0, "Unable to allocate space for option list");
1449 if (ophead == NULL) {
1450 optail = ophead = opt;
1461 * Convert an expression of the following forms to an off_t > 0.
1462 * 1) A positive decimal number.
1463 * 2) A positive decimal number followed by a b (mult by 512).
1464 * 3) A positive decimal number followed by a k (mult by 1024).
1465 * 4) A positive decimal number followed by a m (mult by 512).
1466 * 5) A positive decimal number followed by a w (mult by sizeof int)
1467 * 6) Two or more positive decimal numbers (with/without k,b or w).
1468 * separated by x (also * for backwards compatibility), specifying
1469 * the product of the indicated values.
1471 * 0 for an error, a positive value o.w.
1487 num = strtol(val, &expr, 0);
1488 if ((num == LONG_MAX) || (num <= 0) || (expr == val))
1490 num = strtoq(val, &expr, 0);
1491 if ((num == QUAD_MAX) || (num <= 0) || (expr == val))
1532 num *= str_offt(expr + 1);
1554 name = fgetln(f, &len);
1556 getline_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0;
1559 if (name[len-1] != '\n')
1563 getline_error = GETLINE_OUT_OF_MEM;
1566 memcpy(temp, name, len-1);
1573 * for those option functions where the archive format has nothing to do.
1591 * print the usage summary to the user
1602 (void)fputs("usage: pax [-cdnvz] [-E limit] [-f archive] ", stderr);
1603 (void)fputs("[-s replstr] ... [-U user] ...", stderr);
1604 (void)fputs("\n [-G group] ... ", stderr);
1605 (void)fputs("[-T [from_date][,to_date]] ... ", stderr);
1606 (void)fputs("[pattern ...]\n", stderr);
1607 (void)fputs(" pax -r [-cdiknuvzDYZ] [-E limit] ", stderr);
1608 (void)fputs("[-f archive] [-o options] ... \n", stderr);
1609 (void)fputs(" [-p string] ... [-s replstr] ... ", stderr);
1610 (void)fputs("[-U user] ... [-G group] ...\n ", stderr);
1611 (void)fputs("[-T [from_date][,to_date]] ... ", stderr);
1612 (void)fputs(" [pattern ...]\n", stderr);
1613 (void)fputs(" pax -w [-dituvzHLPX] [-b blocksize] ", stderr);
1614 (void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr);
1615 (void)fputs(" [-B bytes] [-s replstr] ... ", stderr);
1616 (void)fputs("[-o options] ... [-U user] ...", stderr);
1617 (void)fputs("\n [-G group] ... ", stderr);
1618 (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
1619 (void)fputs("[file ...]\n", stderr);
1620 (void)fputs(" pax -r -w [-diklntuvDHLPXYZ] ", stderr);
1621 (void)fputs("[-p string] ... [-s replstr] ...", stderr);
1622 (void)fputs("\n [-U user] ... [-G group] ... ", stderr);
1623 (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
1624 (void)fputs("\n [file ...] directory\n", stderr);
1630 * print the usage summary to the user
1641 (void)fputs("usage: tar [-]{crtux}[-befhjmopqsvwyzHLOPXZ014578] [blocksize] ",
1643 (void)fputs("[archive] [replstr] [-C directory] [-I file] [file ...]\n",
1650 * print the usage summary to the user
1661 (void)fputs("usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr);
1662 (void)fputs(" [-F archive] < name-list [> archive]\n", stderr);
1663 (void)fputs(" cpio -i [-bBcdfmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]\n", stderr);
1664 (void)fputs(" [-I archive] [-F archive] [pattern...] [< archive]\n", stderr);
1665 (void)fputs(" cpio -p [-adlLmuvV] destination-directory < name-list\n", stderr);