From 200c1c46f4aa2cb70e0e3581a5bd8aa72a1aac0f Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 8 Nov 2013 14:12:13 +0100 Subject: ash: Use setvar2 some more (add/remove: 0/0 grow/shrink: 10/15 up/down: 13/-27) Total: -14 bytes Signed-off-by: Bernhard Reutner-Fischer --- shell/ash.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index d696bbdac..f9b4d3fe6 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2286,7 +2286,7 @@ unsetvar(const char *s) free(vp); INT_ON; } else { - setvar(s, 0, 0); + setvar2(s, 0); vp->flags &= ~VEXPORT; } ok: @@ -6339,7 +6339,7 @@ subevalvar(char *p, char *varname, int strloc, int subtype, switch (subtype) { case VSASSIGN: - setvar(varname, startp, 0); + setvar2(varname, startp); amount = startp - expdest; STADJUST(amount, expdest); return startp; @@ -8554,7 +8554,7 @@ evalfor(union node *n, int flags) loopnest++; flags &= EV_TESTED; for (sp = arglist.list; sp; sp = sp->next) { - setvar(n->nfor.var, sp->text, 0); + setvar2(n->nfor.var, sp->text); evaltree(n->nfor.body, flags); if (evalskip) { if (evalskip == SKIPCONT && --skipcount <= 0) { @@ -9451,7 +9451,7 @@ evalcommand(union node *cmd, int flags) * '_' in 'vi' command mode during line editing... * However I implemented that within libedit itself. */ - setvar("_", lastarg, 0); + setvar2("_", lastarg); } popstackmark(&smark); } @@ -12273,7 +12273,6 @@ dotcmd(int argc, char **argv) * bash returns exitcode 1 instead. */ fullname = find_dot_file(argv[1]); - argv += 2; argc -= 2; if (argc) { /* argc > 0, argv[0] != NULL */ @@ -13012,7 +13011,7 @@ init(void) } } - setvar("PPID", utoa(getppid()), 0); + setvar2("PPID", utoa(getppid())); p = lookupvar("PWD"); if (p) { @@ -13267,7 +13266,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv) hp = lookupvar("HOME"); if (hp) { hp = concat_path_file(hp, ".ash_history"); - setvar("HISTFILE", hp, 0); + setvar2("HISTFILE", hp); free((char*)hp); hp = lookupvar("HISTFILE"); } -- cgit v1.2.3-55-g6feb From 80f8cdf04ad0e8b37c20aed883b6cbfd6636dbc3 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 8 Nov 2013 14:25:24 +0100 Subject: ash: Set SHLVL in ASH_BASH_COMPAT function old new delta ash_main 1456 1505 +49 .rodata 148488 148494 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 55/0) Total: 55 bytes Signed-off-by: Bernhard Reutner-Fischer --- shell/ash.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index f9b4d3fe6..71ef9a690 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -13012,7 +13012,10 @@ init(void) } setvar2("PPID", utoa(getppid())); - +#if ENABLE_ASH_BASH_COMPAT + p = lookupvar("SHLVL"); + setvar2("SHLVL", utoa(p ? atoi(p) + 1 : 1)); +#endif p = lookupvar("PWD"); if (p) { if (*p != '/' || stat(p, &st1) || stat(".", &st2) -- cgit v1.2.3-55-g6feb From 8bd810bd276d20451faafdae88df4af9c2dd96d1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 28 Nov 2013 01:50:01 +0100 Subject: hush: typo fixes in comments Signed-off-by: Denys Vlasenko --- shell/hush.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shell') diff --git a/shell/hush.c b/shell/hush.c index 912ecf15f..927193450 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -1310,7 +1310,7 @@ static void restore_G_args(save_arg_t *sv, char **argv) * backgrounds (i.e. stops) or kills all members of currently running * pipe. * - * Wait builtin in interruptible by signals for which user trap is set + * Wait builtin is interruptible by signals for which user trap is set * or by SIGINT in interactive shell. * * Trap handlers will execute even within trap handlers. (right?) @@ -1398,7 +1398,7 @@ static void restore_G_args(save_arg_t *sv, char **argv) * for them - a bit like emulating kernel pending signal mask in userspace. * We are interested in: signals which need to have special handling * as described above, and all signals which have traps set. - * Signals are rocorded in pending_set. + * Signals are recorded in pending_set. * After each pipe execution, we extract any pending signals * and act on them. * -- cgit v1.2.3-55-g6feb