14b88c807SRodney W. Grimes /*- 2*8a16b7a1SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 3*8a16b7a1SPedro F. Giffuni * 44b88c807SRodney W. Grimes * Copyright (c) 1992 Keith Muller. 54b88c807SRodney W. Grimes * Copyright (c) 1992, 1993 64b88c807SRodney W. Grimes * The Regents of the University of California. All rights reserved. 74b88c807SRodney W. Grimes * 84b88c807SRodney W. Grimes * This code is derived from software contributed to Berkeley by 94b88c807SRodney W. Grimes * Keith Muller of the University of California, San Diego. 104b88c807SRodney W. Grimes * 114b88c807SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 124b88c807SRodney W. Grimes * modification, are permitted provided that the following conditions 134b88c807SRodney W. Grimes * are met: 144b88c807SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 154b88c807SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 164b88c807SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 174b88c807SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 184b88c807SRodney W. Grimes * documentation and/or other materials provided with the distribution. 19fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 204b88c807SRodney W. Grimes * may be used to endorse or promote products derived from this software 214b88c807SRodney W. Grimes * without specific prior written permission. 224b88c807SRodney W. Grimes * 234b88c807SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 244b88c807SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 254b88c807SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 264b88c807SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 274b88c807SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 284b88c807SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 294b88c807SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 304b88c807SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 314b88c807SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 324b88c807SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 334b88c807SRodney W. Grimes * SUCH DAMAGE. 344b88c807SRodney W. Grimes */ 354b88c807SRodney W. Grimes 364b88c807SRodney W. Grimes /* 374b88c807SRodney W. Grimes * argv[0] names. Used for tar and cpio emulation 384b88c807SRodney W. Grimes */ 394b88c807SRodney W. Grimes 404b88c807SRodney W. Grimes #define NM_TAR "tar" 414b88c807SRodney W. Grimes #define NM_CPIO "cpio" 424b88c807SRodney W. Grimes #define NM_PAX "pax" 434b88c807SRodney W. Grimes 444b88c807SRodney W. Grimes /* 454b88c807SRodney W. Grimes * Constants used to specify the legal sets of flags in pax. For each major 464b88c807SRodney W. Grimes * operation mode of pax, a set of illegal flags is defined. If any one of 474b88c807SRodney W. Grimes * those illegal flags are found set, we scream and exit 484b88c807SRodney W. Grimes */ 494b88c807SRodney W. Grimes #define NONE "none" 504b88c807SRodney W. Grimes 514b88c807SRodney W. Grimes /* 524b88c807SRodney W. Grimes * flags (one for each option). 534b88c807SRodney W. Grimes */ 544b88c807SRodney W. Grimes #define AF 0x00000001 554b88c807SRodney W. Grimes #define BF 0x00000002 564b88c807SRodney W. Grimes #define CF 0x00000004 574b88c807SRodney W. Grimes #define DF 0x00000008 584b88c807SRodney W. Grimes #define FF 0x00000010 594b88c807SRodney W. Grimes #define IF 0x00000020 604b88c807SRodney W. Grimes #define KF 0x00000040 614b88c807SRodney W. Grimes #define LF 0x00000080 624b88c807SRodney W. Grimes #define NF 0x00000100 634b88c807SRodney W. Grimes #define OF 0x00000200 644b88c807SRodney W. Grimes #define PF 0x00000400 654b88c807SRodney W. Grimes #define RF 0x00000800 664b88c807SRodney W. Grimes #define SF 0x00001000 674b88c807SRodney W. Grimes #define TF 0x00002000 684b88c807SRodney W. Grimes #define UF 0x00004000 694b88c807SRodney W. Grimes #define VF 0x00008000 704b88c807SRodney W. Grimes #define WF 0x00010000 714b88c807SRodney W. Grimes #define XF 0x00020000 724b88c807SRodney W. Grimes #define CBF 0x00040000 /* nonstandard extension */ 734b88c807SRodney W. Grimes #define CDF 0x00080000 /* nonstandard extension */ 744b88c807SRodney W. Grimes #define CEF 0x00100000 /* nonstandard extension */ 754b88c807SRodney W. Grimes #define CGF 0x00200000 /* nonstandard extension */ 764b88c807SRodney W. Grimes #define CHF 0x00400000 /* nonstandard extension */ 774b88c807SRodney W. Grimes #define CLF 0x00800000 /* nonstandard extension */ 784b88c807SRodney W. Grimes #define CPF 0x01000000 /* nonstandard extension */ 794b88c807SRodney W. Grimes #define CTF 0x02000000 /* nonstandard extension */ 804b88c807SRodney W. Grimes #define CUF 0x04000000 /* nonstandard extension */ 814b88c807SRodney W. Grimes #define CXF 0x08000000 824b88c807SRodney W. Grimes #define CYF 0x10000000 /* nonstandard extension */ 834b88c807SRodney W. Grimes #define CZF 0x20000000 /* nonstandard extension */ 844b88c807SRodney W. Grimes 854b88c807SRodney W. Grimes /* 864b88c807SRodney W. Grimes * ascii string indexed by bit position above (alter the above and you must 874b88c807SRodney W. Grimes * alter this string) used to tell the user what flags caused us to complain 884b88c807SRodney W. Grimes */ 894b88c807SRodney W. Grimes #define FLGCH "abcdfiklnoprstuvwxBDEGHLPTUXYZ" 904b88c807SRodney W. Grimes 914b88c807SRodney W. Grimes /* 924b88c807SRodney W. Grimes * legal pax operation bit patterns 934b88c807SRodney W. Grimes */ 944b88c807SRodney W. Grimes 954b88c807SRodney W. Grimes #define ISLIST(x) (((x) & (RF|WF)) == 0) 964b88c807SRodney W. Grimes #define ISEXTRACT(x) (((x) & (RF|WF)) == RF) 974b88c807SRodney W. Grimes #define ISARCHIVE(x) (((x) & (AF|RF|WF)) == WF) 984b88c807SRodney W. Grimes #define ISAPPND(x) (((x) & (AF|RF|WF)) == (AF|WF)) 994b88c807SRodney W. Grimes #define ISCOPY(x) (((x) & (RF|WF)) == (RF|WF)) 1004b88c807SRodney W. Grimes #define ISWRITE(x) (((x) & (RF|WF)) == WF) 1014b88c807SRodney W. Grimes 1024b88c807SRodney W. Grimes /* 1034b88c807SRodney W. Grimes * Illegal option flag subsets based on pax operation 1044b88c807SRodney W. Grimes */ 1054b88c807SRodney W. Grimes 1064b88c807SRodney W. Grimes #define BDEXTR (AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CPF|CXF) 1074b88c807SRodney W. Grimes #define BDARCH (CF|KF|LF|NF|PF|RF|CDF|CEF|CYF|CZF) 1084b88c807SRodney W. Grimes #define BDCOPY (AF|BF|FF|OF|XF|CBF|CEF) 1094b88c807SRodney W. Grimes #define BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CPF|CXF|CYF|CZF) 110