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