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