Home | History | Annotate | Download | only in src
      1 /*-
      2  * Copyright (c) 2013, 2014, 2015, 2017
      3  *	mirabilos <m (at) mirbsd.org>
      4  *
      5  * Provided that these terms and disclaimer and all copyright notices
      6  * are retained or reproduced in an accompanying document, permission
      7  * is granted to deal in this work without restriction, including un-
      8  * limited rights to use, publicly perform, distribute, sell, modify,
      9  * merge, give away, or sublicence.
     10  *
     11  * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
     12  * the utmost extent permitted by applicable law, neither express nor
     13  * implied; without malicious intent or gross negligence. In no event
     14  * may a licensor, author or contributor be held liable for indirect,
     15  * direct, other damage, loss, or other issues arising in any way out
     16  * of dealing in the work, even if advised of the possibility of such
     17  * damage or existence of a defect, except proven that it results out
     18  * of said person's immediate fault when using the work as intended.
     19  */
     20 
     21 @SHFLAGS_DEFNS
     22 __RCSID("$MirOS: src/bin/mksh/sh_flags.opt,v 1.5 2017/02/18 02:33:15 tg Exp $");
     23 @SHFLAGS_ENUMS
     24 #define FN(sname,cname,flags,ochar)	cname,
     25 #define F0(sname,cname,flags,ochar)	cname = 0,
     26 @SHFLAGS_ITEMS
     27 #define FN(sname,cname,flags,ochar)	((const char *)(&shoptione_ ## cname)) + 2,
     28 @@
     29 
     30 /* special cases */
     31 
     32 <o:|!SHFLAGS_NOT_CMD
     33 <T:|!SHFLAGS_NOT_CMD
     34 <A:|!SHFLAGS_NOT_SET
     35 <o;|!SHFLAGS_NOT_SET
     36 <s|!SHFLAGS_NOT_SET
     37 
     38 /*
     39  * options are sorted by their longnames
     40  */
     41 
     42 /* -a	all new parameters are created with the export attribute */
     43 >a|
     44 F0("allexport", FEXPORT, OF_ANY
     45 
     46 /* ./.	bgnice */
     47 >| HAVE_NICE
     48 FN("bgnice", FBGNICE, OF_ANY
     49 
     50 /* ./.	enable {} globbing (non-standard) */
     51 >|
     52 FN("braceexpand", FBRACEEXPAND, OF_ANY
     53 
     54 /* ./.	Emacs command line editing mode */
     55 >|!MKSH_NO_CMDLINE_EDITING
     56 FN("emacs", FEMACS, OF_ANY
     57 
     58 /* -e	quit on error */
     59 >e|
     60 FN("errexit", FERREXIT, OF_ANY
     61 
     62 /* ./.	Emacs command line editing mode, gmacs variant */
     63 >|!MKSH_NO_CMDLINE_EDITING
     64 FN("gmacs", FGMACS, OF_ANY
     65 
     66 /* ./.	reading EOF does not exit */
     67 >|
     68 FN("ignoreeof", FIGNOREEOF, OF_ANY
     69 
     70 /* ./.	inherit -x flag */
     71 >|
     72 FN("inherit-xtrace", FXTRACEREC, OF_ANY
     73 
     74 /* -i	interactive shell */
     75 >i|!SHFLAGS_NOT_CMD
     76 FN("interactive", FTALKING, OF_CMDLINE
     77 
     78 /* -k	name=value are recognised anywhere */
     79 >k|
     80 FN("keyword", FKEYWORD, OF_ANY
     81 
     82 /* -l	login shell */
     83 >l|!SHFLAGS_NOT_CMD
     84 FN("login", FLOGIN, OF_CMDLINE
     85 
     86 /* -X	mark dirs with / in file name completion */
     87 >X|
     88 FN("markdirs", FMARKDIRS, OF_ANY
     89 
     90 /* -m	job control monitoring */
     91 >m|!MKSH_UNEMPLOYED
     92 FN("monitor", FMONITOR, OF_ANY
     93 
     94 /* -C	don't overwrite existing files */
     95 >C|
     96 FN("noclobber", FNOCLOBBER, OF_ANY
     97 
     98 /* -n	don't execute any commands */
     99 >n|
    100 FN("noexec", FNOEXEC, OF_ANY
    101 
    102 /* -f	don't do file globbing */
    103 >f|
    104 FN("noglob", FNOGLOB, OF_ANY
    105 
    106 /* ./.	don't kill running jobs when login shell exits */
    107 >|
    108 FN("nohup", FNOHUP, OF_ANY
    109 
    110 /* ./.	don't save functions in history (no effect) */
    111 >|
    112 FN("nolog", FNOLOG, OF_ANY
    113 
    114 /* -b	asynchronous job completion notification */
    115 >b|!MKSH_UNEMPLOYED
    116 FN("notify", FNOTIFY, OF_ANY
    117 
    118 /* -u	using an unset variable is an error */
    119 >u|
    120 FN("nounset", FNOUNSET, OF_ANY
    121 
    122 /* ./.	don't do logical cds/pwds (non-standard) */
    123 >|
    124 FN("physical", FPHYSICAL, OF_ANY
    125 
    126 /* ./.	errorlevel of a pipeline is the rightmost nonzero value */
    127 >|
    128 FN("pipefail", FPIPEFAIL, OF_ANY
    129 
    130 /* ./.	adhere more closely to POSIX even when undesirable */
    131 >|
    132 FN("posix", FPOSIX, OF_ANY
    133 
    134 /* -p	privileged shell (suid) */
    135 >p|
    136 FN("privileged", FPRIVILEGED, OF_ANY
    137 
    138 /* -r	restricted shell */
    139 >r|!SHFLAGS_NOT_CMD
    140 FN("restricted", FRESTRICTED, OF_CMDLINE
    141 
    142 /* ./.	kludge mode for better compat with traditional sh (OS-specific) */
    143 >|
    144 FN("sh", FSH, OF_ANY
    145 
    146 /* -s	(invocation) parse stdin (pseudo non-standard) */
    147 >s|!SHFLAGS_NOT_CMD
    148 FN("stdin", FSTDIN, OF_CMDLINE
    149 
    150 /* -h	create tracked aliases for all commands */
    151 >h|
    152 FN("trackall", FTRACKALL, OF_ANY
    153 
    154 /* -U	enable UTF-8 processing (non-standard) */
    155 >U|
    156 FN("utf8-mode", FUNICODE, OF_ANY
    157 
    158 /* -v	echo input */
    159 >v|
    160 FN("verbose", FVERBOSE, OF_ANY
    161 
    162 /* ./.	Vi command line editing mode */
    163 >|!MKSH_NO_CMDLINE_EDITING
    164 FN("vi", FVI, OF_ANY
    165 
    166 /* ./.	enable ESC as file name completion character (non-standard) */
    167 >|!MKSH_NO_CMDLINE_EDITING
    168 FN("vi-esccomplete", FVIESCCOMPLETE, OF_ANY
    169 
    170 /* ./.	enable Tab as file name completion character (non-standard) */
    171 >|!MKSH_NO_CMDLINE_EDITING
    172 FN("vi-tabcomplete", FVITABCOMPLETE, OF_ANY
    173 
    174 /* ./.	always read in raw mode (no effect) */
    175 >|!MKSH_NO_CMDLINE_EDITING
    176 FN("viraw", FVIRAW, OF_ANY
    177 
    178 /* -x	execution trace (display commands as they are run) */
    179 >x|
    180 FN("xtrace", FXTRACE, OF_ANY
    181 
    182 /* -c	(invocation) execute specified command */
    183 >c|!SHFLAGS_NOT_CMD
    184 FN("", FCOMMAND, OF_CMDLINE
    185 
    186 /*
    187  * anonymous flags: used internally by shell only (not visible to user
    188  */
    189 
    190 /* ./.	direct builtin call (divined from argv[0] multi-call binary) */
    191 >|
    192 FN("", FAS_BUILTIN, OF_INTERNAL
    193 
    194 /* ./.	(internal) initial shell was interactive */
    195 >|
    196 FN("", FTALKING_I, OF_INTERNAL
    197 
    198 |SHFLAGS_OPTCS
    199