aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-05-19 19:11:21 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-05-19 19:11:21 +0200
commitd8740b265a4d4e428b3494089d5a86e1ec90238a (patch)
tree30a3729451c85156fbdbfdef2463eeb2fef5e00b
parent76a4e8361a84efca256d4286cf36561c42c14d64 (diff)
downloadbusybox-w32-d8740b265a4d4e428b3494089d5a86e1ec90238a.tar.gz
busybox-w32-d8740b265a4d4e428b3494089d5a86e1ec90238a.tar.bz2
busybox-w32-d8740b265a4d4e428b3494089d5a86e1ec90238a.zip
hush: show 's' in $-
function old new delta expand_one_var 2362 2375 +13 hush_main 1104 1108 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 17/0) Total: 17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 4dd940222..4b08232a4 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -902,6 +902,7 @@ struct globals {
902#else 902#else
903# define G_x_mode 0 903# define G_x_mode 0
904#endif 904#endif
905 char opt_s;
905#if ENABLE_HUSH_INTERACTIVE 906#if ENABLE_HUSH_INTERACTIVE
906 smallint promptmode; /* 0: PS1, 1: PS2 */ 907 smallint promptmode; /* 0: PS1, 1: PS2 */
907#endif 908#endif
@@ -1008,7 +1009,7 @@ struct globals {
1008 int debug_indent; 1009 int debug_indent;
1009#endif 1010#endif
1010 struct sigaction sa; 1011 struct sigaction sa;
1011 char optstring_buf[sizeof("eix")]; 1012 char optstring_buf[sizeof("eixs")];
1012#if BASH_EPOCH_VARS 1013#if BASH_EPOCH_VARS
1013 char epoch_buf[sizeof("%lu.nnnnnn") + sizeof(long)*3]; 1014 char epoch_buf[sizeof("%lu.nnnnnn") + sizeof(long)*3];
1014#endif 1015#endif
@@ -6413,8 +6414,9 @@ static NOINLINE int expand_one_var(o_string *output, int n,
6413 * commands read but are not executed, 6414 * commands read but are not executed,
6414 * so $- can not execute too, 'n' is never seen in $-. 6415 * so $- can not execute too, 'n' is never seen in $-.
6415 */ 6416 */
6417 if (G.opt_s)
6418 *cp++ = 's';
6416//TODO: show 'c' if executed via "hush -c 'CMDS'" (bash only, not ash) 6419//TODO: show 'c' if executed via "hush -c 'CMDS'" (bash only, not ash)
6417//TODO: show 's' if executed via "hush -s ARG1 ARG2", or if there were no args except options (ash does this too)
6418 *cp = '\0'; 6420 *cp = '\0';
6419 break; 6421 break;
6420 } 6422 }
@@ -9958,7 +9960,6 @@ int hush_main(int argc, char **argv)
9958 * PS4='+ ' 9960 * PS4='+ '
9959 */ 9961 */
9960 9962
9961
9962 /* Initialize some more globals to non-zero values */ 9963 /* Initialize some more globals to non-zero values */
9963 die_func = restore_ttypgrp_and__exit; 9964 die_func = restore_ttypgrp_and__exit;
9964 9965
@@ -10177,6 +10178,7 @@ int hush_main(int argc, char **argv)
10177#endif 10178#endif
10178 goto final_return; 10179 goto final_return;
10179 } 10180 }
10181 G.opt_s = 1;
10180 10182
10181 /* Up to here, shell was non-interactive. Now it may become one. 10183 /* Up to here, shell was non-interactive. Now it may become one.
10182 * NB: don't forget to (re)run install_special_sighandlers() as needed. 10184 * NB: don't forget to (re)run install_special_sighandlers() as needed.