1 #if defined(SHFLAGS_DEFNS)
2 __RCSID("$MirOS: src/bin/mksh/sh_flags.h,v 1.16 2013/08/11 14:57:11 tg Exp $");
3 #define FN(sname,cname,ochar,flags) \
4 static const struct { \
5 /* character flag (if any) */ \
8 unsigned char optflags; \
9 /* long name of option */ \
10 char name[sizeof(sname)]; \
11 } shoptione_ ## cname = { \
14 #elif defined(SHFLAGS_ENUMS)
15 #define FN(sname,cname,ochar,flags) cname,
16 #define F0(sname,cname,ochar,flags) cname = 0,
17 #elif defined(SHFLAGS_ITEMS)
18 #define FN(sname,cname,ochar,flags) \
19 ((const char *)(&shoptione_ ## cname)) + 2,
27 * special cases (see parse_args()): -A, -o, -s
29 * options are sorted by their longnames
32 /* -a all new parameters are created with the export attribute */
33 F0("allexport", FEXPORT, 'a', OF_ANY)
37 FN("bgnice", FBGNICE, 0, OF_ANY)
40 /* ./. enable {} globbing (non-standard) */
41 FN("braceexpand", FBRACEEXPAND, 0, OF_ANY)
43 #if !defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
44 /* ./. Emacs command line editing mode */
45 FN("emacs", FEMACS, 0, OF_ANY)
48 /* -e quit on error */
49 FN("errexit", FERREXIT, 'e', OF_ANY)
51 #if !defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
52 /* ./. Emacs command line editing mode, gmacs variant */
53 FN("gmacs", FGMACS, 0, OF_ANY)
56 /* ./. reading EOF does not exit */
57 FN("ignoreeof", FIGNOREEOF, 0, OF_ANY)
59 /* ./. inherit -x flag */
60 FN("inherit-xtrace", FXTRACEREC, 0, OF_ANY)
62 /* -i interactive shell */
63 FN("interactive", FTALKING, 'i', OF_CMDLINE)
65 /* -k name=value are recognised anywhere */
66 FN("keyword", FKEYWORD, 'k', OF_ANY)
69 FN("login", FLOGIN, 'l', OF_CMDLINE)
71 /* -X mark dirs with / in file name completion */
72 FN("markdirs", FMARKDIRS, 'X', OF_ANY)
74 #ifndef MKSH_UNEMPLOYED
75 /* -m job control monitoring */
76 FN("monitor", FMONITOR, 'm', OF_ANY)
79 /* -C don't overwrite existing files */
80 FN("noclobber", FNOCLOBBER, 'C', OF_ANY)
82 /* -n don't execute any commands */
83 FN("noexec", FNOEXEC, 'n', OF_ANY)
85 /* -f don't do file globbing */
86 FN("noglob", FNOGLOB, 'f', OF_ANY)
88 /* ./. don't kill running jobs when login shell exits */
89 FN("nohup", FNOHUP, 0, OF_ANY)
91 /* ./. don't save functions in history (no effect) */
92 FN("nolog", FNOLOG, 0, OF_ANY)
94 #ifndef MKSH_UNEMPLOYED
95 /* -b asynchronous job completion notification */
96 FN("notify", FNOTIFY, 'b', OF_ANY)
99 /* -u using an unset variable is an error */
100 FN("nounset", FNOUNSET, 'u', OF_ANY)
102 /* ./. don't do logical cds/pwds (non-standard) */
103 FN("physical", FPHYSICAL, 0, OF_ANY)
105 /* ./. errorlevel of a pipeline is the rightmost nonzero value */
106 FN("pipefail", FPIPEFAIL, 0, OF_ANY)
108 /* ./. adhere more closely to POSIX even when undesirable */
109 FN("posix", FPOSIX, 0, OF_ANY)
111 /* -p use suid_profile; privileged shell */
112 FN("privileged", FPRIVILEGED, 'p', OF_ANY)
114 /* -r restricted shell */
115 FN("restricted", FRESTRICTED, 'r', OF_CMDLINE)
117 /* ./. kludge mode for better compat with traditional sh (OS-specific) */
118 FN("sh", FSH, 0, OF_ANY)
120 /* -s (invocation) parse stdin (pseudo non-standard) */
121 FN("stdin", FSTDIN, 's', OF_CMDLINE)
123 /* -h create tracked aliases for all commands */
124 FN("trackall", FTRACKALL, 'h', OF_ANY)
126 /* -U enable UTF-8 processing (non-standard) */
127 FN("utf8-mode", FUNICODE, 'U', OF_ANY)
130 FN("verbose", FVERBOSE, 'v', OF_ANY)
132 #if !defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
133 /* ./. Vi command line editing mode */
134 FN("vi", FVI, 0, OF_ANY)
136 /* ./. enable ESC as file name completion character (non-standard) */
137 FN("vi-esccomplete", FVIESCCOMPLETE, 0, OF_ANY)
139 /* ./. enable Tab as file name completion character (non-standard) */
140 FN("vi-tabcomplete", FVITABCOMPLETE, 0, OF_ANY)
142 /* ./. always read in raw mode (no effect) */
143 FN("viraw", FVIRAW, 0, OF_ANY)
146 /* -x execution trace (display commands as they are run) */
147 FN("xtrace", FXTRACE, 'x', OF_ANY)
149 /* -c (invocation) execute specified command */
150 FN("", FCOMMAND, 'c', OF_CMDLINE)
153 * anonymous flags: used internally by shell only (not visible to user)
156 /* ./. direct builtin call (divined from argv[0] multi-call binary) */
157 FN("", FAS_BUILTIN, 0, OF_INTERNAL)
159 /* ./. (internal) initial shell was interactive */
160 FN("", FTALKING_I, 0, OF_INTERNAL)