xref: /titanic_41/usr/src/lib/libshell/common/data/options.c (revision 7a17cfad7ff3427e1ce7ecdbf566e442a7025ec9)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2009 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                  David Korn <dgk@research.att.com>                   *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 
22 #include	<defs.h>
23 #include	"FEATURE/options"
24 #include	"name.h"
25 #include	"shtable.h"
26 
27 #if SHOPT_BASH
28 #   define bashopt(a,b)		a,	b|SH_BASHOPT,
29 #   define bashextra(a,b)	a,	b|SH_BASHEXTRA,
30 #else
31 #   define bashopt(a,b)
32 #   define bashextra(a,b)
33 #endif
34 
35 /*
36  * This is the list of invocation and set options
37  * This list must be in in ascii sorted order
38  */
39 
40 const Shtable_t shtab_options[] =
41 {
42 	"allexport",			SH_ALLEXPORT,
43 #if SHOPT_BASH
44 	"bash",				(SH_BASH|SH_COMMANDLINE),
45 #endif
46 	"bgnice",			SH_BGNICE,
47 	"braceexpand",			SH_BRACEEXPAND,
48 	bashopt("cdable_vars",		SH_CDABLE_VARS)
49 	bashopt("cdspell",		SH_CDSPELL)
50 	bashopt("checkhash",		SH_CHECKHASH)
51 	bashopt("checkwinsize",		SH_CHECKWINSIZE)
52 	"noclobber",			SH_NOCLOBBER,
53 	bashopt("dotglob",		SH_DOTGLOB)
54 	"emacs",			SH_EMACS,
55 	"errexit",			SH_ERREXIT,
56 	"noexec",			SH_NOEXEC,
57 	bashopt("execfail",		SH_EXECFAIL)
58 	bashopt("expand_aliases",	SH_EXPAND_ALIASES)
59 	bashopt("extglob",		SH_EXTGLOB)
60 	"noglob",			SH_NOGLOB,
61 	"globstar",			SH_GLOBSTARS,
62 	"gmacs",			SH_GMACS,
63 	bashextra("hashall",		SH_TRACKALL)
64 	bashopt("histappend",		SH_HISTAPPEND)
65 #if SHOPT_HISTEXPAND
66 	"histexpand",			SH_HISTEXPAND,
67 #else
68 	bashextra("histexpand",		SH_HISTEXPAND)
69 #endif
70 	bashextra("history",		SH_HISTORY2)
71 	bashopt("histreedit",		SH_HISTREEDIT)
72 	bashopt("histverify",		SH_HISTVERIFY)
73 	bashopt("hostcomplete",		SH_HOSTCOMPLETE)
74 	bashopt("huponexit",		SH_HUPONEXIT)
75 	"ignoreeof",			SH_IGNOREEOF,
76 	"interactive",			SH_INTERACTIVE|SH_COMMANDLINE,
77 	bashextra("interactive_comments",	SH_INTERACTIVE_COMM)
78 	"keyword",			SH_KEYWORD,
79 	bashopt("lithist",		SH_LITHIST)
80 	"nolog",			SH_NOLOG,
81 	"login_shell",			SH_LOGIN_SHELL|SH_COMMANDLINE,
82 	bashopt("mailwarn",		SH_MAILWARN)
83 	"markdirs",			SH_MARKDIRS,
84 	"monitor",			SH_MONITOR,
85 	"multiline",			SH_MULTILINE,
86 	bashopt("no_empty_cmd_completion", SH_NOEMPTYCMDCOMPL)
87 	bashopt("nocaseglob",		SH_NOCASEGLOB)
88 	"notify",			SH_NOTIFY,
89 	bashopt("nullglob",		SH_NULLGLOB)
90 	bashextra("onecmd",		SH_TFLAG)
91 	"pipefail",			SH_PIPEFAIL,
92 	bashextra("physical",		SH_PHYSICAL)
93 	bashextra("posix",		SH_POSIX)
94 	"privileged",			SH_PRIVILEGED,
95 #if SHOPT_BASH
96 	"profile",			SH_LOGIN_SHELL|SH_COMMANDLINE,
97 #   if SHOPT_PFSH
98 	"pfsh",				SH_PFSH|SH_COMMANDLINE,
99 #   endif
100 #else
101 #   if SHOPT_PFSH
102 	"profile",			SH_PFSH|SH_COMMANDLINE,
103 #   endif
104 #endif
105 	bashopt("progcomp",		SH_PROGCOMP)
106 	bashopt("promptvars",		SH_PROMPTVARS)
107 	"rc",				SH_RC|SH_COMMANDLINE,
108 	"restricted",			SH_RESTRICTED,
109 	bashopt("restricted_shell",	SH_RESTRICTED2|SH_COMMANDLINE)
110 	bashopt("shift_verbose",	SH_SHIFT_VERBOSE)
111 	"showme",			SH_SHOWME,
112 	bashopt("sourcepath",		SH_SOURCEPATH)
113 	"trackall",			SH_TRACKALL,
114 	"nounset",			SH_NOUNSET,
115 	"verbose",			SH_VERBOSE,
116 	"vi",				SH_VI,
117 	"viraw",			SH_VIRAW,
118 	bashopt("xpg_echo",		SH_XPG_ECHO)
119 	"xtrace",			SH_XTRACE,
120 	"",				0
121 };
122 
123 const Shtable_t shtab_attributes[] =
124 {
125 	{"-Sshared",	NV_REF|NV_TAGGED},
126 	{"-nnameref",	NV_REF},
127 	{"-xexport",	NV_EXPORT},
128 	{"-rreadonly",	NV_RDONLY},
129 	{"-ttagged",	NV_TAGGED},
130 	{"-Aassociative array",	NV_ARRAY},
131 	{"-aindexed array",	NV_ARRAY},
132 	{"-llong",	(NV_DOUBLE|NV_LONG)},
133 	{"-Eexponential",(NV_DOUBLE|NV_EXPNOTE)},
134 	{"-Xhexfloat",	(NV_DOUBLE|NV_HEXFLOAT)},
135 	{"-Ffloat",	NV_DOUBLE},
136 	{"-llong",	(NV_INTEGER|NV_LONG)},
137 	{"-sshort",	(NV_INTEGER|NV_SHORT)},
138 	{"-uunsigned",	(NV_INTEGER|NV_UNSIGN)},
139 	{"-iinteger",	NV_INTEGER},
140 	{"-Hfilename",	NV_HOST},
141 	{"-bbinary",    NV_BINARY},
142 	{"-llowercase",	NV_UTOL},
143 	{"-Zzerofill",	NV_ZFILL},
144 	{"-Lleftjust",	NV_LJUST},
145 	{"-Rrightjust",	NV_RJUST},
146 	{"-uuppercase",	NV_LTOU},
147 	{"++namespace",	NV_TABLE},
148 	{"",		0}
149 };
150