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>
This commit is contained in:
parent
76a4e8361a
commit
d8740b265a
@ -902,6 +902,7 @@ struct globals {
|
|||||||
#else
|
#else
|
||||||
# define G_x_mode 0
|
# define G_x_mode 0
|
||||||
#endif
|
#endif
|
||||||
|
char opt_s;
|
||||||
#if ENABLE_HUSH_INTERACTIVE
|
#if ENABLE_HUSH_INTERACTIVE
|
||||||
smallint promptmode; /* 0: PS1, 1: PS2 */
|
smallint promptmode; /* 0: PS1, 1: PS2 */
|
||||||
#endif
|
#endif
|
||||||
@ -1008,7 +1009,7 @@ struct globals {
|
|||||||
int debug_indent;
|
int debug_indent;
|
||||||
#endif
|
#endif
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
char optstring_buf[sizeof("eix")];
|
char optstring_buf[sizeof("eixs")];
|
||||||
#if BASH_EPOCH_VARS
|
#if BASH_EPOCH_VARS
|
||||||
char epoch_buf[sizeof("%lu.nnnnnn") + sizeof(long)*3];
|
char epoch_buf[sizeof("%lu.nnnnnn") + sizeof(long)*3];
|
||||||
#endif
|
#endif
|
||||||
@ -6413,8 +6414,9 @@ static NOINLINE int expand_one_var(o_string *output, int n,
|
|||||||
* commands read but are not executed,
|
* commands read but are not executed,
|
||||||
* so $- can not execute too, 'n' is never seen in $-.
|
* so $- can not execute too, 'n' is never seen in $-.
|
||||||
*/
|
*/
|
||||||
|
if (G.opt_s)
|
||||||
|
*cp++ = 's';
|
||||||
//TODO: show 'c' if executed via "hush -c 'CMDS'" (bash only, not ash)
|
//TODO: show 'c' if executed via "hush -c 'CMDS'" (bash only, not ash)
|
||||||
//TODO: show 's' if executed via "hush -s ARG1 ARG2", or if there were no args except options (ash does this too)
|
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -9958,7 +9960,6 @@ int hush_main(int argc, char **argv)
|
|||||||
* PS4='+ '
|
* PS4='+ '
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* Initialize some more globals to non-zero values */
|
/* Initialize some more globals to non-zero values */
|
||||||
die_func = restore_ttypgrp_and__exit;
|
die_func = restore_ttypgrp_and__exit;
|
||||||
|
|
||||||
@ -10177,6 +10178,7 @@ int hush_main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
goto final_return;
|
goto final_return;
|
||||||
}
|
}
|
||||||
|
G.opt_s = 1;
|
||||||
|
|
||||||
/* Up to here, shell was non-interactive. Now it may become one.
|
/* Up to here, shell was non-interactive. Now it may become one.
|
||||||
* NB: don't forget to (re)run install_special_sighandlers() as needed.
|
* NB: don't forget to (re)run install_special_sighandlers() as needed.
|
||||||
|
Loading…
Reference in New Issue
Block a user