1/*-
2 * Copyright (c) 2013, 2014, 2015
3 *	mirabilos <m@mirbsd.org>
4 *
5 * Provided that these terms and disclaimer and all copyright notices
6 * are retained or reproduced in an accompanying document, permission
7 * is granted to deal in this work without restriction, including un-
8 * limited rights to use, publicly perform, distribute, sell, modify,
9 * merge, give away, or sublicence.
10 *
11 * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
12 * the utmost extent permitted by applicable law, neither express nor
13 * implied; without malicious intent or gross negligence. In no event
14 * may a licensor, author or contributor be held liable for indirect,
15 * direct, other damage, loss, or other issues arising in any way out
16 * of dealing in the work, even if advised of the possibility of such
17 * damage or existence of a defect, except proven that it results out
18 * of said person's immediate fault when using the work as intended.
19 */
20
21@SHFLAGS_DEFNS
22__RCSID("$MirOS: src/bin/mksh/sh_flags.opt,v 1.4 2015/12/12 21:08:44 tg Exp $");
23@SHFLAGS_ENUMS
24#define FN(sname,cname,flags,ochar)	cname,
25#define F0(sname,cname,flags,ochar)	cname = 0,
26@SHFLAGS_ITEMS
27#define FN(sname,cname,flags,ochar)	((const char *)(&shoptione_ ## cname)) + 2,
28@@
29
30/* special cases */
31
32<o:|!SHFLAGS_NOT_CMD
33<T:|!SHFLAGS_NOT_CMD
34<A:|!SHFLAGS_NOT_SET
35<o;|!SHFLAGS_NOT_SET
36<s|!SHFLAGS_NOT_SET
37
38/*
39 * options are sorted by their longnames
40 */
41
42/* -a	all new parameters are created with the export attribute */
43>a|
44F0("allexport", FEXPORT, OF_ANY
45
46/* ./.	bgnice */
47>| HAVE_NICE
48FN("bgnice", FBGNICE, OF_ANY
49
50/* ./.	enable {} globbing (non-standard) */
51>|
52FN("braceexpand", FBRACEEXPAND, OF_ANY
53
54/* ./.	Emacs command line editing mode */
55>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
56FN("emacs", FEMACS, OF_ANY
57
58/* -e	quit on error */
59>e|
60FN("errexit", FERREXIT, OF_ANY
61
62/* ./.	Emacs command line editing mode, gmacs variant */
63>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
64FN("gmacs", FGMACS, OF_ANY
65
66/* ./.	reading EOF does not exit */
67>|
68FN("ignoreeof", FIGNOREEOF, OF_ANY
69
70/* ./.	inherit -x flag */
71>|
72FN("inherit-xtrace", FXTRACEREC, OF_ANY
73
74/* -i	interactive shell */
75>i|!SHFLAGS_NOT_CMD
76FN("interactive", FTALKING, OF_CMDLINE
77
78/* -k	name=value are recognised anywhere */
79>k|
80FN("keyword", FKEYWORD, OF_ANY
81
82/* -l	login shell */
83>l|!SHFLAGS_NOT_CMD
84FN("login", FLOGIN, OF_CMDLINE
85
86/* -X	mark dirs with / in file name completion */
87>X|
88FN("markdirs", FMARKDIRS, OF_ANY
89
90/* -m	job control monitoring */
91>m|!MKSH_UNEMPLOYED
92FN("monitor", FMONITOR, OF_ANY
93
94/* -C	don't overwrite existing files */
95>C|
96FN("noclobber", FNOCLOBBER, OF_ANY
97
98/* -n	don't execute any commands */
99>n|
100FN("noexec", FNOEXEC, OF_ANY
101
102/* -f	don't do file globbing */
103>f|
104FN("noglob", FNOGLOB, OF_ANY
105
106/* ./.	don't kill running jobs when login shell exits */
107>|
108FN("nohup", FNOHUP, OF_ANY
109
110/* ./.	don't save functions in history (no effect) */
111>|
112FN("nolog", FNOLOG, OF_ANY
113
114/* -b	asynchronous job completion notification */
115>b|!MKSH_UNEMPLOYED
116FN("notify", FNOTIFY, OF_ANY
117
118/* -u	using an unset variable is an error */
119>u|
120FN("nounset", FNOUNSET, OF_ANY
121
122/* ./.	don't do logical cds/pwds (non-standard) */
123>|
124FN("physical", FPHYSICAL, OF_ANY
125
126/* ./.	errorlevel of a pipeline is the rightmost nonzero value */
127>|
128FN("pipefail", FPIPEFAIL, OF_ANY
129
130/* ./.	adhere more closely to POSIX even when undesirable */
131>|
132FN("posix", FPOSIX, OF_ANY
133
134/* -p	privileged shell (suid) */
135>p|
136FN("privileged", FPRIVILEGED, OF_ANY
137
138/* -r	restricted shell */
139>r|!SHFLAGS_NOT_CMD
140FN("restricted", FRESTRICTED, OF_CMDLINE
141
142/* ./.	kludge mode for better compat with traditional sh (OS-specific) */
143>|
144FN("sh", FSH, OF_ANY
145
146/* -s	(invocation) parse stdin (pseudo non-standard) */
147>s|!SHFLAGS_NOT_CMD
148FN("stdin", FSTDIN, OF_CMDLINE
149
150/* -h	create tracked aliases for all commands */
151>h|
152FN("trackall", FTRACKALL, OF_ANY
153
154/* -U	enable UTF-8 processing (non-standard) */
155>U|
156FN("utf8-mode", FUNICODE, OF_ANY
157
158/* -v	echo input */
159>v|
160FN("verbose", FVERBOSE, OF_ANY
161
162/* ./.	Vi command line editing mode */
163>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
164FN("vi", FVI, OF_ANY
165
166/* ./.	enable ESC as file name completion character (non-standard) */
167>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
168FN("vi-esccomplete", FVIESCCOMPLETE, OF_ANY
169
170/* ./.	enable Tab as file name completion character (non-standard) */
171>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
172FN("vi-tabcomplete", FVITABCOMPLETE, OF_ANY
173
174/* ./.	always read in raw mode (no effect) */
175>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
176FN("viraw", FVIRAW, OF_ANY
177
178/* -x	execution trace (display commands as they are run) */
179>x|
180FN("xtrace", FXTRACE, OF_ANY
181
182/* -c	(invocation) execute specified command */
183>c|!SHFLAGS_NOT_CMD
184FN("", FCOMMAND, OF_CMDLINE
185
186/*
187 * anonymous flags: used internally by shell only (not visible to user
188 */
189
190/* ./.	direct builtin call (divined from argv[0] multi-call binary) */
191>|
192FN("", FAS_BUILTIN, OF_INTERNAL
193
194/* ./.	(internal) initial shell was interactive */
195>|
196FN("", FTALKING_I, OF_INTERNAL
197
198|SHFLAGS_OPTCS
199