diff options
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c index 27092c12f..6d472337f 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -2753,6 +2753,12 @@ static int i_getch(struct in_str *i) | |||
2753 | if (ch != '\0') { | 2753 | if (ch != '\0') { |
2754 | i->p++; | 2754 | i->p++; |
2755 | i->last_char = ch; | 2755 | i->last_char = ch; |
2756 | #if ENABLE_HUSH_LINENO_VAR | ||
2757 | if (ch == '\n') { | ||
2758 | G.parse_lineno++; | ||
2759 | debug_printf_parse("G.parse_lineno++ = %u\n", G.parse_lineno); | ||
2760 | } | ||
2761 | #endif | ||
2756 | return ch; | 2762 | return ch; |
2757 | } | 2763 | } |
2758 | return EOF; | 2764 | return EOF; |
@@ -7540,11 +7546,11 @@ static void parse_and_run_stream(struct in_str *inp, int end_trigger) | |||
7540 | static void parse_and_run_string(const char *s) | 7546 | static void parse_and_run_string(const char *s) |
7541 | { | 7547 | { |
7542 | struct in_str input; | 7548 | struct in_str input; |
7543 | //IF_HUSH_LINENO_VAR(unsigned sv = G.parse_lineno;) | 7549 | IF_HUSH_LINENO_VAR(unsigned sv = G.parse_lineno;) |
7544 | 7550 | ||
7545 | setup_string_in_str(&input, s); | 7551 | setup_string_in_str(&input, s); |
7546 | parse_and_run_stream(&input, '\0'); | 7552 | parse_and_run_stream(&input, '\0'); |
7547 | //IF_HUSH_LINENO_VAR(G.parse_lineno = sv;) | 7553 | IF_HUSH_LINENO_VAR(G.parse_lineno = sv;) |
7548 | } | 7554 | } |
7549 | 7555 | ||
7550 | static void parse_and_run_file(HFILE *fp) | 7556 | static void parse_and_run_file(HFILE *fp) |
@@ -9898,7 +9904,8 @@ static int run_list(struct pipe *pi) | |||
9898 | #if ENABLE_HUSH_LOOPS | 9904 | #if ENABLE_HUSH_LOOPS |
9899 | G.flag_break_continue = 0; | 9905 | G.flag_break_continue = 0; |
9900 | #endif | 9906 | #endif |
9901 | rcode = r = run_pipe(pi); /* NB: rcode is a smalluint, r is int */ | 9907 | rcode = r = G.o_opt[OPT_O_NOEXEC] ? 0 : run_pipe(pi); |
9908 | /* NB: rcode is a smalluint, r is int */ | ||
9902 | if (r != -1) { | 9909 | if (r != -1) { |
9903 | /* We ran a builtin, function, or group. | 9910 | /* We ran a builtin, function, or group. |
9904 | * rcode is already known | 9911 | * rcode is already known |
@@ -10137,7 +10144,10 @@ static int set_mode(int state, char mode, const char *o_opt) | |||
10137 | int idx; | 10144 | int idx; |
10138 | switch (mode) { | 10145 | switch (mode) { |
10139 | case 'n': | 10146 | case 'n': |
10140 | G.o_opt[OPT_O_NOEXEC] = state; | 10147 | /* set -n has no effect in interactive shell */ |
10148 | /* Try: while set -n; do echo $-; done */ | ||
10149 | if (!G_interactive_fd) | ||
10150 | G.o_opt[OPT_O_NOEXEC] = state; | ||
10141 | break; | 10151 | break; |
10142 | case 'x': | 10152 | case 'x': |
10143 | IF_HUSH_MODE_X(G_x_mode = state;) | 10153 | IF_HUSH_MODE_X(G_x_mode = state;) |