2 __RCSID("$MirOS: src/bin/mksh/sh_flags.opt,v 1.2 2014/06/09 12:28:19 tg Exp $");
3 #define FN(sname,cname,flags,ochar) static const struct { /* character flag (if any) */ char c; /* OF_* */ unsigned char optflags; /* long name of option */ char name[sizeof(sname)]; } shoptione_ ## cname = { ochar, flags, sname };
5 #define FN(sname,cname,flags,ochar) cname,
6 #define F0(sname,cname,flags,ochar) cname = 0,
8 #define FN(sname,cname,flags,ochar) ((const char *)(&shoptione_ ## cname)) + 2,
20 * options are sorted by their longnames
23 /* -a all new parameters are created with the export attribute */
25 F0("allexport", FEXPORT, OF_ANY
29 FN("bgnice", FBGNICE, OF_ANY
31 /* ./. enable {} globbing (non-standard) */
33 FN("braceexpand", FBRACEEXPAND, OF_ANY
35 /* ./. Emacs command line editing mode */
36 >|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
37 FN("emacs", FEMACS, OF_ANY
39 /* -e quit on error */
41 FN("errexit", FERREXIT, OF_ANY
43 /* ./. Emacs command line editing mode, gmacs variant */
44 >|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
45 FN("gmacs", FGMACS, OF_ANY
47 /* ./. reading EOF does not exit */
49 FN("ignoreeof", FIGNOREEOF, OF_ANY
51 /* ./. inherit -x flag */
53 FN("inherit-xtrace", FXTRACEREC, OF_ANY
55 /* -i interactive shell */
57 FN("interactive", FTALKING, OF_CMDLINE
59 /* -k name=value are recognised anywhere */
61 FN("keyword", FKEYWORD, OF_ANY
65 FN("login", FLOGIN, OF_CMDLINE
67 /* -X mark dirs with / in file name completion */
69 FN("markdirs", FMARKDIRS, OF_ANY
71 /* -m job control monitoring */
73 FN("monitor", FMONITOR, OF_ANY
75 /* -C don't overwrite existing files */
77 FN("noclobber", FNOCLOBBER, OF_ANY
79 /* -n don't execute any commands */
81 FN("noexec", FNOEXEC, OF_ANY
83 /* -f don't do file globbing */
85 FN("noglob", FNOGLOB, OF_ANY
87 /* ./. don't kill running jobs when login shell exits */
89 FN("nohup", FNOHUP, OF_ANY
91 /* ./. don't save functions in history (no effect) */
93 FN("nolog", FNOLOG, OF_ANY
95 /* -b asynchronous job completion notification */
97 FN("notify", FNOTIFY, OF_ANY
99 /* -u using an unset variable is an error */
101 FN("nounset", FNOUNSET, OF_ANY
103 /* ./. don't do logical cds/pwds (non-standard) */
105 FN("physical", FPHYSICAL, OF_ANY
107 /* ./. errorlevel of a pipeline is the rightmost nonzero value */
109 FN("pipefail", FPIPEFAIL, OF_ANY
111 /* ./. adhere more closely to POSIX even when undesirable */
113 FN("posix", FPOSIX, OF_ANY
115 /* -p privileged shell (suid) */
117 FN("privileged", FPRIVILEGED, OF_ANY
119 /* -r restricted shell */
121 FN("restricted", FRESTRICTED, OF_CMDLINE
123 /* ./. kludge mode for better compat with traditional sh (OS-specific) */
127 /* -s (invocation) parse stdin (pseudo non-standard) */
129 FN("stdin", FSTDIN, OF_CMDLINE
131 /* -h create tracked aliases for all commands */
133 FN("trackall", FTRACKALL, OF_ANY
135 /* -U enable UTF-8 processing (non-standard) */
137 FN("utf8-mode", FUNICODE, OF_ANY
141 FN("verbose", FVERBOSE, OF_ANY
143 /* ./. Vi command line editing mode */
144 >|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
147 /* ./. enable ESC as file name completion character (non-standard) */
148 >|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
149 FN("vi-esccomplete", FVIESCCOMPLETE, OF_ANY
151 /* ./. enable Tab as file name completion character (non-standard) */
152 >|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
153 FN("vi-tabcomplete", FVITABCOMPLETE, OF_ANY
155 /* ./. always read in raw mode (no effect) */
156 >|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
157 FN("viraw", FVIRAW, OF_ANY
159 /* -x execution trace (display commands as they are run) */
161 FN("xtrace", FXTRACE, OF_ANY
163 /* -c (invocation) execute specified command */
165 FN("", FCOMMAND, OF_CMDLINE
168 * anonymous flags: used internally by shell only (not visible to user
171 /* ./. direct builtin call (divined from argv[0] multi-call binary) */
173 FN("", FAS_BUILTIN, OF_INTERNAL
175 /* ./. (internal) initial shell was interactive */
177 FN("", FTALKING_I, OF_INTERNAL