diff --git a/exec.c b/exec.c index 2bc6ffb..72424e6 100644 --- a/exec.c +++ b/exec.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.16 2006/08/01 13:43:26 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.17 2006/11/10 01:44:39 tg Exp $"); static int comexec(struct op *, struct tbl *volatile, char **, int volatile); @@ -665,13 +665,14 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags) static void scriptexec(struct op *tp, char **ap) { + static char execshell[] = "/bin/sh"; char *sh; - sh = str_val(global(EXECSHELL_STR)); + sh = str_val(global("EXECSHELL")); if (sh && *sh) sh = search(sh, path, X_OK, NULL); if (!sh || !*sh) - sh = strdup(EXECSHELL); + sh = execshell; *tp->args-- = tp->str; *tp->args = sh; diff --git a/misc.c b/misc.c index badcf18..e810681 100644 --- a/misc.c +++ b/misc.c @@ -3,7 +3,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.24 2006/11/10 01:19:17 tg Exp $\t" +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.25 2006/11/10 01:44:39 tg Exp $\t" MKSH_SH_H_ID); unsigned char chtypes[UCHAR_MAX + 1]; /* type bits for unsigned char */ @@ -149,10 +149,7 @@ option(const char *n) struct options_info { int opt_width; - struct { - const char *name; - int flag; - } opts[NELEM(options)]; + int opts[NELEM(options)]; }; static char *options_fmt_entry(void *arg, int i, char *buf, int buflen); @@ -165,8 +162,8 @@ options_fmt_entry(void *arg, int i, char *buf, int buflen) struct options_info *oi = (struct options_info *) arg; shf_snprintf(buf, buflen, "%-*s %s", - oi->opt_width, oi->opts[i].name, - Flag(oi->opts[i].flag) ? "on" : "off"); + oi->opt_width, options[oi->opts[i]].name, + Flag(oi->opts[i]) ? "on" : "off"); return buf; } @@ -185,8 +182,7 @@ printoptions(int verbose) for (i = n = oi.opt_width = 0; i < NELEM(options); i++) if (options[i].name) { len = strlen(options[i].name); - oi.opts[n].name = options[i].name; - oi.opts[n++].flag = i; + oi.opts[n++] = i; if (len > oi.opt_width) oi.opt_width = len; } diff --git a/sh.h b/sh.h index 0d3b989..d64f49b 100644 --- a/sh.h +++ b/sh.h @@ -8,7 +8,7 @@ /* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ /* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */ -#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.70 2006/11/10 01:25:22 tg Exp $" +#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.71 2006/11/10 01:44:40 tg Exp $" #define MKSH_VERSION "R29 2006/11/10" #if HAVE_SYS_PARAM_H @@ -135,9 +135,6 @@ extern int __cdecl setegid(gid_t); # define EXTERN_DEFINED #endif -#define EXECSHELL "/bin/mksh" -#define EXECSHELL_STR "EXECSHELL" - #define NELEM(a) (sizeof (a) / sizeof ((a)[0])) #define sizeofN(typ, n) (sizeof (typ) * (n)) #define BIT(i) (1 << (i)) /* define bit in flag */