191 lines
4.4 KiB
Plaintext
191 lines
4.4 KiB
Plaintext
|
@SHFLAGS_DEFNS
|
||
|
__RCSID("$MirOS: src/bin/mksh/sh_flags.opt,v 1.1 2013/11/17 22:22:56 tg Exp $");
|
||
|
#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 \
|
||
|
};
|
||
|
@SHFLAGS_ENUMS
|
||
|
#define FN(sname,cname,flags,ochar) cname,
|
||
|
#define F0(sname,cname,flags,ochar) cname = 0,
|
||
|
@SHFLAGS_ITEMS
|
||
|
#define FN(sname,cname,flags,ochar) \
|
||
|
((const char *)(&shoptione_ ## cname)) + 2,
|
||
|
@@
|
||
|
|
||
|
/* special cases */
|
||
|
|
||
|
<o:|!SHFLAGS_NOT_CMD
|
||
|
<T:|!SHFLAGS_NOT_CMD
|
||
|
<A:|!SHFLAGS_NOT_SET
|
||
|
<o;|!SHFLAGS_NOT_SET
|
||
|
<s|!SHFLAGS_NOT_SET
|
||
|
|
||
|
/*
|
||
|
* options are sorted by their longnames
|
||
|
*/
|
||
|
|
||
|
/* -a all new parameters are created with the export attribute */
|
||
|
>a|
|
||
|
F0("allexport", FEXPORT, OF_ANY
|
||
|
|
||
|
/* ./. bgnice */
|
||
|
>| HAVE_NICE
|
||
|
FN("bgnice", FBGNICE, OF_ANY
|
||
|
|
||
|
/* ./. enable {} globbing (non-standard) */
|
||
|
>|
|
||
|
FN("braceexpand", FBRACEEXPAND, OF_ANY
|
||
|
|
||
|
/* ./. Emacs command line editing mode */
|
||
|
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
|
||
|
FN("emacs", FEMACS, OF_ANY
|
||
|
|
||
|
/* -e quit on error */
|
||
|
>e|
|
||
|
FN("errexit", FERREXIT, OF_ANY
|
||
|
|
||
|
/* ./. Emacs command line editing mode, gmacs variant */
|
||
|
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
|
||
|
FN("gmacs", FGMACS, OF_ANY
|
||
|
|
||
|
/* ./. reading EOF does not exit */
|
||
|
>|
|
||
|
FN("ignoreeof", FIGNOREEOF, OF_ANY
|
||
|
|
||
|
/* ./. inherit -x flag */
|
||
|
>|
|
||
|
FN("inherit-xtrace", FXTRACEREC, OF_ANY
|
||
|
|
||
|
/* -i interactive shell */
|
||
|
>i|!SHFLAGS_NOT_CMD
|
||
|
FN("interactive", FTALKING, OF_CMDLINE
|
||
|
|
||
|
/* -k name=value are recognised anywhere */
|
||
|
>k|
|
||
|
FN("keyword", FKEYWORD, OF_ANY
|
||
|
|
||
|
/* -l login shell */
|
||
|
>l|!SHFLAGS_NOT_CMD
|
||
|
FN("login", FLOGIN, OF_CMDLINE
|
||
|
|
||
|
/* -X mark dirs with / in file name completion */
|
||
|
>X|
|
||
|
FN("markdirs", FMARKDIRS, OF_ANY
|
||
|
|
||
|
/* -m job control monitoring */
|
||
|
>m|!MKSH_UNEMPLOYED
|
||
|
FN("monitor", FMONITOR, OF_ANY
|
||
|
|
||
|
/* -C don't overwrite existing files */
|
||
|
>C|
|
||
|
FN("noclobber", FNOCLOBBER, OF_ANY
|
||
|
|
||
|
/* -n don't execute any commands */
|
||
|
>n|
|
||
|
FN("noexec", FNOEXEC, OF_ANY
|
||
|
|
||
|
/* -f don't do file globbing */
|
||
|
>f|
|
||
|
FN("noglob", FNOGLOB, OF_ANY
|
||
|
|
||
|
/* ./. don't kill running jobs when login shell exits */
|
||
|
>|
|
||
|
FN("nohup", FNOHUP, OF_ANY
|
||
|
|
||
|
/* ./. don't save functions in history (no effect) */
|
||
|
>|
|
||
|
FN("nolog", FNOLOG, OF_ANY
|
||
|
|
||
|
/* -b asynchronous job completion notification */
|
||
|
>b|!MKSH_UNEMPLOYED
|
||
|
FN("notify", FNOTIFY, OF_ANY
|
||
|
|
||
|
/* -u using an unset variable is an error */
|
||
|
>u|
|
||
|
FN("nounset", FNOUNSET, OF_ANY
|
||
|
|
||
|
/* ./. don't do logical cds/pwds (non-standard) */
|
||
|
>|
|
||
|
FN("physical", FPHYSICAL, OF_ANY
|
||
|
|
||
|
/* ./. errorlevel of a pipeline is the rightmost nonzero value */
|
||
|
>|
|
||
|
FN("pipefail", FPIPEFAIL, OF_ANY
|
||
|
|
||
|
/* ./. adhere more closely to POSIX even when undesirable */
|
||
|
>|
|
||
|
FN("posix", FPOSIX, OF_ANY
|
||
|
|
||
|
/* -p use suid_profile; privileged shell */
|
||
|
>p|
|
||
|
FN("privileged", FPRIVILEGED, OF_ANY
|
||
|
|
||
|
/* -r restricted shell */
|
||
|
>r|!SHFLAGS_NOT_CMD
|
||
|
FN("restricted", FRESTRICTED, OF_CMDLINE
|
||
|
|
||
|
/* ./. kludge mode for better compat with traditional sh (OS-specific) */
|
||
|
>|
|
||
|
FN("sh", FSH, OF_ANY
|
||
|
|
||
|
/* -s (invocation) parse stdin (pseudo non-standard) */
|
||
|
>s|!SHFLAGS_NOT_CMD
|
||
|
FN("stdin", FSTDIN, OF_CMDLINE
|
||
|
|
||
|
/* -h create tracked aliases for all commands */
|
||
|
>h|
|
||
|
FN("trackall", FTRACKALL, OF_ANY
|
||
|
|
||
|
/* -U enable UTF-8 processing (non-standard) */
|
||
|
>U|
|
||
|
FN("utf8-mode", FUNICODE, OF_ANY
|
||
|
|
||
|
/* -v echo input */
|
||
|
>v|
|
||
|
FN("verbose", FVERBOSE, OF_ANY
|
||
|
|
||
|
/* ./. Vi command line editing mode */
|
||
|
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
|
||
|
FN("vi", FVI, OF_ANY
|
||
|
|
||
|
/* ./. enable ESC as file name completion character (non-standard) */
|
||
|
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
|
||
|
FN("vi-esccomplete", FVIESCCOMPLETE, OF_ANY
|
||
|
|
||
|
/* ./. enable Tab as file name completion character (non-standard) */
|
||
|
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
|
||
|
FN("vi-tabcomplete", FVITABCOMPLETE, OF_ANY
|
||
|
|
||
|
/* ./. always read in raw mode (no effect) */
|
||
|
>|!defined(MKSH_NO_CMDLINE_EDITING) || defined(MKSH_LEGACY_MODE)
|
||
|
FN("viraw", FVIRAW, OF_ANY
|
||
|
|
||
|
/* -x execution trace (display commands as they are run) */
|
||
|
>x|
|
||
|
FN("xtrace", FXTRACE, OF_ANY
|
||
|
|
||
|
/* -c (invocation) execute specified command */
|
||
|
>c|!SHFLAGS_NOT_CMD
|
||
|
FN("", FCOMMAND, OF_CMDLINE
|
||
|
|
||
|
/*
|
||
|
* anonymous flags: used internally by shell only (not visible to user
|
||
|
*/
|
||
|
|
||
|
/* ./. direct builtin call (divined from argv[0] multi-call binary) */
|
||
|
>|
|
||
|
FN("", FAS_BUILTIN, OF_INTERNAL
|
||
|
|
||
|
/* ./. (internal) initial shell was interactive */
|
||
|
>|
|
||
|
FN("", FTALKING_I, OF_INTERNAL
|
||
|
|
||
|
|SHFLAGS_OPTCS
|