xref: /csrg-svn/bin/pax/options.c (revision 66890)
157196Smuller /*-
257196Smuller  * Copyright (c) 1992 Keith Muller.
360676Sbostic  * Copyright (c) 1992, 1993
460676Sbostic  *	The Regents of the University of California.  All rights reserved.
557196Smuller  *
657196Smuller  * This code is derived from software contributed to Berkeley by
757196Smuller  * Keith Muller of the University of California, San Diego.
857196Smuller  *
957196Smuller  * %sccs.include.redist.c%
1057196Smuller  */
1157196Smuller 
1257196Smuller #ifndef lint
13*66890Sbostic static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 04/18/94";
1457196Smuller #endif /* not lint */
1557196Smuller 
1657196Smuller #include <sys/types.h>
1757196Smuller #include <sys/time.h>
1857196Smuller #include <sys/stat.h>
1957196Smuller #include <sys/mtio.h>
2057196Smuller #include <sys/param.h>
2157196Smuller #include <stdio.h>
2257196Smuller #include <ctype.h>
2357196Smuller #include <string.h>
2457196Smuller #include <unistd.h>
2557196Smuller #include <stdlib.h>
2657196Smuller #include <limits.h>
2757196Smuller #include "pax.h"
2857196Smuller #include "options.h"
2957196Smuller #include "cpio.h"
30*66890Sbostic #include "tar.h"
3157196Smuller #include "extern.h"
3257196Smuller 
3357196Smuller /*
3457196Smuller  * Routines which handle command line options
3557196Smuller  */
3657196Smuller 
3757196Smuller static char flgch[] = FLGCH;	/* list of all possible flags */
3857196Smuller static OPLIST *ophead = NULL;	/* head for format specific options -x */
3957196Smuller static OPLIST *optail = NULL;	/* option tail */
4057196Smuller 
4157196Smuller static int no_op __P((void));
4257196Smuller static void printflg __P((unsigned int));
4357196Smuller static int c_frmt __P((const void *, const void *));
4457196Smuller static off_t str_offt __P((char *));
45*66890Sbostic static void pax_options __P((register int, register char **));
46*66890Sbostic static void pax_usage __P((void));
47*66890Sbostic static void tar_options __P((register int, register char **));
48*66890Sbostic static void tar_usage __P((void));
49*66890Sbostic #ifdef notdef
50*66890Sbostic static void cpio_options __P((register int, register char **));
51*66890Sbostic static void cpio_usage __P((void));
52*66890Sbostic #endif
5357196Smuller 
5457196Smuller /*
5557196Smuller  *	Format specific routine table - MUST BE IN SORTED ORDER BY NAME
5657196Smuller  *	(see pax.h for description of each function)
5757196Smuller  *
5857196Smuller  * 	name, blksz, hdsz, udev, hlk, blkagn, inhead, id, st_read,
5957196Smuller  *	read, end_read, st_write, write, end_write, trail,
6057196Smuller  *	rd_data, wr_data, options
6157196Smuller  */
6257196Smuller 
6357196Smuller FSUB fsub[] = {
6457196Smuller /* 0: OLD BINARY CPIO */
6557196Smuller 	"bcpio", 5120, sizeof(HD_BCPIO), 1, 0, 0, 1, bcpio_id, cpio_strd,
6657196Smuller 	bcpio_rd, bcpio_endrd, cpio_stwr, bcpio_wr, cpio_endwr, cpio_trail,
6757196Smuller 	rd_wrfile, wr_rdfile, bad_opt,
6857196Smuller 
6957196Smuller /* 1: OLD OCTAL CHARACTER CPIO */
7057196Smuller 	"cpio", 5120, sizeof(HD_CPIO), 1, 0, 0, 1, cpio_id, cpio_strd,
7157196Smuller 	cpio_rd, cpio_endrd, cpio_stwr, cpio_wr, cpio_endwr, cpio_trail,
7257196Smuller 	rd_wrfile, wr_rdfile, bad_opt,
7357196Smuller 
7457196Smuller /* 2: SVR4 HEX CPIO */
7557196Smuller 	"sv4cpio", 5120, sizeof(HD_VCPIO), 1, 0, 0, 1, vcpio_id, cpio_strd,
7657196Smuller 	vcpio_rd, vcpio_endrd, cpio_stwr, vcpio_wr, cpio_endwr, cpio_trail,
7757196Smuller 	rd_wrfile, wr_rdfile, bad_opt,
7857196Smuller 
7957196Smuller /* 3: SVR4 HEX CPIO WITH CRC */
8057196Smuller 	"sv4crc", 5120, sizeof(HD_VCPIO), 1, 0, 0, 1, crc_id, crc_strd,
8157196Smuller 	vcpio_rd, vcpio_endrd, crc_stwr, vcpio_wr, cpio_endwr, cpio_trail,
8257196Smuller 	rd_wrfile, wr_rdfile, bad_opt,
8357196Smuller 
8457196Smuller /* 4: OLD TAR */
8557196Smuller 	"tar", 10240, BLKMULT, 0, 1, BLKMULT, 0, tar_id, no_op,
8657196Smuller 	tar_rd, tar_endrd, no_op, tar_wr, tar_endwr, tar_trail,
8757196Smuller 	rd_wrfile, wr_rdfile, tar_opt,
8857196Smuller 
8957196Smuller /* 5: POSIX USTAR */
9057196Smuller 	"ustar", 10240, BLKMULT, 0, 1, BLKMULT, 0, ustar_id, ustar_strd,
9157196Smuller 	ustar_rd, tar_endrd, ustar_stwr, ustar_wr, tar_endwr, tar_trail,
9257196Smuller 	rd_wrfile, wr_rdfile, bad_opt,
9357196Smuller };
94*66890Sbostic #define F_TAR	4	/* format when called as tar */
9557196Smuller #define DEFLT	5	/* default write format from list above */
9657196Smuller 
9757196Smuller /*
9857196Smuller  * ford is the archive search order used by get_arc() to determine what kind
9957196Smuller  * of archive we are dealing with. This helps to properly id  archive formats
10057196Smuller  * some formats may be subsets of others....
10157196Smuller  */
10257196Smuller int ford[] = {5, 4, 3, 2, 1, 0, -1 };
10357196Smuller 
10457196Smuller /*
10557196Smuller  * options()
106*66890Sbostic  *	figure out if we are pax, tar or cpio. Call the appropriate options
107*66890Sbostic  *	parser
10857196Smuller  */
10957196Smuller 
11057196Smuller #if __STDC__
11157196Smuller void
options(register int argc,register char ** argv)11257196Smuller options(register int argc, register char **argv)
11357196Smuller #else
11457196Smuller void
11557196Smuller options(argc, argv)
11657196Smuller 	register int argc;
11757196Smuller 	register char **argv;
11857196Smuller #endif
11957196Smuller {
120*66890Sbostic 
121*66890Sbostic 	/*
122*66890Sbostic 	 * Are we acting like pax, tar or cpio (based on argv[0])
123*66890Sbostic 	 */
124*66890Sbostic 	if ((argv0 = strrchr(argv[0], '/')) != NULL)
125*66890Sbostic 		argv0++;
126*66890Sbostic 	else
127*66890Sbostic 		argv0 = argv[0];
128*66890Sbostic 
129*66890Sbostic 	if (strcmp(NM_TAR, argv0) == 0)
130*66890Sbostic 		return(tar_options(argc, argv));
131*66890Sbostic #	ifdef notdef
132*66890Sbostic 	else if (strcmp(NM_CPIO, argv0) == 0)
133*66890Sbostic 		return(cpio_options(argc, argv));
134*66890Sbostic #	endif
135*66890Sbostic 	/*
136*66890Sbostic 	 * assume pax as the default
137*66890Sbostic 	 */
138*66890Sbostic 	argv0 = NM_PAX;
139*66890Sbostic 	return(pax_options(argc, argv));
140*66890Sbostic }
141*66890Sbostic 
142*66890Sbostic /*
143*66890Sbostic  * pax_options()
144*66890Sbostic  *	look at the user specified flags. set globals as required and check if
145*66890Sbostic  *	the user specified a legal set of flags. If not, complain and exit
146*66890Sbostic  */
147*66890Sbostic 
148*66890Sbostic #if __STDC__
149*66890Sbostic static void
pax_options(register int argc,register char ** argv)150*66890Sbostic pax_options(register int argc, register char **argv)
151*66890Sbostic #else
152*66890Sbostic static void
153*66890Sbostic pax_options(argc, argv)
154*66890Sbostic 	register int argc;
155*66890Sbostic 	register char **argv;
156*66890Sbostic #endif
157*66890Sbostic {
15857196Smuller 	register int c;
15957196Smuller 	register int i;
16057196Smuller 	unsigned int flg = 0;
16157196Smuller 	unsigned int bflg = 0;
16257196Smuller 	register char *pt;
16357196Smuller         FSUB tmp;
16457196Smuller 	extern char *optarg;
16557196Smuller 	extern int optind;
16657196Smuller 
16757196Smuller 	/*
16857196Smuller 	 * process option flags
16957196Smuller 	 */
170*66890Sbostic 	while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:B:DE:G:HLPT:U:XYZ"))
17157196Smuller 	    != EOF) {
17257196Smuller 		switch (c) {
17357196Smuller 		case 'a':
17457196Smuller 			/*
17557196Smuller 			 * append
17657196Smuller 			 */
17757196Smuller 			flg |= AF;
17857196Smuller 			break;
17957196Smuller 		case 'b':
18057196Smuller 			/*
181*66890Sbostic 			 * specify blocksize
18257196Smuller 			 */
18357196Smuller 			flg |= BF;
18457196Smuller 			if ((wrblksz = (int)str_offt(optarg)) <= 0) {
18557196Smuller 				warn(1, "Invalid block size %s", optarg);
186*66890Sbostic 				pax_usage();
18757196Smuller 			}
18857196Smuller 			break;
18957196Smuller 		case 'c':
19057196Smuller 			/*
19157196Smuller 			 * inverse match on patterns
19257196Smuller 			 */
19357196Smuller 			cflag = 1;
19457196Smuller 			flg |= CF;
19557196Smuller 			break;
19657196Smuller 		case 'd':
19757196Smuller 			/*
19857196Smuller 			 * match only dir on extract, not the subtree at dir
19957196Smuller 			 */
20057196Smuller 			dflag = 1;
20157196Smuller 			flg |= DF;
20257196Smuller 			break;
20357196Smuller 		case 'f':
20457196Smuller 			/*
20557196Smuller 			 * filename where the archive is stored
20657196Smuller 			 */
20757196Smuller 			arcname = optarg;
20857196Smuller 			flg |= FF;
20957196Smuller 			break;
21057196Smuller 		case 'i':
21157196Smuller 			/*
21257196Smuller 			 * interactive file rename
21357196Smuller 			 */
21457196Smuller 			iflag = 1;
21557196Smuller 			flg |= IF;
21657196Smuller 			break;
21757196Smuller 		case 'k':
21857196Smuller 			/*
21957196Smuller 			 * do not clobber files that exist
22057196Smuller 			 */
22157196Smuller 			kflag = 1;
22257196Smuller 			flg |= KF;
22357196Smuller 			break;
22457196Smuller 		case 'l':
22557196Smuller 			/*
22657196Smuller 			 * try to link src to dest with copy (-rw)
22757196Smuller 			 */
22857196Smuller 			lflag = 1;
22957196Smuller 			flg |= LF;
23057196Smuller 			break;
23157196Smuller 		case 'n':
23257196Smuller 			/*
23357196Smuller 			 * select first match for a pattern only
23457196Smuller 			 */
23557196Smuller 			nflag = 1;
23657196Smuller 			flg |= NF;
23757196Smuller 			break;
23857196Smuller 		case 'o':
23957196Smuller 			/*
24057196Smuller 			 * pass format specific options
24157196Smuller 			 */
24257196Smuller 			flg |= OF;
24357196Smuller 			if (opt_add(optarg) < 0)
244*66890Sbostic 				pax_usage();
24557196Smuller 			break;
24657196Smuller 		case 'p':
24757196Smuller 			/*
24857196Smuller 			 * specify file characteristic options
24957196Smuller 			 */
25057196Smuller 			for (pt = optarg; *pt != '\0'; ++pt) {
25157196Smuller 				switch(*pt) {
25257196Smuller 				case 'a':
25357196Smuller 					/*
25457196Smuller 					 * do not preserve access time
25557196Smuller 					 */
25657196Smuller 					patime = 0;
25757196Smuller 					break;
25857196Smuller 				case 'e':
25957196Smuller 					/*
26057196Smuller 					 * preserve user id, group id, file
26157196Smuller 					 * mode, access/modification times
26257196Smuller 					 */
26357196Smuller 					pids = 1;
26457196Smuller 					pmode = 1;
26557196Smuller 					patime = 1;
26657196Smuller 					pmtime = 1;
26757196Smuller 					break;
26857196Smuller 				case 'm':
26957196Smuller 					/*
27057196Smuller 					 * do not preserve modification time
27157196Smuller 					 */
27257196Smuller 					pmtime = 0;
27357196Smuller 					break;
27457196Smuller 				case 'o':
27557196Smuller 					/*
27657196Smuller 					 * preserve uid/gid
27757196Smuller 					 */
27857196Smuller 					pids = 1;
27957196Smuller 					break;
28057196Smuller 				case 'p':
28157196Smuller 					/*
28257196Smuller 					 * preserver file mode bits
28357196Smuller 					 */
28457196Smuller 					pmode = 1;
28557196Smuller 					break;
28657196Smuller 				default:
28757196Smuller 					warn(1, "Invalid -p string: %c", *pt);
288*66890Sbostic 					pax_usage();
28957196Smuller 					break;
29057196Smuller 				}
29157196Smuller 			}
29257196Smuller 			flg |= PF;
29357196Smuller 			break;
29457196Smuller 		case 'r':
29557196Smuller 			/*
29657196Smuller 			 * read the archive
29757196Smuller 			 */
29857196Smuller 			flg |= RF;
29957196Smuller 			break;
30057196Smuller 		case 's':
30157196Smuller 			/*
30257196Smuller 			 * file name substitution name pattern
30357196Smuller 			 */
30457196Smuller 			if (rep_add(optarg) < 0) {
305*66890Sbostic 				pax_usage();
30657196Smuller 				break;
30757196Smuller 			}
30857196Smuller 			flg |= SF;
30957196Smuller 			break;
31057196Smuller 		case 't':
31157196Smuller 			/*
31257196Smuller 			 * preserve access time on filesystem nodes we read
31357196Smuller 			 */
31457196Smuller 			tflag = 1;
31557196Smuller 			flg |= TF;
31657196Smuller 			break;
31757196Smuller 		case 'u':
31857196Smuller 			/*
31957196Smuller 			 * ignore those older files
32057196Smuller 			 */
32157196Smuller 			uflag = 1;
32257196Smuller 			flg |= UF;
32357196Smuller 			break;
32457196Smuller 		case 'v':
32557196Smuller 			/*
32657196Smuller 			 * verbose operation mode
32757196Smuller 			 */
32857196Smuller 			vflag = 1;
32957196Smuller 			flg |= VF;
33057196Smuller 			break;
33157196Smuller 		case 'w':
33257196Smuller 			/*
33357196Smuller 			 * write an archive
33457196Smuller 			 */
33557196Smuller 			flg |= WF;
33657196Smuller 			break;
33757196Smuller 		case 'x':
33857196Smuller 			/*
33957196Smuller 			 * specify an archive format on write
34057196Smuller 			 */
34157196Smuller 			tmp.name = optarg;
34257196Smuller 			if (frmt = (FSUB *)bsearch((void *)&tmp, (void *)fsub,
34357196Smuller 			    sizeof(fsub)/sizeof(FSUB), sizeof(FSUB), c_frmt)) {
34457196Smuller 				flg |= XF;
34557196Smuller 				break;
34657196Smuller 			}
34757196Smuller 			warn(1, "Unknown -x format: %s", optarg);
34857196Smuller 			(void)fputs("pax: Known -x formats are:", stderr);
34957196Smuller 			for (i = 0; i < (sizeof(fsub)/sizeof(FSUB)); ++i)
35057196Smuller 				(void)fprintf(stderr, " %s", fsub[i].name);
35157196Smuller 			(void)fputs("\n\n", stderr);
352*66890Sbostic 			pax_usage();
35357196Smuller 			break;
35457196Smuller 		case 'B':
35557196Smuller 			/*
35657196Smuller 			 * non-standard option on number of bytes written on a
35757196Smuller 			 * single archive volume.
35857196Smuller 			 */
35957196Smuller 			if ((wrlimit = str_offt(optarg)) <= 0) {
36057196Smuller 				warn(1, "Invalid write limit %s", optarg);
361*66890Sbostic 				pax_usage();
36257196Smuller 			}
36357196Smuller 			if (wrlimit % BLKMULT) {
36457196Smuller 				warn(1, "Write limit is not a %d byte multiple",
36557196Smuller 				    BLKMULT);
366*66890Sbostic 				pax_usage();
36757196Smuller 			}
36857196Smuller 			flg |= CBF;
36957196Smuller 			break;
37057540Smuller 		case 'D':
37157540Smuller 			/*
37257540Smuller 			 * On extraction check file inode change time before the
37357540Smuller 			 * modification of the file name. Non standard option.
37457540Smuller 			 */
37557540Smuller 			Dflag = 1;
37657540Smuller 			flg |= CDF;
37757540Smuller 			break;
37857196Smuller 		case 'E':
37957196Smuller 			/*
38057196Smuller 			 * non-standard limit on read faults
38157196Smuller 			 * 0 indicates stop after first error, values
38257196Smuller 			 * indicate a limit, "NONE" try forever
38357196Smuller 			 */
38457196Smuller 			flg |= CEF;
38557196Smuller 			if (strcmp(NONE, optarg) == 0)
38657196Smuller 				maxflt = -1;
38757196Smuller 			else if ((maxflt = atoi(optarg)) < 0) {
38857196Smuller 				warn(1, "Error count value must be positive");
389*66890Sbostic 				pax_usage();
39057196Smuller 			}
39157196Smuller 			break;
39257196Smuller 		case 'G':
39357196Smuller 			/*
39457196Smuller 			 * non-standard option for selecting files within an
39557196Smuller 			 * archive by group (gid or name)
39657196Smuller 			 */
39757196Smuller 			if (grp_add(optarg) < 0) {
398*66890Sbostic 				pax_usage();
39957196Smuller 				break;
40057196Smuller 			}
40157196Smuller 			flg |= CGF;
40257196Smuller 			break;
40357196Smuller 		case 'H':
40457196Smuller 			/*
40557196Smuller 			 * follow command line symlinks only
40657196Smuller 			 */
40757196Smuller 			Hflag = 1;
40857196Smuller 			flg |= CHF;
40957196Smuller 			break;
41057196Smuller 		case 'L':
41157196Smuller 			/*
41257196Smuller 			 * follow symlinks
41357196Smuller 			 */
41457196Smuller 			Lflag = 1;
41557196Smuller 			flg |= CLF;
41657196Smuller 			break;
417*66890Sbostic 		case 'P':
418*66890Sbostic 			/*
419*66890Sbostic 			 * do NOT follow symlinks (default)
420*66890Sbostic 			 */
421*66890Sbostic 			Lflag = 0;
422*66890Sbostic 			flg |= CPF;
423*66890Sbostic 			break;
42457196Smuller 		case 'T':
42557196Smuller 			/*
42657196Smuller 			 * non-standard option for selecting files within an
42757196Smuller 			 * archive by modification time range (lower,upper)
42857196Smuller 			 */
42957196Smuller 			if (trng_add(optarg) < 0) {
430*66890Sbostic 				pax_usage();
43157196Smuller 				break;
43257196Smuller 			}
43357196Smuller 			flg |= CTF;
43457196Smuller 			break;
43557196Smuller 		case 'U':
43657196Smuller 			/*
43757196Smuller 			 * non-standard option for selecting files within an
43857196Smuller 			 * archive by user (uid or name)
43957196Smuller 			 */
44057196Smuller 			if (usr_add(optarg) < 0) {
441*66890Sbostic 				pax_usage();
44257196Smuller 				break;
44357196Smuller 			}
44457196Smuller 			flg |= CUF;
44557196Smuller 			break;
44657196Smuller 		case 'X':
44757196Smuller 			/*
44857196Smuller 			 * do not pass over mount points in the file system
44957196Smuller 			 */
45057196Smuller 			Xflag = 1;
45157196Smuller 			flg |= CXF;
45257196Smuller 			break;
45357540Smuller 		case 'Y':
45457540Smuller 			/*
45557540Smuller 			 * On extraction check file inode change time after the
45657540Smuller 			 * modification of the file name. Non standard option.
45757540Smuller 			 */
45857540Smuller 			Yflag = 1;
45957540Smuller 			flg |= CYF;
46057540Smuller 			break;
46157196Smuller 		case 'Z':
46257196Smuller 			/*
46357540Smuller 			 * On extraction check modification time after the
46457540Smuller 			 * modification of the file name. Non standard option.
46557196Smuller 			 */
46657196Smuller 			Zflag = 1;
46757196Smuller 			flg |= CZF;
46857196Smuller 			break;
46957196Smuller 		case '?':
47057196Smuller 		default:
471*66890Sbostic 			pax_usage();
47257196Smuller 			break;
47357196Smuller 		}
47457196Smuller 	}
47557196Smuller 
47657196Smuller 	/*
47757196Smuller 	 * figure out the operation mode of pax read,write,extract,copy,append
47857196Smuller 	 * or list. check that we have not been given a bogus set of flags
47957196Smuller 	 * for the operation mode.
48057196Smuller 	 */
48157196Smuller 	if (ISLIST(flg)) {
48257196Smuller 		act = LIST;
48357196Smuller 		bflg = flg & BDLIST;
48457196Smuller 	} else if (ISEXTRACT(flg)) {
48557196Smuller 		act = EXTRACT;
48657196Smuller 		bflg = flg & BDEXTR;
48757196Smuller 	} else if (ISARCHIVE(flg)) {
48857196Smuller 		act = ARCHIVE;
48957196Smuller 		bflg = flg & BDARCH;
49057196Smuller 	} else if (ISAPPND(flg)) {
49157196Smuller 		act = APPND;
49257196Smuller 		bflg = flg & BDARCH;
49357196Smuller 	} else if (ISCOPY(flg)) {
49457196Smuller 		act = COPY;
49557196Smuller 		bflg = flg & BDCOPY;
49657196Smuller 	} else
497*66890Sbostic 		pax_usage();
49857196Smuller 	if (bflg) {
49957196Smuller 		printflg(flg);
500*66890Sbostic 		pax_usage();
50157196Smuller 	}
50257196Smuller 
50357196Smuller 	/*
50457196Smuller 	 * if we are writing (ARCHIVE) we use the default format if the user
50557196Smuller 	 * did not specify a format. when we write during an APPEND, we will
50657196Smuller 	 * adopt the format of the existing archive if none was supplied.
50757196Smuller 	 */
50857196Smuller 	if (!(flg & XF) && (act == ARCHIVE))
50957196Smuller 		frmt = &(fsub[DEFLT]);
51057196Smuller 
51157196Smuller 	/*
51257196Smuller 	 * process the args as they are interpreted by the operation mode
51357196Smuller 	 */
51457196Smuller 	switch (act) {
51557196Smuller 	case LIST:
51657196Smuller 	case EXTRACT:
51757196Smuller 		for (; optind < argc; optind++)
51857196Smuller 			if (pat_add(argv[optind]) < 0)
519*66890Sbostic 				pax_usage();
52057196Smuller 		break;
52157196Smuller 	case COPY:
52257196Smuller 		if (optind >= argc) {
52357196Smuller 			warn(0, "Destination directory was not supplied");
524*66890Sbostic 			pax_usage();
52557196Smuller 		}
52657196Smuller 		--argc;
52757196Smuller 		dirptr = argv[argc];
52857196Smuller 		/* FALL THROUGH */
52957196Smuller 	case ARCHIVE:
53057196Smuller 	case APPND:
53157196Smuller 		for (; optind < argc; optind++)
53257196Smuller 			if (ftree_add(argv[optind]) < 0)
533*66890Sbostic 				pax_usage();
53457196Smuller 		/*
53557196Smuller 		 * no read errors allowed on updates/append operation!
53657196Smuller 		 */
53757196Smuller 		maxflt = 0;
53857196Smuller 		break;
53957196Smuller 	}
54057196Smuller }
54157196Smuller 
542*66890Sbostic 
54357196Smuller /*
544*66890Sbostic  * tar_options()
545*66890Sbostic  *	look at the user specified flags. set globals as required and check if
546*66890Sbostic  *	the user specified a legal set of flags. If not, complain and exit
547*66890Sbostic  */
548*66890Sbostic 
549*66890Sbostic #if __STDC__
550*66890Sbostic static void
tar_options(register int argc,register char ** argv)551*66890Sbostic tar_options(register int argc, register char **argv)
552*66890Sbostic #else
553*66890Sbostic static void
554*66890Sbostic tar_options(argc, argv)
555*66890Sbostic 	register int argc;
556*66890Sbostic 	register char **argv;
557*66890Sbostic #endif
558*66890Sbostic {
559*66890Sbostic 	register char *cp;
560*66890Sbostic 	int fstdin = 0;
561*66890Sbostic 
562*66890Sbostic 	if (argc < 2)
563*66890Sbostic 		tar_usage();
564*66890Sbostic 	/*
565*66890Sbostic 	 * process option flags
566*66890Sbostic 	 */
567*66890Sbostic 	++argv;
568*66890Sbostic 	for (cp = *argv++; *cp != '\0'; ++cp) {
569*66890Sbostic 		switch (*cp) {
570*66890Sbostic 		case '-':
571*66890Sbostic 			/*
572*66890Sbostic 			 * skip over -
573*66890Sbostic 			 */
574*66890Sbostic 			break;
575*66890Sbostic 		case 'b':
576*66890Sbostic 			/*
577*66890Sbostic 			 * specify blocksize
578*66890Sbostic 			 */
579*66890Sbostic 			if (*argv == (char *)NULL) {
580*66890Sbostic 				warn(1,"blocksize must be specified with 'b'");
581*66890Sbostic 				tar_usage();
582*66890Sbostic 			}
583*66890Sbostic 			if ((wrblksz = (int)str_offt(*argv)) <= 0) {
584*66890Sbostic 				warn(1, "Invalid block size %s", *argv);
585*66890Sbostic 				tar_usage();
586*66890Sbostic 			}
587*66890Sbostic 			++argv;
588*66890Sbostic 			break;
589*66890Sbostic 		case 'c':
590*66890Sbostic 			/*
591*66890Sbostic 			 * create an archive
592*66890Sbostic 			 */
593*66890Sbostic 			act = ARCHIVE;
594*66890Sbostic 			break;
595*66890Sbostic 		case 'e':
596*66890Sbostic 			/*
597*66890Sbostic 			 * stop after first error
598*66890Sbostic 			 */
599*66890Sbostic 			maxflt = 0;
600*66890Sbostic 			break;
601*66890Sbostic 		case 'f':
602*66890Sbostic 			/*
603*66890Sbostic 			 * filename where the archive is stored
604*66890Sbostic 			 */
605*66890Sbostic 			if (*argv == (char *)NULL) {
606*66890Sbostic 				warn(1, "filename must be specified with 'f'");
607*66890Sbostic 				tar_usage();
608*66890Sbostic 			}
609*66890Sbostic 			if ((argv[0][0] == '-') && (argv[0][1]== '\0')) {
610*66890Sbostic 				/*
611*66890Sbostic 				 * treat a - as stdin
612*66890Sbostic 				 */
613*66890Sbostic 				++argv;
614*66890Sbostic 				++fstdin;
615*66890Sbostic 				arcname = (char *)0;
616*66890Sbostic 				break;
617*66890Sbostic 			}
618*66890Sbostic 			fstdin = 0;
619*66890Sbostic 			arcname = *argv++;
620*66890Sbostic 			break;
621*66890Sbostic 		case 'm':
622*66890Sbostic 			/*
623*66890Sbostic 			 * do not preserve modification time
624*66890Sbostic 			 */
625*66890Sbostic 			pmtime = 0;
626*66890Sbostic 			break;
627*66890Sbostic 		case 'o':
628*66890Sbostic 			if (opt_add("write_opt=nodir") < 0)
629*66890Sbostic 				tar_usage();
630*66890Sbostic 			break;
631*66890Sbostic 		case 'p':
632*66890Sbostic 			/*
633*66890Sbostic 			 * preserve user id, group id, file
634*66890Sbostic 			 * mode, access/modification times
635*66890Sbostic 			 */
636*66890Sbostic 			pids = 1;
637*66890Sbostic 			pmode = 1;
638*66890Sbostic 			patime = 1;
639*66890Sbostic 			pmtime = 1;
640*66890Sbostic 			break;
641*66890Sbostic 		case 'r':
642*66890Sbostic 		case 'u':
643*66890Sbostic 			/*
644*66890Sbostic 			 * append to the archive
645*66890Sbostic 			 */
646*66890Sbostic 			act = APPND;
647*66890Sbostic 			break;
648*66890Sbostic 		case 't':
649*66890Sbostic 			/*
650*66890Sbostic 			 * list contents of the tape
651*66890Sbostic 			 */
652*66890Sbostic 			act = LIST;
653*66890Sbostic 			break;
654*66890Sbostic 		case 'v':
655*66890Sbostic 			/*
656*66890Sbostic 			 * verbose operation mode
657*66890Sbostic 			 */
658*66890Sbostic 			vflag = 1;
659*66890Sbostic 			break;
660*66890Sbostic 		case 'w':
661*66890Sbostic 			/*
662*66890Sbostic 			 * interactive file rename
663*66890Sbostic 			 */
664*66890Sbostic 			iflag = 1;
665*66890Sbostic 			break;
666*66890Sbostic 		case 'x':
667*66890Sbostic 			/*
668*66890Sbostic 			 * write an archive
669*66890Sbostic 			 */
670*66890Sbostic 			act = EXTRACT;
671*66890Sbostic 			break;
672*66890Sbostic 		case 'B':
673*66890Sbostic 			/*
674*66890Sbostic 			 * Nothing to do here, this is pax default
675*66890Sbostic 			 */
676*66890Sbostic 			break;
677*66890Sbostic 		case 'H':
678*66890Sbostic 			/*
679*66890Sbostic 			 * follow command line symlinks only
680*66890Sbostic 			 */
681*66890Sbostic 			Hflag = 1;
682*66890Sbostic 			break;
683*66890Sbostic 		case 'L':
684*66890Sbostic 			/*
685*66890Sbostic 			 * follow symlinks
686*66890Sbostic 			 */
687*66890Sbostic 			Lflag = 1;
688*66890Sbostic 			break;
689*66890Sbostic 		case 'P':
690*66890Sbostic 			/*
691*66890Sbostic 			 * do not follow symlinks
692*66890Sbostic 			 */
693*66890Sbostic 			Lflag = 0;
694*66890Sbostic 			break;
695*66890Sbostic 		case 'X':
696*66890Sbostic 			/*
697*66890Sbostic 			 * do not pass over mount points in the file system
698*66890Sbostic 			 */
699*66890Sbostic 			Xflag = 1;
700*66890Sbostic 			break;
701*66890Sbostic 		case '0':
702*66890Sbostic 			arcname = DEV_0;
703*66890Sbostic 			break;
704*66890Sbostic 		case '1':
705*66890Sbostic 			arcname = DEV_1;
706*66890Sbostic 			break;
707*66890Sbostic 		case '4':
708*66890Sbostic 			arcname = DEV_4;
709*66890Sbostic 			break;
710*66890Sbostic 		case '5':
711*66890Sbostic 			arcname = DEV_5;
712*66890Sbostic 			break;
713*66890Sbostic 		case '7':
714*66890Sbostic 			arcname = DEV_7;
715*66890Sbostic 			break;
716*66890Sbostic 		case '8':
717*66890Sbostic 			arcname = DEV_8;
718*66890Sbostic 			break;
719*66890Sbostic 		default:
720*66890Sbostic 			tar_usage();
721*66890Sbostic 			break;
722*66890Sbostic 		}
723*66890Sbostic 	}
724*66890Sbostic 
725*66890Sbostic 	/*
726*66890Sbostic 	 * if we are writing (ARCHIVE) specify tar, otherwise run like pax
727*66890Sbostic 	 */
728*66890Sbostic 	if (act == ARCHIVE)
729*66890Sbostic 		frmt = &(fsub[F_TAR]);
730*66890Sbostic 
731*66890Sbostic 	/*
732*66890Sbostic 	 * process the args as they are interpreted by the operation mode
733*66890Sbostic 	 */
734*66890Sbostic 	switch (act) {
735*66890Sbostic 	case LIST:
736*66890Sbostic 	case EXTRACT:
737*66890Sbostic 	default:
738*66890Sbostic 		while (*argv != (char *)NULL)
739*66890Sbostic 			if (pat_add(*argv++) < 0)
740*66890Sbostic 				tar_usage();
741*66890Sbostic 		break;
742*66890Sbostic 	case ARCHIVE:
743*66890Sbostic 	case APPND:
744*66890Sbostic 		while (*argv != (char *)NULL)
745*66890Sbostic 			if (ftree_add(*argv++) < 0)
746*66890Sbostic 				tar_usage();
747*66890Sbostic 		/*
748*66890Sbostic 		 * no read errors allowed on updates/append operation!
749*66890Sbostic 		 */
750*66890Sbostic 		maxflt = 0;
751*66890Sbostic 		break;
752*66890Sbostic 	}
753*66890Sbostic 	if (!fstdin && ((arcname == (char *)NULL) || (*arcname == '\0'))) {
754*66890Sbostic 		arcname = getenv("TAPE");
755*66890Sbostic 		if ((arcname == (char *)NULL) || (*arcname == '\0'))
756*66890Sbostic 			arcname = DEV_8;
757*66890Sbostic 	}
758*66890Sbostic }
759*66890Sbostic 
760*66890Sbostic #ifdef notdef
761*66890Sbostic /*
762*66890Sbostic  * cpio_options()
763*66890Sbostic  *	look at the user specified flags. set globals as required and check if
764*66890Sbostic  *	the user specified a legal set of flags. If not, complain and exit
765*66890Sbostic  */
766*66890Sbostic 
767*66890Sbostic #if __STDC__
768*66890Sbostic static void
cpio_options(register int argc,register char ** argv)769*66890Sbostic cpio_options(register int argc, register char **argv)
770*66890Sbostic #else
771*66890Sbostic static void
772*66890Sbostic cpio_options(argc, argv)
773*66890Sbostic 	register int argc;
774*66890Sbostic 	register char **argv;
775*66890Sbostic #endif
776*66890Sbostic {
777*66890Sbostic }
778*66890Sbostic #endif
779*66890Sbostic 
780*66890Sbostic /*
78157196Smuller  * printflg()
78257196Smuller  *	print out those invalid flag sets found to the user
78357196Smuller  */
78457196Smuller 
78557196Smuller #if __STDC__
78657196Smuller static void
printflg(unsigned int flg)78757196Smuller printflg(unsigned int flg)
78857196Smuller #else
78957196Smuller static void
79057196Smuller printflg(flg)
79157196Smuller 	unsigned int flg;
79257196Smuller #endif
79357196Smuller {
79457196Smuller 	int nxt;
79557196Smuller 	int pos = 0;
79657196Smuller 
797*66890Sbostic 	(void)fprintf(stderr,"%s: Invalid combination of options:", argv0);
79857196Smuller 	while (nxt = ffs(flg)) {
79957196Smuller 		flg = flg >> nxt;
80057196Smuller 		pos += nxt;
80157196Smuller 		(void)fprintf(stderr, " -%c", flgch[pos-1]);
80257196Smuller 	}
80357196Smuller 	(void)putc('\n', stderr);
80457196Smuller }
80557196Smuller 
80657196Smuller /*
80757196Smuller  * c_frmt()
80857196Smuller  *	comparison routine used by bsearch to find the format specified
80957196Smuller  *	by the user
81057196Smuller  */
81157196Smuller 
81257196Smuller #if __STDC__
81357196Smuller static int
c_frmt(const void * a,const void * b)81457196Smuller c_frmt(const void *a, const void *b)
81557196Smuller #else
81657196Smuller static int
81757196Smuller c_frmt(a, b)
81857196Smuller         void *a;
81957196Smuller         void *b;
82057196Smuller #endif
82157196Smuller {
82257196Smuller         return(strcmp(((FSUB *)a)->name, ((FSUB *)b)->name));
82357196Smuller }
82457196Smuller 
82557196Smuller /*
82657196Smuller  * opt_next()
82757196Smuller  *	called by format specific options routines to get each format specific
82857196Smuller  *	flag and value specified with -o
82957196Smuller  * Return:
83057196Smuller  *	pointer to next OPLIST entry or NULL (end of list).
83157196Smuller  */
83257196Smuller 
83357196Smuller #if __STDC__
83457196Smuller OPLIST *
opt_next(void)83557196Smuller opt_next(void)
83657196Smuller #else
83757196Smuller OPLIST *
83857196Smuller opt_next()
83957196Smuller #endif
84057196Smuller {
84157196Smuller 	OPLIST *opt;
84257196Smuller 
84357196Smuller 	if ((opt = ophead) != NULL)
84457196Smuller 		ophead = ophead->fow;
84557196Smuller 	return(opt);
84657196Smuller }
84757196Smuller 
84857196Smuller /*
84957196Smuller  * bad_opt()
85057196Smuller  *	generic routine used to complain about a format specific options
85157196Smuller  *	when the format does not support options.
85257196Smuller  */
85357196Smuller 
85457196Smuller #if __STDC__
85557196Smuller int
bad_opt(void)85657196Smuller bad_opt(void)
85757196Smuller #else
85857196Smuller int
85957196Smuller bad_opt()
86057196Smuller #endif
86157196Smuller {
86257196Smuller 	register OPLIST *opt;
86357196Smuller 
86457196Smuller 	if (ophead == NULL)
86557196Smuller 		return(0);
86657196Smuller 	/*
86757196Smuller 	 * print all we were given
86857196Smuller 	 */
86957196Smuller 	warn(1,"These format options are not supported");
87057196Smuller 	while ((opt = opt_next()) != NULL)
87157196Smuller 		(void)fprintf(stderr, "\t%s = %s\n", opt->name, opt->value);
872*66890Sbostic 	pax_usage();
87357196Smuller 	return(0);
87457196Smuller }
87557196Smuller 
87657196Smuller /*
87757196Smuller  * opt_add()
87857196Smuller  *	breaks the value supplied to -o into a option name and value. options
87957196Smuller  *	are given to -o in the form -o name-value,name=value
88057196Smuller  *	mulltiple -o may be specified.
88157196Smuller  * Return:
88257196Smuller  *	0 if format in name=value format, -1 if -o is passed junk
88357196Smuller  */
88457196Smuller 
88557196Smuller #if __STDC__
88657196Smuller int
opt_add(register char * str)88757196Smuller opt_add(register char *str)
88857196Smuller #else
88957196Smuller int
89057196Smuller opt_add(str)
89157196Smuller 	register char *str;
89257196Smuller #endif
89357196Smuller {
89457196Smuller 	register OPLIST *opt;
89557196Smuller 	register char *frpt;
89657196Smuller 	register char *pt;
89757196Smuller 	register char *endpt;
89857196Smuller 
89957196Smuller 	if ((str == NULL) || (*str == '\0')) {
90057196Smuller 		warn(0, "Invalid option name");
90157196Smuller 		return(-1);
90257196Smuller 	}
90357196Smuller 	frpt = endpt = str;
90457196Smuller 
90557196Smuller 	/*
90657196Smuller 	 * break into name and values pieces and stuff each one into a
90757196Smuller 	 * OPLIST structure. When we know the format, the format specific
90857196Smuller 	 * option function will go through this list
90957196Smuller 	 */
91057196Smuller 	while ((frpt != NULL) && (*frpt != '\0')) {
91157196Smuller 		if ((endpt = strchr(frpt, ',')) != NULL)
91257196Smuller 			*endpt = '\0';
91357196Smuller 		if ((pt = strchr(frpt, '=')) == NULL) {
91457196Smuller 			warn(0, "Invalid options format");
91557196Smuller 			return(-1);
91657196Smuller 		}
91757196Smuller 		if ((opt = (OPLIST *)malloc(sizeof(OPLIST))) == NULL) {
91857196Smuller 			warn(0, "Unable to allocate space for option list");
91957196Smuller 			return(-1);
92057196Smuller 		}
92157196Smuller 		*pt++ = '\0';
92257196Smuller 		opt->name = frpt;
92357196Smuller 		opt->value = pt;
92457196Smuller 		opt->fow = NULL;
92557196Smuller 		if (endpt != NULL)
92657196Smuller 			frpt = endpt + 1;
92757196Smuller 		else
92857196Smuller 			frpt = NULL;
92957196Smuller 		if (ophead == NULL) {
93057196Smuller 			optail = ophead = opt;
93157196Smuller 			continue;
93257196Smuller 		}
93357196Smuller 		optail->fow = opt;
93457196Smuller 		optail = opt;
93557196Smuller 	}
93657196Smuller 	return(0);
93757196Smuller }
93857196Smuller 
93957196Smuller /*
94057196Smuller  * str_offt()
94157196Smuller  *	Convert an expression of the following forms to an off_t > 0.
94257196Smuller  * 	1) A positive decimal number.
94357196Smuller  *	2) A positive decimal number followed by a b (mult by 512).
94457196Smuller  *	3) A positive decimal number followed by a k (mult by 1024).
94557196Smuller  *	4) A positive decimal number followed by a m (mult by 512).
94657196Smuller  *	5) A positive decimal number followed by a w (mult by sizeof int)
94757196Smuller  *	6) Two or more positive decimal numbers (with/without k,b or w).
94857196Smuller  *	   seperated by x (also * for backwards compatibility), specifying
94957196Smuller  *	   the product of the indicated values.
95057196Smuller  * Return:
95157196Smuller  *	0 for an error, a positive value o.w.
95257196Smuller  */
95357196Smuller 
95457196Smuller #if __STDC__
95557196Smuller static off_t
str_offt(char * val)95657196Smuller str_offt(char *val)
95757196Smuller #else
95857196Smuller static off_t
95957196Smuller str_offt(val)
96057196Smuller 	char *val;
96157196Smuller #endif
96257196Smuller {
96357196Smuller 	char *expr;
96457196Smuller 	off_t num, t;
96557196Smuller 
96657196Smuller #	ifdef NET2_STAT
96757196Smuller 	num = strtol(val, &expr, 0);
96857196Smuller 	if ((num == LONG_MAX) || (num <= 0) || (expr == val))
96957196Smuller #	else
97057196Smuller 	num = strtoq(val, &expr, 0);
97157196Smuller 	if ((num == QUAD_MAX) || (num <= 0) || (expr == val))
97257196Smuller #	endif
97357196Smuller 		return(0);
97457196Smuller 
97557196Smuller 	switch(*expr) {
97657196Smuller 	case 'b':
97757196Smuller 		t = num;
97857196Smuller 		num *= 512;
97957196Smuller 		if (t > num)
98057196Smuller 			return(0);
98157196Smuller 		++expr;
98257196Smuller 		break;
98357196Smuller 	case 'k':
98457196Smuller 		t = num;
98557196Smuller 		num *= 1024;
98657196Smuller 		if (t > num)
98757196Smuller 			return(0);
98857196Smuller 		++expr;
98957196Smuller 		break;
99057196Smuller 	case 'm':
99157196Smuller 		t = num;
99257196Smuller 		num *= 1048576;
99357196Smuller 		if (t > num)
99457196Smuller 			return(0);
99557196Smuller 		++expr;
99657196Smuller 		break;
99757196Smuller 	case 'w':
99857196Smuller 		t = num;
99957196Smuller 		num *= sizeof(int);
100057196Smuller 		if (t > num)
100157196Smuller 			return(0);
100257196Smuller 		++expr;
100357196Smuller 		break;
100457196Smuller 	}
100557196Smuller 
100657196Smuller 	switch(*expr) {
100757196Smuller 		case '\0':
100857196Smuller 			break;
100957196Smuller 		case '*':
101057196Smuller 		case 'x':
101157196Smuller 			t = num;
101257196Smuller 			num *= str_offt(expr + 1);
101357196Smuller 			if (t > num)
101457196Smuller 				return(0);
101557196Smuller 			break;
101657196Smuller 		default:
101757196Smuller 			return(0);
101857196Smuller 	}
101957196Smuller 	return(num);
102057196Smuller }
102157196Smuller 
102257196Smuller /*
102357196Smuller  * no_op()
102457196Smuller  *	for those option functions where the archive format has nothing to do.
102557196Smuller  * Return:
102657196Smuller  *	0
102757196Smuller  */
102857196Smuller 
102957196Smuller #if __STDC__
103057196Smuller static int
no_op(void)103157196Smuller no_op(void)
103257196Smuller #else
103357196Smuller static int
103457196Smuller no_op()
103557196Smuller #endif
103657196Smuller {
103757196Smuller 	return(0);
103857196Smuller }
1039*66890Sbostic 
1040*66890Sbostic /*
1041*66890Sbostic  * pax_usage()
1042*66890Sbostic  *	print the usage summary to the user
1043*66890Sbostic  */
1044*66890Sbostic 
1045*66890Sbostic #if __STDC__
1046*66890Sbostic void
pax_usage(void)1047*66890Sbostic pax_usage(void)
1048*66890Sbostic #else
1049*66890Sbostic void
1050*66890Sbostic pax_usage()
1051*66890Sbostic #endif
1052*66890Sbostic {
1053*66890Sbostic 	(void)fputs("usage: pax [-cdnv] [-E limit] [-f archive] ", stderr);
1054*66890Sbostic 	(void)fputs("[-s replstr] ... [-U user] ...", stderr);
1055*66890Sbostic 	(void)fputs("\n           [-G group] ... ", stderr);
1056*66890Sbostic 	(void)fputs("[-T [from_date][,to_date]] ... ", stderr);
1057*66890Sbostic 	(void)fputs("[pattern ...]\n", stderr);
1058*66890Sbostic 	(void)fputs("       pax -r [-cdiknuvDYZ] [-E limit] ", stderr);
1059*66890Sbostic 	(void)fputs("[-f archive] [-o options] ... \n", stderr);
1060*66890Sbostic 	(void)fputs("           [-p string] ... [-s replstr] ... ", stderr);
1061*66890Sbostic 	(void)fputs("[-U user] ... [-G group] ...\n           ", stderr);
1062*66890Sbostic 	(void)fputs("[-T [from_date][,to_date]] ... ", stderr);
1063*66890Sbostic 	(void)fputs(" [pattern ...]\n", stderr);
1064*66890Sbostic 	(void)fputs("       pax -w [-dituvHLPX] [-b blocksize] ", stderr);
1065*66890Sbostic 	(void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr);
1066*66890Sbostic 	(void)fputs("           [-B bytes] [-s replstr] ... ", stderr);
1067*66890Sbostic 	(void)fputs("[-o options] ... [-U user] ...", stderr);
1068*66890Sbostic 	(void)fputs("\n           [-G group] ... ", stderr);
1069*66890Sbostic 	(void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
1070*66890Sbostic 	(void)fputs("[file ...]\n", stderr);
1071*66890Sbostic 	(void)fputs("       pax -r -w [-diklntuvDHLPXYZ] ", stderr);
1072*66890Sbostic 	(void)fputs("[-p string] ... [-s replstr] ...", stderr);
1073*66890Sbostic 	(void)fputs("\n           [-U user] ... [-G group] ... ", stderr);
1074*66890Sbostic 	(void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
1075*66890Sbostic 	(void)fputs("\n           [file ...] directory\n", stderr);
1076*66890Sbostic 	exit(1);
1077*66890Sbostic }
1078*66890Sbostic 
1079*66890Sbostic /*
1080*66890Sbostic  * tar_usage()
1081*66890Sbostic  *	print the usage summary to the user
1082*66890Sbostic  */
1083*66890Sbostic 
1084*66890Sbostic #if __STDC__
1085*66890Sbostic void
tar_usage(void)1086*66890Sbostic tar_usage(void)
1087*66890Sbostic #else
1088*66890Sbostic void
1089*66890Sbostic tar_usage()
1090*66890Sbostic #endif
1091*66890Sbostic {
1092*66890Sbostic 	(void)fputs("usage: tar -{txru}[cevfbmopwBHLPX014578] [tapefile] ",
1093*66890Sbostic 		 stderr);
1094*66890Sbostic 	(void)fputs("[blocksize] file1 file2...\n", stderr);
1095*66890Sbostic 	exit(1);
1096*66890Sbostic }
1097*66890Sbostic 
1098*66890Sbostic #ifdef notdef
1099*66890Sbostic /*
1100*66890Sbostic  * cpio_usage()
1101*66890Sbostic  *	print the usage summary to the user
1102*66890Sbostic  */
1103*66890Sbostic 
1104*66890Sbostic #if __STDC__
1105*66890Sbostic void
cpio_usage(void)1106*66890Sbostic cpio_usage(void)
1107*66890Sbostic #else
1108*66890Sbostic void
1109*66890Sbostic cpio_usage()
1110*66890Sbostic #endif
1111*66890Sbostic {
1112*66890Sbostic 	exit(1);
1113*66890Sbostic }
1114*66890Sbostic #endif
1115