1 |
@SHFLAGS_DEFNS |
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 }; |
4 |
@SHFLAGS_ENUMS |
5 |
#define FN(sname,cname,flags,ochar) cname, |
6 |
#define F0(sname,cname,flags,ochar) cname = 0, |
7 |
@SHFLAGS_ITEMS |
8 |
#define FN(sname,cname,flags,ochar) ((const char *)(&shoptione_ ## cname)) + 2, |
9 |
@@ |
10 |
|
11 |
/* special cases */ |
12 |
|
13 |
<o:|!SHFLAGS_NOT_CMD |
14 |
<T:|!SHFLAGS_NOT_CMD |
15 |
<A:|!SHFLAGS_NOT_SET |
16 |
<o;|!SHFLAGS_NOT_SET |
17 |
<s|!SHFLAGS_NOT_SET |
18 |
|
19 |
/* |
20 |
* options are sorted by their longnames |
21 |
*/ |
22 |
|
23 |
/* -a all new parameters are created with the export attribute */ |
24 |
>a| |
25 |
F0("allexport", FEXPORT, OF_ANY |
26 |
|
27 |
/* ./. bgnice */ |
28 |
>| HAVE_NICE |
29 |
FN("bgnice", FBGNICE, OF_ANY |
30 |
|
31 |
/* ./. enable {} globbing (non-standard) */ |
32 |
>| |
33 |
FN("braceexpand", FBRACEEXPAND, OF_ANY |
34 |
|
35 |
/* ./. Emacs command line editing mode */ |
36 |
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE) |
37 |
FN("emacs", FEMACS, OF_ANY |
38 |
|
39 |
/* -e quit on error */ |
40 |
>e| |
41 |
FN("errexit", FERREXIT, OF_ANY |
42 |
|
43 |
/* ./. Emacs command line editing mode, gmacs variant */ |
44 |
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE) |
45 |
FN("gmacs", FGMACS, OF_ANY |
46 |
|
47 |
/* ./. reading EOF does not exit */ |
48 |
>| |
49 |
FN("ignoreeof", FIGNOREEOF, OF_ANY |
50 |
|
51 |
/* ./. inherit -x flag */ |
52 |
>| |
53 |
FN("inherit-xtrace", FXTRACEREC, OF_ANY |
54 |
|
55 |
/* -i interactive shell */ |
56 |
>i|!SHFLAGS_NOT_CMD |
57 |
FN("interactive", FTALKING, OF_CMDLINE |
58 |
|
59 |
/* -k name=value are recognised anywhere */ |
60 |
>k| |
61 |
FN("keyword", FKEYWORD, OF_ANY |
62 |
|
63 |
/* -l login shell */ |
64 |
>l|!SHFLAGS_NOT_CMD |
65 |
FN("login", FLOGIN, OF_CMDLINE |
66 |
|
67 |
/* -X mark dirs with / in file name completion */ |
68 |
>X| |
69 |
FN("markdirs", FMARKDIRS, OF_ANY |
70 |
|
71 |
/* -m job control monitoring */ |
72 |
>m|!MKSH_UNEMPLOYED |
73 |
FN("monitor", FMONITOR, OF_ANY |
74 |
|
75 |
/* -C don't overwrite existing files */ |
76 |
>C| |
77 |
FN("noclobber", FNOCLOBBER, OF_ANY |
78 |
|
79 |
/* -n don't execute any commands */ |
80 |
>n| |
81 |
FN("noexec", FNOEXEC, OF_ANY |
82 |
|
83 |
/* -f don't do file globbing */ |
84 |
>f| |
85 |
FN("noglob", FNOGLOB, OF_ANY |
86 |
|
87 |
/* ./. don't kill running jobs when login shell exits */ |
88 |
>| |
89 |
FN("nohup", FNOHUP, OF_ANY |
90 |
|
91 |
/* ./. don't save functions in history (no effect) */ |
92 |
>| |
93 |
FN("nolog", FNOLOG, OF_ANY |
94 |
|
95 |
/* -b asynchronous job completion notification */ |
96 |
>b|!MKSH_UNEMPLOYED |
97 |
FN("notify", FNOTIFY, OF_ANY |
98 |
|
99 |
/* -u using an unset variable is an error */ |
100 |
>u| |
101 |
FN("nounset", FNOUNSET, OF_ANY |
102 |
|
103 |
/* ./. don't do logical cds/pwds (non-standard) */ |
104 |
>| |
105 |
FN("physical", FPHYSICAL, OF_ANY |
106 |
|
107 |
/* ./. errorlevel of a pipeline is the rightmost nonzero value */ |
108 |
>| |
109 |
FN("pipefail", FPIPEFAIL, OF_ANY |
110 |
|
111 |
/* ./. adhere more closely to POSIX even when undesirable */ |
112 |
>| |
113 |
FN("posix", FPOSIX, OF_ANY |
114 |
|
115 |
/* -p privileged shell (suid) */ |
116 |
>p| |
117 |
FN("privileged", FPRIVILEGED, OF_ANY |
118 |
|
119 |
/* -r restricted shell */ |
120 |
>r|!SHFLAGS_NOT_CMD |
121 |
FN("restricted", FRESTRICTED, OF_CMDLINE |
122 |
|
123 |
/* ./. kludge mode for better compat with traditional sh (OS-specific) */ |
124 |
>| |
125 |
FN("sh", FSH, OF_ANY |
126 |
|
127 |
/* -s (invocation) parse stdin (pseudo non-standard) */ |
128 |
>s|!SHFLAGS_NOT_CMD |
129 |
FN("stdin", FSTDIN, OF_CMDLINE |
130 |
|
131 |
/* -h create tracked aliases for all commands */ |
132 |
>h| |
133 |
FN("trackall", FTRACKALL, OF_ANY |
134 |
|
135 |
/* -U enable UTF-8 processing (non-standard) */ |
136 |
>U| |
137 |
FN("utf8-mode", FUNICODE, OF_ANY |
138 |
|
139 |
/* -v echo input */ |
140 |
>v| |
141 |
FN("verbose", FVERBOSE, OF_ANY |
142 |
|
143 |
/* ./. Vi command line editing mode */ |
144 |
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE) |
145 |
FN("vi", FVI, OF_ANY |
146 |
|
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 |
150 |
|
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 |
154 |
|
155 |
/* ./. always read in raw mode (no effect) */ |
156 |
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE) |
157 |
FN("viraw", FVIRAW, OF_ANY |
158 |
|
159 |
/* -x execution trace (display commands as they are run) */ |
160 |
>x| |
161 |
FN("xtrace", FXTRACE, OF_ANY |
162 |
|
163 |
/* -c (invocation) execute specified command */ |
164 |
>c|!SHFLAGS_NOT_CMD |
165 |
FN("", FCOMMAND, OF_CMDLINE |
166 |
|
167 |
/* |
168 |
* anonymous flags: used internally by shell only (not visible to user |
169 |
*/ |
170 |
|
171 |
/* ./. direct builtin call (divined from argv[0] multi-call binary) */ |
172 |
>| |
173 |
FN("", FAS_BUILTIN, OF_INTERNAL |
174 |
|
175 |
/* ./. (internal) initial shell was interactive */ |
176 |
>| |
177 |
FN("", FTALKING_I, OF_INTERNAL |
178 |
|
179 |
|SHFLAGS_OPTCS |