xref: /netbsd/bin/pax/options.h (revision bf9ec67e)
1 /*	$NetBSD: options.h,v 1.7 2001/10/25 08:51:51 lukem Exp $	*/
2 
3 /*-
4  * Copyright (c) 1992 Keith Muller.
5  * Copyright (c) 1992, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * Keith Muller of the University of California, San Diego.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. All advertising materials mentioning features or use of this software
20  *    must display the following acknowledgement:
21  *	This product includes software developed by the University of
22  *	California, Berkeley and its contributors.
23  * 4. Neither the name of the University nor the names of its contributors
24  *    may be used to endorse or promote products derived from this software
25  *    without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37  * SUCH DAMAGE.
38  *
39  *	@(#)options.h	8.2 (Berkeley) 4/18/94
40  */
41 
42 /*
43  * argv[0] names. Used for tar and cpio emulation
44  */
45 
46 #define NM_TAR  "tar"
47 #define NM_CPIO "cpio"
48 #define NM_PAX  "pax"
49 
50 /*
51  * Constants used to specify the legal sets of flags in pax. For each major
52  * operation mode of pax, a set of illegal flags is defined. If any one of
53  * those illegal flags are found set, we scream and exit
54  */
55 #define NONE	"none"
56 
57 /*
58  * flags (one for each option).
59  */
60 #define	AF	0x00000001
61 #define	BF	0x00000002
62 #define	CF	0x00000004
63 #define	DF	0x00000008
64 #define	FF	0x00000010
65 #define	IF	0x00000020
66 #define	KF	0x00000040
67 #define	LF	0x00000080
68 #define	NF	0x00000100
69 #define	OF	0x00000200
70 #define	PF	0x00000400
71 #define	RF	0x00000800
72 #define	SF	0x00001000
73 #define	TF	0x00002000
74 #define	UF	0x00004000
75 #define	VF	0x00008000
76 #define	WF	0x00010000
77 #define	XF	0x00020000
78 #define	CAF	0x00040000	/* nonstandard extension */
79 #define	CBF	0x00080000	/* nonstandard extension */
80 #define	CDF	0x00100000	/* nonstandard extension */
81 #define	CEF	0x00200000	/* nonstandard extension */
82 #define	CGF	0x00400000	/* nonstandard extension */
83 #define	CHF	0x00800000	/* nonstandard extension */
84 #define	CLF	0x01000000	/* nonstandard extension */
85 #define	CMF	0x02000000	/* nonstandard extension */
86 #define	CPF	0x04000000	/* nonstandard extension */
87 #define	CTF	0x08000000	/* nonstandard extension */
88 #define	CUF	0x10000000	/* nonstandard extension */
89 #define	CXF	0x20000000
90 #define	CYF	0x40000000	/* nonstandard extension */
91 #define	CZF	0x80000000	/* nonstandard extension */
92 
93 /*
94  * ascii string indexed by bit position above (alter the above and you must
95  * alter this string) used to tell the user what flags caused us to complain
96  */
97 #define FLGCH	"abcdfiklnoprstuvwxABDEGHLMPTUXYZ"
98 
99 /*
100  * legal pax operation bit patterns
101  */
102 
103 #define ISLIST(x)	(((x) & (RF|WF)) == 0)
104 #define	ISEXTRACT(x)	(((x) & (RF|WF)) == RF)
105 #define ISARCHIVE(x)	(((x) & (AF|RF|WF)) == WF)
106 #define ISAPPND(x)	(((x) & (AF|RF|WF)) == (AF|WF))
107 #define	ISCOPY(x)	(((x) & (RF|WF)) == (RF|WF))
108 #define	ISWRITE(x)	(((x) & (RF|WF)) == WF)
109 
110 /*
111  * Illegal option flag subsets based on pax operation
112  */
113 
114 #define	BDEXTR	(AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CMF|CPF|CXF)
115 #define	BDARCH	(CF|KF|LF|NF|PF|RF|CDF|CEF|CYF|CZF)
116 #define	BDCOPY	(AF|BF|FF|OF|XF|CAF|CBF|CEF)
117 #define	BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CMF|CPF|CXF|CYF|CZF)
118