/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1992 Keith Muller.4* Copyright (c) 1992, 19935* The Regents of the University of California. All rights reserved.6*7* This code is derived from software contributed to Berkeley by8* Keith Muller of the University of California, San Diego.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13* 1. Redistributions of source code must retain the above copyright14* notice, this list of conditions and the following disclaimer.15* 2. Redistributions in binary form must reproduce the above copyright16* notice, this list of conditions and the following disclaimer in the17* documentation and/or other materials provided with the distribution.18* 3. Neither the name of the University nor the names of its contributors19* may be used to endorse or promote products derived from this software20* without specific prior written permission.21*22* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND23* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE24* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE25* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE26* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL27* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS28* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)29* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT30* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY31* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF32* SUCH DAMAGE.33*/3435/*36* argv[0] names. Used for tar and cpio emulation37*/3839#define NM_TAR "tar"40#define NM_CPIO "cpio"41#define NM_PAX "pax"4243/*44* Constants used to specify the legal sets of flags in pax. For each major45* operation mode of pax, a set of illegal flags is defined. If any one of46* those illegal flags are found set, we scream and exit47*/48#define NONE "none"4950/*51* flags (one for each option).52*/53#define AF 0x0000000154#define BF 0x0000000255#define CF 0x0000000456#define DF 0x0000000857#define FF 0x0000001058#define IF 0x0000002059#define KF 0x0000004060#define LF 0x0000008061#define NF 0x0000010062#define OF 0x0000020063#define PF 0x0000040064#define RF 0x0000080065#define SF 0x0000100066#define TF 0x0000200067#define UF 0x0000400068#define VF 0x0000800069#define WF 0x0001000070#define XF 0x0002000071#define CBF 0x00040000 /* nonstandard extension */72#define CDF 0x00080000 /* nonstandard extension */73#define CEF 0x00100000 /* nonstandard extension */74#define CGF 0x00200000 /* nonstandard extension */75#define CHF 0x00400000 /* nonstandard extension */76#define CLF 0x00800000 /* nonstandard extension */77#define CPF 0x01000000 /* nonstandard extension */78#define CTF 0x02000000 /* nonstandard extension */79#define CUF 0x04000000 /* nonstandard extension */80#define CXF 0x0800000081#define CYF 0x10000000 /* nonstandard extension */82#define CZF 0x20000000 /* nonstandard extension */8384/*85* ascii string indexed by bit position above (alter the above and you must86* alter this string) used to tell the user what flags caused us to complain87*/88#define FLGCH "abcdfiklnoprstuvwxBDEGHLPTUXYZ"8990/*91* legal pax operation bit patterns92*/9394#define ISLIST(x) (((x) & (RF|WF)) == 0)95#define ISEXTRACT(x) (((x) & (RF|WF)) == RF)96#define ISARCHIVE(x) (((x) & (AF|RF|WF)) == WF)97#define ISAPPND(x) (((x) & (AF|RF|WF)) == (AF|WF))98#define ISCOPY(x) (((x) & (RF|WF)) == (RF|WF))99#define ISWRITE(x) (((x) & (RF|WF)) == WF)100101/*102* Illegal option flag subsets based on pax operation103*/104105#define BDEXTR (AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CPF|CXF)106#define BDARCH (CF|KF|LF|NF|PF|RF|CDF|CEF|CYF|CZF)107#define BDCOPY (AF|BF|FF|OF|XF|CBF|CEF)108#define BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CPF|CXF|CYF|CZF)109110111