Home | History | Annotate | Line # | Download | only in pax
      1 /*	$NetBSD: options.h,v 1.11 2007/04/23 18:40:22 christos Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1992 Keith Muller.
      5  * Copyright (c) 1992, 1993
      6  *	The Regents of the University of California.  All rights reserved.
      7  *
      8  * This code is derived from software contributed to Berkeley by
      9  * Keith Muller of the University of California, San Diego.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in the
     18  *    documentation and/or other materials provided with the distribution.
     19  * 3. Neither the name of the University nor the names of its contributors
     20  *    may be used to endorse or promote products derived from this software
     21  *    without specific prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  * SUCH DAMAGE.
     34  *
     35  *	@(#)options.h	8.2 (Berkeley) 4/18/94
     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 /* special value for -E */
     47 #define none	"none"
     48 
     49 /*
     50  * Constants used to specify the legal sets of flags in pax. For each major
     51  * operation mode of pax, a set of illegal flags is defined. If any one of
     52  * those illegal flags are found set, we scream and exit
     53  */
     54 
     55 /*
     56  * flags (one for each option).
     57  */
     58 #define AF	0x000000001ULL
     59 #define BF	0x000000002ULL
     60 #define CF	0x000000004ULL
     61 #define DF	0x000000008ULL
     62 #define FF	0x000000010ULL
     63 #define IF	0x000000020ULL
     64 #define KF	0x000000040ULL
     65 #define LF	0x000000080ULL
     66 #define NF	0x000000100ULL
     67 #define OF	0x000000200ULL
     68 #define PF	0x000000400ULL
     69 #define RF	0x000000800ULL
     70 #define SF	0x000001000ULL
     71 #define TF	0x000002000ULL
     72 #define UF	0x000004000ULL
     73 #define VF	0x000008000ULL
     74 #define WF	0x000010000ULL
     75 #define XF	0x000020000ULL
     76 #define CAF	0x000040000ULL	/* nonstandard extension */
     77 #define CBF	0x000080000ULL	/* nonstandard extension */
     78 #define CDF	0x000100000ULL	/* nonstandard extension */
     79 #define CEF	0x000200000ULL	/* nonstandard extension */
     80 #define CGF	0x000400000ULL	/* nonstandard extension */
     81 #define CHF	0x000800000ULL	/* nonstandard extension */
     82 #define CLF	0x001000000ULL	/* nonstandard extension */
     83 #define CMF	0x002000000ULL	/* nonstandard extension */
     84 #define CPF	0x004000000ULL	/* nonstandard extension */
     85 #define CTF	0x008000000ULL	/* nonstandard extension */
     86 #define CUF	0x010000000ULL	/* nonstandard extension */
     87 #define VSF	0x020000000ULL	/* non-standard */
     88 #define CXF	0x040000000ULL
     89 #define CYF	0x080000000ULL	/* nonstandard extension */
     90 #define CZF	0x100000000ULL	/* 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	"abcdfiklnoprstuvwxABDEGHLMPTUVXYZ"
     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|CMF|CPF|CXF)
    114 #define	BDARCH	(CF|KF|LF|NF|PF|RF|CDF|CEF|CYF|CZF)
    115 #define	BDCOPY	(AF|BF|FF|OF|XF|CAF|CBF|CEF)
    116 #define	BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CMF|CPF|CXF|CYF|CZF)
    117