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