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