ok, -rHEAD shall be unbroken

This commit is contained in:
tg 2007-01-15 00:18:47 +00:00
parent 84085a8747
commit a712de8e63
3 changed files with 16 additions and 14 deletions

13
exec.c
View File

@ -2,7 +2,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.22 2007/01/12 10:18:20 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/exec.c,v 1.23 2007/01/15 00:18:47 tg Exp $");
static int comexec(struct op *, struct tbl *volatile, char **, static int comexec(struct op *, struct tbl *volatile, char **,
int volatile); int volatile);
@ -665,16 +665,17 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags)
static void static void
scriptexec(struct op *tp, char **ap) scriptexec(struct op *tp, char **ap)
{ {
static char execshell[] = "/bin/sh";
const char *sh; const char *sh;
sh = str_val(global("EXECSHELL")); sh = str_val(global("EXECSHELL"));
if (sh && *sh) if (sh && *sh)
sh = search(sh, path, X_OK, NULL); sh = search(sh, path, X_OK, NULL);
if (!sh || !*sh) if (!sh || !*sh)
sh = "/bin/sh"; sh = execshell;
*tp->args-- = tp->str; *tp->args-- = tp->str;
*tp->args = sh; *tp->args = str_save(sh, ATEMP);
execve(tp->args[0], tp->args, ap); execve(tp->args[0], tp->args, ap);
@ -1194,8 +1195,10 @@ herein(const char *content, int sub)
static char * static char *
do_selectargs(char **ap, bool print_menu) do_selectargs(char **ap, bool print_menu)
{ {
static const char *const read_args[] = { static char read_args0[] = "read",
"read", "-r", "REPLY", NULL read_args1[] = "-r", read_args2[] = "REPLY",
*read_args[] = {
read_args0, read_args1, read_args2, NULL
}; };
char *s; char *s;
int i, argct; int i, argct;

10
funcs.c
View File

@ -5,7 +5,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.44 2007/01/14 23:57:44 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.45 2007/01/15 00:18:47 tg Exp $");
int int
c_cd(char **wp) c_cd(char **wp)
@ -856,9 +856,8 @@ c_alias(char **wp)
/* "hash -r" means reset all the tracked aliases.. */ /* "hash -r" means reset all the tracked aliases.. */
if (rflag) { if (rflag) {
static const char *const args[] = { static char args0[] = "unalias", args1[] = "-ta",
"unalias", "-ta", NULL *args[] = { args0, args1, NULL };
};
if (!tflag || *wp) { if (!tflag || *wp) {
shprintf("alias: -r flag can only be used with -t" shprintf("alias: -r flag can only be used with -t"
@ -1964,7 +1963,8 @@ c_set(char **wp)
char **owp = wp; char **owp = wp;
if (wp[1] == NULL) { if (wp[1] == NULL) {
static const char *const args [] = { "set", "-", NULL }; static char args0[] = "set", args1[] = "-",
*args[] = { args0, args1, NULL };
return c_typeset(args); return c_typeset(args);
} }

7
main.c
View File

@ -13,7 +13,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.67 2007/01/12 10:18:21 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/main.c,v 1.68 2007/01/15 00:18:47 tg Exp $");
extern char **environ; extern char **environ;
@ -82,9 +82,8 @@ main(int argc, char *argv[])
/* make sure argv[] is sane */ /* make sure argv[] is sane */
if (!*argv) { if (!*argv) {
static const char *empty_argv[] = { static char empty_argv0[] = "mksh",
"mksh", NULL *empty_argv[] = { empty_argv0, NULL };
};
argv = empty_argv; argv = empty_argv;
argc = 1; argc = 1;