more of this:
• shell flags are now handled in one single place (sh_flags.h) • sync comments (between enum and array) and manpage with reality • FMONITOR is now no longer needed for Hartz IV shells
This commit is contained in:
parent
0cf2df79e9
commit
588921333e
8
exec.c
8
exec.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.64 2009/08/28 20:30:55 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.65 2009/09/20 16:40:55 tg Exp $");
|
||||||
|
|
||||||
static int comexec(struct op *, struct tbl *volatile, const char **,
|
static int comexec(struct op *, struct tbl *volatile, const char **,
|
||||||
int volatile, volatile int *);
|
int volatile, volatile int *);
|
||||||
@ -671,7 +671,11 @@ comexec(struct op *t, struct tbl *volatile tp, const char **ap,
|
|||||||
|
|
||||||
if (flags&XEXEC) {
|
if (flags&XEXEC) {
|
||||||
j_exit();
|
j_exit();
|
||||||
if (!(flags&XBGND) || Flag(FMONITOR)) {
|
if (!(flags&XBGND)
|
||||||
|
#ifndef MKSH_UNEMPLOYED
|
||||||
|
|| Flag(FMONITOR)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
setexecsig(&sigtraps[SIGINT], SS_RESTORE_ORIG);
|
setexecsig(&sigtraps[SIGINT], SS_RESTORE_ORIG);
|
||||||
setexecsig(&sigtraps[SIGQUIT], SS_RESTORE_ORIG);
|
setexecsig(&sigtraps[SIGQUIT], SS_RESTORE_ORIG);
|
||||||
}
|
}
|
||||||
|
32
jobs.c
32
jobs.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.59 2009/08/01 20:32:44 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.60 2009/09/20 16:40:55 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
#define mksh_killpg killpg
|
#define mksh_killpg killpg
|
||||||
@ -157,9 +157,9 @@ j_init(void)
|
|||||||
{
|
{
|
||||||
#ifndef MKSH_UNEMPLOYED
|
#ifndef MKSH_UNEMPLOYED
|
||||||
bool mflagset = Flag(FMONITOR) != 127;
|
bool mflagset = Flag(FMONITOR) != 127;
|
||||||
#endif
|
|
||||||
|
|
||||||
Flag(FMONITOR) = 0;
|
Flag(FMONITOR) = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
(void)sigemptyset(&sm_default);
|
(void)sigemptyset(&sm_default);
|
||||||
sigprocmask(SIG_SETMASK, &sm_default, NULL);
|
sigprocmask(SIG_SETMASK, &sm_default, NULL);
|
||||||
@ -464,7 +464,11 @@ exchild(struct op *t, int flags,
|
|||||||
if (Flag(FBGNICE) && (flags & XBGND))
|
if (Flag(FBGNICE) && (flags & XBGND))
|
||||||
(void)nice(4);
|
(void)nice(4);
|
||||||
#endif
|
#endif
|
||||||
if ((flags & XBGND) && !Flag(FMONITOR)) {
|
if ((flags & XBGND)
|
||||||
|
#ifndef MKSH_UNEMPLOYED
|
||||||
|
&& !Flag(FMONITOR)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
setsig(&sigtraps[SIGINT], SIG_IGN,
|
setsig(&sigtraps[SIGINT], SIG_IGN,
|
||||||
SS_RESTORE_IGN|SS_FORCE);
|
SS_RESTORE_IGN|SS_FORCE);
|
||||||
setsig(&sigtraps[SIGQUIT], SIG_IGN,
|
setsig(&sigtraps[SIGQUIT], SIG_IGN,
|
||||||
@ -970,7 +974,9 @@ j_waitj(Job *j,
|
|||||||
if (flags & JW_ASYNCNOTIFY)
|
if (flags & JW_ASYNCNOTIFY)
|
||||||
j->flags |= JF_W_ASYNCNOTIFY;
|
j->flags |= JF_W_ASYNCNOTIFY;
|
||||||
|
|
||||||
|
#ifndef MKSH_UNEMPLOYED
|
||||||
if (!Flag(FMONITOR))
|
if (!Flag(FMONITOR))
|
||||||
|
#endif
|
||||||
flags |= JW_STOPPEDWAIT;
|
flags |= JW_STOPPEDWAIT;
|
||||||
|
|
||||||
while (j->state == PRUNNING ||
|
while (j->state == PRUNNING ||
|
||||||
@ -1068,13 +1074,19 @@ j_waitj(Job *j,
|
|||||||
j_systime = j->systime;
|
j_systime = j->systime;
|
||||||
rv = j->status;
|
rv = j->status;
|
||||||
|
|
||||||
if (!(flags & JW_ASYNCNOTIFY) &&
|
if (!(flags & JW_ASYNCNOTIFY)
|
||||||
(!Flag(FMONITOR) || j->state != PSTOPPED)) {
|
#ifndef MKSH_UNEMPLOYED
|
||||||
|
&& (!Flag(FMONITOR) || j->state != PSTOPPED)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
j_print(j, JP_SHORT, shl_out);
|
j_print(j, JP_SHORT, shl_out);
|
||||||
shf_flush(shl_out);
|
shf_flush(shl_out);
|
||||||
}
|
}
|
||||||
if (j->state != PSTOPPED &&
|
if (j->state != PSTOPPED
|
||||||
(!Flag(FMONITOR) || !(flags & JW_ASYNCNOTIFY)))
|
#ifndef MKSH_UNEMPLOYED
|
||||||
|
&& (!Flag(FMONITOR) || !(flags & JW_ASYNCNOTIFY))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
remove_job(j, where);
|
remove_job(j, where);
|
||||||
|
|
||||||
return (rv);
|
return (rv);
|
||||||
@ -1249,7 +1261,11 @@ check_job(Job *j)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!Flag(FMONITOR) && !(j->flags & (JF_WAITING|JF_FG)) &&
|
if (
|
||||||
|
#ifndef MKSH_UNEMPLOYED
|
||||||
|
!Flag(FMONITOR) &&
|
||||||
|
#endif
|
||||||
|
!(j->flags & (JF_WAITING|JF_FG)) &&
|
||||||
j->state != PSTOPPED) {
|
j->state != PSTOPPED) {
|
||||||
if (j == async_job || (j->flags & JF_KNOWN)) {
|
if (j == async_job || (j->flags & JF_KNOWN)) {
|
||||||
j->flags |= JF_ZOMBIE;
|
j->flags |= JF_ZOMBIE;
|
||||||
|
4
main.c
4
main.c
@ -33,7 +33,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.144 2009/09/06 17:42:13 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.145 2009/09/20 16:40:55 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -287,7 +287,9 @@ main(int argc, const char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this to note if monitor is set on command line (see below) */
|
/* this to note if monitor is set on command line (see below) */
|
||||||
|
#ifndef MKSH_UNEMPLOYED
|
||||||
Flag(FMONITOR) = 127;
|
Flag(FMONITOR) = 127;
|
||||||
|
#endif
|
||||||
argi = parse_args(argv, OF_CMDLINE, NULL);
|
argi = parse_args(argv, OF_CMDLINE, NULL);
|
||||||
if (argi < 0)
|
if (argi < 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
61
misc.c
61
misc.c
@ -29,7 +29,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.122 2009/09/19 22:32:23 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.123 2009/09/20 16:40:56 tg Exp $");
|
||||||
|
|
||||||
#undef USE_CHVT
|
#undef USE_CHVT
|
||||||
/* XXX conditions correct? */
|
/* XXX conditions correct? */
|
||||||
@ -98,61 +98,12 @@ Xcheck_grow_(XString *xsp, const char *xp, unsigned int more)
|
|||||||
return (xsp->beg + (xp - old_beg));
|
return (xsp->beg + (xp - old_beg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SHFLAGS_DEFNS
|
||||||
|
#include "sh_flags.h"
|
||||||
|
|
||||||
const struct shoption options[] = {
|
const struct shoption options[] = {
|
||||||
/* Special cases (see parse_args()): -A, -o, -s.
|
#define SHFLAGS_ITEMS
|
||||||
* Options are sorted by their longnames - the order of these
|
#include "sh_flags.h"
|
||||||
* entries MUST match the order of sh_flag F* enumerations in sh.h.
|
|
||||||
*/
|
|
||||||
{ "allexport", 'a', OF_ANY },
|
|
||||||
#if HAVE_ARC4RANDOM
|
|
||||||
{ "arc4random", 0, OF_ANY },
|
|
||||||
#endif
|
|
||||||
{ "braceexpand", 0, OF_ANY }, /* non-standard */
|
|
||||||
#if HAVE_NICE
|
|
||||||
{ "bgnice", 0, OF_ANY },
|
|
||||||
#endif
|
|
||||||
{ NULL, 'c', OF_CMDLINE },
|
|
||||||
{ "emacs", 0, OF_ANY },
|
|
||||||
{ "errexit", 'e', OF_ANY },
|
|
||||||
{ "gmacs", 0, OF_ANY },
|
|
||||||
{ "ignoreeof", 0, OF_ANY },
|
|
||||||
{ "interactive", 'i', OF_CMDLINE },
|
|
||||||
{ "keyword", 'k', OF_ANY },
|
|
||||||
{ "login", 'l', OF_CMDLINE },
|
|
||||||
{ "markdirs", 'X', OF_ANY },
|
|
||||||
#ifndef MKSH_UNEMPLOYED
|
|
||||||
{ "monitor", 'm', OF_ANY },
|
|
||||||
#else
|
|
||||||
{ NULL, 'm', 0 }, /* needed */
|
|
||||||
#endif
|
|
||||||
{ "noclobber", 'C', OF_ANY },
|
|
||||||
{ "noexec", 'n', OF_ANY },
|
|
||||||
{ "noglob", 'f', OF_ANY },
|
|
||||||
{ "nohup", 0, OF_ANY },
|
|
||||||
{ "nolog", 0, OF_ANY }, /* no effect */
|
|
||||||
#ifndef MKSH_UNEMPLOYED
|
|
||||||
{ "notify", 'b', OF_ANY },
|
|
||||||
#endif
|
|
||||||
{ "nounset", 'u', OF_ANY },
|
|
||||||
{ "physical", 0, OF_ANY }, /* non-standard */
|
|
||||||
{ "posix", 0, OF_ANY }, /* non-standard */
|
|
||||||
{ "privileged", 'p', OF_ANY },
|
|
||||||
{ "restricted", 'r', OF_CMDLINE },
|
|
||||||
{ "stdin", 's', OF_CMDLINE }, /* pseudo non-st.. */
|
|
||||||
{ "trackall", 'h', OF_ANY },
|
|
||||||
{ "utf8-mode", 'U', OF_ANY }, /* non-standard */
|
|
||||||
{ "verbose", 'v', OF_ANY },
|
|
||||||
#ifndef MKSH_NOVI
|
|
||||||
{ "vi", 0, OF_ANY },
|
|
||||||
{ "viraw", 0, OF_ANY }, /* no effect */
|
|
||||||
{ "vi-tabcomplete", 0, OF_ANY }, /* non-standard */
|
|
||||||
{ "vi-esccomplete", 0, OF_ANY }, /* non-standard */
|
|
||||||
#endif
|
|
||||||
{ "xtrace", 'x', OF_ANY },
|
|
||||||
/* Anonymous flags: used internally by shell only
|
|
||||||
* (not visible to user)
|
|
||||||
*/
|
|
||||||
{ NULL, 0, OF_INTERNAL }, /* FTALKING_I */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
34
mksh.1
34
mksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.189 2009/09/20 12:12:00 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.190 2009/09/20 16:40:56 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.129 2009/05/28 06:09:06 jmc Exp $
|
.\" $OpenBSD: ksh.1,v 1.129 2009/05/28 06:09:06 jmc Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||||
@ -3561,7 +3561,7 @@ scripts, while the original Korn shell only treats profiles as
|
|||||||
scripts.
|
scripts.
|
||||||
.Pp
|
.Pp
|
||||||
.It Xo
|
.It Xo
|
||||||
.Ic set Op Ic +\-abCefhkmnpsuvXx
|
.Ic set Op Ic +\-abCefhiklmnprsUuvXx
|
||||||
.Op Ic +\-o Ar option
|
.Op Ic +\-o Ar option
|
||||||
.Op Ic +\-A Ar name
|
.Op Ic +\-A Ar name
|
||||||
.Op Fl \-
|
.Op Fl \-
|
||||||
@ -3654,8 +3654,16 @@ Create tracked aliases for all executed commands (see
|
|||||||
.Sx Aliases
|
.Sx Aliases
|
||||||
above).
|
above).
|
||||||
Enabled by default for non-interactive shells.
|
Enabled by default for non-interactive shells.
|
||||||
|
.It Fl i \*(Ba Ic interactive
|
||||||
|
The shell is an interactive shell.
|
||||||
|
This option can only be used when the shell is invoked.
|
||||||
|
See above for a description of what this means.
|
||||||
.It Fl k \*(Ba Ic keyword
|
.It Fl k \*(Ba Ic keyword
|
||||||
Parameter assignments are recognised anywhere in a command.
|
Parameter assignments are recognised anywhere in a command.
|
||||||
|
.It Fl l \*(Ba Ic login
|
||||||
|
The shell is a login shell.
|
||||||
|
This option can only be used when the shell is invoked.
|
||||||
|
See above for a description of what this means.
|
||||||
.It Fl m \*(Ba Ic monitor
|
.It Fl m \*(Ba Ic monitor
|
||||||
Enable job control (default for interactive shells).
|
Enable job control (default for interactive shells).
|
||||||
.It Fl n \*(Ba Ic noexec
|
.It Fl n \*(Ba Ic noexec
|
||||||
@ -3668,6 +3676,10 @@ It is set automatically if, when the shell starts,
|
|||||||
the real UID or GID does not match
|
the real UID or GID does not match
|
||||||
the effective UID (EUID) or GID (EGID), respectively.
|
the effective UID (EUID) or GID (EGID), respectively.
|
||||||
See above for a description of what this means.
|
See above for a description of what this means.
|
||||||
|
.It Fl r \*(Ba Ic restricted
|
||||||
|
The shell is a restricted shell.
|
||||||
|
This option can only be used when the shell is invoked.
|
||||||
|
See above for a description of what this means.
|
||||||
.It Fl s \*(Ba Ic stdin
|
.It Fl s \*(Ba Ic stdin
|
||||||
If used when the shell is invoked, commands are read from standard input.
|
If used when the shell is invoked, commands are read from standard input.
|
||||||
Set automatically if the shell is invoked with no arguments.
|
Set automatically if the shell is invoked with no arguments.
|
||||||
@ -3754,19 +3766,11 @@ must be used.
|
|||||||
To avoid infinite loops, the shell will exit if
|
To avoid infinite loops, the shell will exit if
|
||||||
.Dv EOF
|
.Dv EOF
|
||||||
is read 13 times in a row.
|
is read 13 times in a row.
|
||||||
.It Ic interactive
|
|
||||||
The shell is an interactive shell.
|
|
||||||
This option can only be used when the shell is invoked.
|
|
||||||
See above for a description of what this means.
|
|
||||||
.It Ic login
|
|
||||||
The shell is a login shell.
|
|
||||||
This option can only be used when the shell is invoked.
|
|
||||||
See above for a description of what this means.
|
|
||||||
.It Ic nohup
|
.It Ic nohup
|
||||||
Do not kill running jobs with a
|
Do not kill running jobs with a
|
||||||
.Dv SIGHUP
|
.Dv SIGHUP
|
||||||
signal when a login shell exits.
|
signal when a login shell exits.
|
||||||
Currently set by default, but this will
|
Currently set by default, but this may
|
||||||
change in the future to be compatible with
|
change in the future to be compatible with
|
||||||
.At
|
.At
|
||||||
.Nm ksh ,
|
.Nm ksh ,
|
||||||
@ -3812,10 +3816,6 @@ and this autodetection feature was requested at compilation time.
|
|||||||
As a side effect, setting this flag turns off
|
As a side effect, setting this flag turns off
|
||||||
.Ic braceexpand
|
.Ic braceexpand
|
||||||
mode, which can be turned back on manually.
|
mode, which can be turned back on manually.
|
||||||
.It Ic restricted
|
|
||||||
The shell is a restricted shell.
|
|
||||||
This option can only be used when the shell is invoked.
|
|
||||||
See above for a description of what this means.
|
|
||||||
.It Ic vi
|
.It Ic vi
|
||||||
Enable
|
Enable
|
||||||
.Xr vi 1 Ns -like
|
.Xr vi 1 Ns -like
|
||||||
@ -3856,9 +3856,9 @@ If no options or arguments are given, the values of all names are printed.
|
|||||||
For unknown historical reasons, a lone
|
For unknown historical reasons, a lone
|
||||||
.Ql \-
|
.Ql \-
|
||||||
option is treated specially \*(en it clears both the
|
option is treated specially \*(en it clears both the
|
||||||
.Fl x
|
|
||||||
and
|
|
||||||
.Fl v
|
.Fl v
|
||||||
|
and
|
||||||
|
.Fl x
|
||||||
options.
|
options.
|
||||||
.Pp
|
.Pp
|
||||||
.It Ic shift Op Ar number
|
.It Ic shift Op Ar number
|
||||||
|
49
sh.h
49
sh.h
@ -134,7 +134,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.344 2009/09/20 13:08:11 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.345 2009/09/20 16:40:57 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R39 2009/09/19"
|
#define MKSH_VERSION "R39 2009/09/19"
|
||||||
|
|
||||||
@ -548,54 +548,13 @@ extern const struct shoption options[];
|
|||||||
* flags (the order of these enums MUST match the order in misc.c(options[]))
|
* flags (the order of these enums MUST match the order in misc.c(options[]))
|
||||||
*/
|
*/
|
||||||
enum sh_flag {
|
enum sh_flag {
|
||||||
FEXPORT = 0, /* -a: export all */
|
#define SHFLAGS_ENUMS
|
||||||
#if HAVE_ARC4RANDOM
|
#include "sh_flags.h"
|
||||||
FARC4RANDOM, /* use 0:rand(3) 1:arc4random(3) 2:switch on write */
|
|
||||||
#endif
|
|
||||||
FBRACEEXPAND, /* enable {} globbing */
|
|
||||||
#if HAVE_NICE
|
|
||||||
FBGNICE, /* bgnice */
|
|
||||||
#endif
|
|
||||||
FCOMMAND, /* -c: (invocation) execute specified command */
|
|
||||||
FEMACS, /* emacs command editing */
|
|
||||||
FERREXIT, /* -e: quit on error */
|
|
||||||
FGMACS, /* gmacs command editing */
|
|
||||||
FIGNOREEOF, /* eof does not exit */
|
|
||||||
FTALKING, /* -i: interactive */
|
|
||||||
FKEYWORD, /* -k: name=value anywhere */
|
|
||||||
FLOGIN, /* -l: a login shell */
|
|
||||||
FMARKDIRS, /* mark dirs with / in file name completion */
|
|
||||||
FMONITOR, /* -m: job control monitoring */
|
|
||||||
FNOCLOBBER, /* -C: don't overwrite existing files */
|
|
||||||
FNOEXEC, /* -n: don't execute any commands */
|
|
||||||
FNOGLOB, /* -f: don't do file globbing */
|
|
||||||
FNOHUP, /* -H: don't kill running jobs when login shell exits */
|
|
||||||
FNOLOG, /* don't save functions in history (ignored) */
|
|
||||||
#ifndef MKSH_UNEMPLOYED
|
|
||||||
FNOTIFY, /* -b: asynchronous job completion notification */
|
|
||||||
#endif
|
|
||||||
FNOUNSET, /* -u: using an unset var is an error */
|
|
||||||
FPHYSICAL, /* -o physical: don't do logical cds/pwds */
|
|
||||||
FPOSIX, /* -o posix (try to be more compatible) */
|
|
||||||
FPRIVILEGED, /* -p: use suid_profile */
|
|
||||||
FRESTRICTED, /* -r: restricted shell */
|
|
||||||
FSTDIN, /* -s: (invocation) parse stdin */
|
|
||||||
FTRACKALL, /* -h: create tracked aliases for all commands */
|
|
||||||
FUTFMODE, /* -U: enable utf-8 processing */
|
|
||||||
FVERBOSE, /* -v: echo input */
|
|
||||||
#ifndef MKSH_NOVI
|
|
||||||
FVI, /* vi command editing */
|
|
||||||
FVIRAW, /* always read in raw mode (ignored) */
|
|
||||||
FVITABCOMPLETE, /* enable tab as file name completion char */
|
|
||||||
FVIESCCOMPLETE, /* enable ESC as file name completion in command mode */
|
|
||||||
#endif
|
|
||||||
FXTRACE, /* -x: execution trace */
|
|
||||||
FTALKING_I, /* (internal): initial shell was interactive */
|
|
||||||
FNFLAGS /* (place holder: how many flags are there) */
|
FNFLAGS /* (place holder: how many flags are there) */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define Flag(f) (shell_flags[(int)(f)])
|
#define Flag(f) (shell_flags[(int)(f)])
|
||||||
#define UTFMODE Flag(FUTFMODE)
|
#define UTFMODE Flag(FUNICODE)
|
||||||
|
|
||||||
EXTERN unsigned char shell_flags[FNFLAGS];
|
EXTERN unsigned char shell_flags[FNFLAGS];
|
||||||
|
|
||||||
|
145
sh_flags.h
Normal file
145
sh_flags.h
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
#if defined(SHFLAGS_DEFNS)
|
||||||
|
__RCSID("$MirOS: src/bin/mksh/sh_flags.h,v 1.1 2009/09/20 16:40:58 tg Exp $");
|
||||||
|
#define FN(sname,cname,ochar,flags) /* nothing */
|
||||||
|
#elif defined(SHFLAGS_ENUMS)
|
||||||
|
#define FN(sname,cname,ochar,flags) cname,
|
||||||
|
#define F0(sname,cname,ochar,flags) cname = 0,
|
||||||
|
#elif defined(SHFLAGS_ITEMS)
|
||||||
|
#define FN(sname,cname,ochar,flags) { sname, ochar, flags },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef F0
|
||||||
|
#define F0 FN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* special cases (see parse_args()): -A, -o, -s
|
||||||
|
*
|
||||||
|
* options are sorted by their longnames
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* -a all new parameters are created with the export attribute */
|
||||||
|
F0("allexport", FEXPORT, 'a', OF_ANY)
|
||||||
|
|
||||||
|
#if HAVE_ARC4RANDOM
|
||||||
|
/* ./. for $RANDOM (non-standard), use the following function scheme: */
|
||||||
|
/* 0:rand(3) 1:arc4random(3) 2:switch from 1 to 0 on write */
|
||||||
|
FN("arc4random", FARC4RANDOM, 0, OF_ANY)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_NICE
|
||||||
|
/* ./. bgnice */
|
||||||
|
FN("bgnice", FBGNICE, 0, OF_ANY)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ./. enable {} globbing (non-standard) */
|
||||||
|
FN("braceexpand", FBRACEEXPAND, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* ./. Emacs command line editing mode */
|
||||||
|
FN("emacs", FEMACS, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* -e quit on error */
|
||||||
|
FN("errexit", FERREXIT, 'e', OF_ANY)
|
||||||
|
|
||||||
|
/* ./. Emacs command line editing mode, gmacs variant */
|
||||||
|
FN("gmacs", FGMACS, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* ./. reading EOF does not exit */
|
||||||
|
FN("ignoreeof", FIGNOREEOF, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* -i interactive shell */
|
||||||
|
FN("interactive", FTALKING, 'i', OF_CMDLINE)
|
||||||
|
|
||||||
|
/* -k name=value are recognised anywhere */
|
||||||
|
FN("keyword", FKEYWORD, 'k', OF_ANY)
|
||||||
|
|
||||||
|
/* -l login shell */
|
||||||
|
FN("login", FLOGIN, 'l', OF_CMDLINE)
|
||||||
|
|
||||||
|
/* -X mark dirs with / in file name completion */
|
||||||
|
FN("markdirs", FMARKDIRS, 'X', OF_ANY)
|
||||||
|
|
||||||
|
#ifndef MKSH_UNEMPLOYED
|
||||||
|
/* -m job control monitoring */
|
||||||
|
FN("monitor", FMONITOR, 'm', OF_ANY)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* -C don't overwrite existing files */
|
||||||
|
FN("noclobber", FNOCLOBBER, 'C', OF_ANY)
|
||||||
|
|
||||||
|
/* -n don't execute any commands */
|
||||||
|
FN("noexec", FNOEXEC, 'n', OF_ANY)
|
||||||
|
|
||||||
|
/* -f don't do file globbing */
|
||||||
|
FN("noglob", FNOGLOB, 'f', OF_ANY)
|
||||||
|
|
||||||
|
/* ./. don't kill running jobs when login shell exits */
|
||||||
|
FN("nohup", FNOHUP, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* ./. don't save functions in history (no effect) */
|
||||||
|
FN("nolog", FNOLOG, 0, OF_ANY)
|
||||||
|
|
||||||
|
#ifndef MKSH_UNEMPLOYED
|
||||||
|
/* -b asynchronous job completion notification */
|
||||||
|
FN("notify", FNOTIFY, 'b', OF_ANY)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* -u using an unset variable is an error */
|
||||||
|
FN("nounset", FNOUNSET, 'u', OF_ANY)
|
||||||
|
|
||||||
|
/* ./. don't do logical cds/pwds (non-standard) */
|
||||||
|
FN("physical", FPHYSICAL, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* ./. mock POSIX mode (try to be more compatible; non-standard) */
|
||||||
|
FN("posix", FPOSIX, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* -p use suid_profile; privileged shell */
|
||||||
|
FN("privileged", FPRIVILEGED, 'p', OF_ANY)
|
||||||
|
|
||||||
|
/* -r restricted shell */
|
||||||
|
FN("restricted", FRESTRICTED, 'r', OF_CMDLINE)
|
||||||
|
|
||||||
|
/* -s (invocation) parse stdin (pseudo non-standard) */
|
||||||
|
FN("stdin", FSTDIN, 's', OF_CMDLINE)
|
||||||
|
|
||||||
|
/* -h create tracked aliases for all commands */
|
||||||
|
FN("trackall", FTRACKALL, 'h', OF_ANY)
|
||||||
|
|
||||||
|
/* -U enable UTF-8 processing (non-standard) */
|
||||||
|
FN("utf8-mode", FUNICODE, 'U', OF_ANY)
|
||||||
|
|
||||||
|
/* -v echo input */
|
||||||
|
FN("verbose", FVERBOSE, 'v', OF_ANY)
|
||||||
|
|
||||||
|
#ifndef MKSH_NOVI
|
||||||
|
/* ./. Vi command line editing mode */
|
||||||
|
FN("vi", FVI, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* ./. enable ESC as file name completion character (non-standard) */
|
||||||
|
FN("vi-esccomplete", FVIESCCOMPLETE, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* ./. enable Tab as file name completion character (non-standard) */
|
||||||
|
FN("vi-tabcomplete", FVITABCOMPLETE, 0, OF_ANY)
|
||||||
|
|
||||||
|
/* ./. always read in raw mode (no effect) */
|
||||||
|
FN("viraw", FVIRAW, 0, OF_ANY)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* -x execution trace (display commands as they are run) */
|
||||||
|
FN("xtrace", FXTRACE, 'x', OF_ANY)
|
||||||
|
|
||||||
|
/* -c (invocation) execute specified command */
|
||||||
|
FN(NULL, FCOMMAND, 'c', OF_CMDLINE)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* anonymous flags: used internally by shell only (not visible to user)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ./. (internal) initial shell was interactive */
|
||||||
|
FN(NULL, FTALKING_I, 0, OF_INTERNAL)
|
||||||
|
|
||||||
|
#undef FN
|
||||||
|
#undef F0
|
||||||
|
#undef SHFLAGS_DEFNS
|
||||||
|
#undef SHFLAGS_ENUMS
|
||||||
|
#undef SHFLAGS_ITEMS
|
Loading…
x
Reference in New Issue
Block a user