aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2010-11-20 13:05:17 -0800
committerDenys Vlasenko <vda.linux@googlemail.com>2010-11-28 03:56:39 +0100
commit85c62470b75b9256e36d8f488a0701aff94ca512 (patch)
tree64ca1cb31637f684755e54d180002c163d0626a3
parent89ca2f99a20e78f392fb95d52d62cb32925bc9b2 (diff)
downloadbusybox-w32-85c62470b75b9256e36d8f488a0701aff94ca512.tar.gz
busybox-w32-85c62470b75b9256e36d8f488a0701aff94ca512.tar.bz2
busybox-w32-85c62470b75b9256e36d8f488a0701aff94ca512.zip
Support set -o xtrace/noexec alternates for set -x/-n
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/shell/hush.c b/shell/hush.c
index a710f7cd9..0cc587e19 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -673,9 +673,19 @@ struct function {
673 * vi off 673 * vi off
674 * xtrace off 674 * xtrace off
675 */ 675 */
676static const char o_opt_strings[] ALIGN1 = "pipefail\0"; 676static const char o_opt_strings[] ALIGN1 =
677 "pipefail\0"
678 "noexec\0"
679#if ENABLE_HUSH_MODE_X
680 "xtrace\0"
681#endif
682 ;
677enum { 683enum {
678 OPT_O_PIPEFAIL, 684 OPT_O_PIPEFAIL,
685 OPT_O_NOEXEC,
686#if ENABLE_HUSH_MODE_X
687 OPT_O_XTRACE,
688#endif
679 NUM_OPT_O 689 NUM_OPT_O
680}; 690};
681 691
@@ -734,10 +744,8 @@ struct globals {
734 */ 744 */
735 smallint flag_return_in_progress; 745 smallint flag_return_in_progress;
736#endif 746#endif
737 smallint n_mode;
738#if ENABLE_HUSH_MODE_X 747#if ENABLE_HUSH_MODE_X
739 smallint x_mode; 748# define G_x_mode (G.o_opt[OPT_O_XTRACE])
740# define G_x_mode (G.x_mode)
741#else 749#else
742# define G_x_mode 0 750# define G_x_mode 0
743#endif 751#endif
@@ -7304,7 +7312,7 @@ static int run_and_free_list(struct pipe *pi)
7304{ 7312{
7305 int rcode = 0; 7313 int rcode = 0;
7306 debug_printf_exec("run_and_free_list entered\n"); 7314 debug_printf_exec("run_and_free_list entered\n");
7307 if (!G.n_mode) { 7315 if (!G.o_opt[OPT_O_NOEXEC]) {
7308 debug_printf_exec(": run_list: 1st pipe with %d cmds\n", pi->num_cmds); 7316 debug_printf_exec(": run_list: 1st pipe with %d cmds\n", pi->num_cmds);
7309 rcode = run_list(pi); 7317 rcode = run_list(pi);
7310 } 7318 }
@@ -7407,7 +7415,7 @@ static int set_mode(int state, char mode, const char *o_opt)
7407 int idx; 7415 int idx;
7408 switch (mode) { 7416 switch (mode) {
7409 case 'n': 7417 case 'n':
7410 G.n_mode = state; 7418 G.o_opt[OPT_O_NOEXEC] = state;
7411 break; 7419 break;
7412 case 'x': 7420 case 'x':
7413 IF_HUSH_MODE_X(G_x_mode = state;) 7421 IF_HUSH_MODE_X(G_x_mode = state;)