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