1 /**	$MirOS: src/bin/pax/options.h,v 1.6 2011/08/16 13:45:01 tg Exp $ */
2 /*	$OpenBSD: options.h,v 1.4 2003/06/13 17:51:14 millert Exp $	*/
3 /*	$NetBSD: options.h,v 1.3 1995/03/21 09:07:32 cgd Exp $	*/
4 
5 /*-
6  * Copyright (c) 1992 Keith Muller.
7  * Copyright (c) 1992, 1993
8  *	The Regents of the University of California.  All rights reserved.
9  *
10  * This code is derived from software contributed to Berkeley by
11  * Keith Muller of the University of California, San Diego.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. 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.
24  *
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
35  * SUCH DAMAGE.
36  *
37  *	@(#)options.h	8.2 (Berkeley) 4/18/94
38  */
39 
40 /*
41  * argv[0] names. Used for tar and cpio emulation
42  */
43 
44 #define NM_TAR  "tar"
45 #define NM_CPIO "cpio"
46 #define NM_PAX  "pax"
47 
48 /*
49  * Constants used to specify the legal sets of flags in pax. For each major
50  * operation mode of pax, a set of illegal flags is defined. If any one of
51  * those illegal flags are found set, we scream and exit
52  */
53 #define NONE	"none"
54 
55 /*
56  * flags (one for each option).
57  */
58 #define	AF	0x00000001
59 #define	BF	0x00000002
60 #define	CF	0x00000004
61 #define	DF	0x00000008
62 #define	FF	0x00000010
63 #define	IF	0x00000020
64 #define	KF	0x00000040
65 #define	LF	0x00000080
66 #define	NF	0x00000100
67 #define	OF	0x00000200
68 #define	PF	0x00000400
69 #define	RF	0x00000800
70 #define	SF	0x00001000
71 #define	TF	0x00002000
72 #define	UF	0x00004000
73 #define	VF	0x00008000
74 #define	WF	0x00010000
75 #define	XF	0x00020000
76 #define	CBF	0x00040000	/* nonstandard extension */
77 #define	CDF	0x00080000	/* nonstandard extension */
78 #define	CEF	0x00100000	/* nonstandard extension */
79 #define	CGF	0x00200000	/* nonstandard extension */
80 #define	CHF	0x00400000	/* nonstandard extension */
81 #define	CLF	0x00800000	/* nonstandard extension */
82 #define	CPF	0x01000000	/* nonstandard extension */
83 #define	CTF	0x02000000	/* nonstandard extension */
84 #define	CUF	0x04000000	/* nonstandard extension */
85 #define	CXF	0x08000000
86 #define	CYF	0x10000000	/* nonstandard extension */
87 #define	CZF	0x20000000	/* nonstandard extension */
88 #define	C0F	0x40000000	/* nonstandard extension */
89 
90 /*
91  * ascii string indexed by bit position above (alter the above and you must
92  * alter this string) used to tell the user what flags caused us to complain
93  */
94 #define FLGCH	"abcdfiklnoprstuvwxBDEGHLPTUXYZ0"
95 
96 /*
97  * legal pax operation bit patterns
98  */
99 
100 #define ISLIST(x)	(((x) & (RF|WF)) == 0)
101 #define	ISEXTRACT(x)	(((x) & (RF|WF)) == RF)
102 #define ISARCHIVE(x)	(((x) & (AF|RF|WF)) == WF)
103 #define ISAPPND(x)	(((x) & (AF|RF|WF)) == (AF|WF))
104 #define	ISCOPY(x)	(((x) & (RF|WF)) == (RF|WF))
105 #define	ISWRITE(x)	(((x) & (RF|WF)) == WF)
106 
107 /*
108  * Illegal option flag subsets based on pax operation
109  */
110 
111 #define	BDEXTR	(AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CPF|CXF)
112 #define	BDARCH	(CF|KF|LF|NF|PF|RF|CDF|CEF|CYF|CZF)
113 #define	BDCOPY	(AF|BF|FF|OF|XF|CBF|CEF)
114 #define	BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CPF|CXF|CYF|CZF)
115 
116 /*
117  * Archive manipulation code
118  */
119 
120 #define	ANON_INODES	0x0001
121 #define	ANON_HARDLINKS	0x0002
122 #define	ANON_MTIME	0x0004
123 #define	ANON_UIDGID	0x0008
124 #define	ANON_VERBOSE	0x0010
125 #define	ANON_DEBUG	0x0020
126 #define	ANON_LNCP	0x0040
127 #define	ANON_NUMID	0x0080
128 #define	ANON_DIRSLASH	0x0100
129 #define	ANON_MAXVAL	0x01FF
130 extern int anonarch;
131 void anonarch_init(void);
132 
133 extern int to_stdout;
134