diff options
-rw-r--r-- | shell/hush.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/shell/hush.c b/shell/hush.c index 8f1017e3c..e005b0a20 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -6614,24 +6614,22 @@ static void parse_and_run_stream(struct in_str *inp, int end_trigger) | |||
6614 | static void parse_and_run_string(const char *s) | 6614 | static void parse_and_run_string(const char *s) |
6615 | { | 6615 | { |
6616 | struct in_str input; | 6616 | struct in_str input; |
6617 | //IF_HUSH_LINENO_VAR(unsigned sv = G.lineno;) | ||
6618 | |||
6617 | setup_string_in_str(&input, s); | 6619 | setup_string_in_str(&input, s); |
6618 | parse_and_run_stream(&input, '\0'); | 6620 | parse_and_run_stream(&input, '\0'); |
6621 | //IF_HUSH_LINENO_VAR(G.lineno = sv;) | ||
6619 | } | 6622 | } |
6620 | 6623 | ||
6621 | static void parse_and_run_file(FILE *f) | 6624 | static void parse_and_run_file(FILE *f) |
6622 | { | 6625 | { |
6623 | struct in_str input; | 6626 | struct in_str input; |
6624 | #if ENABLE_HUSH_LINENO_VAR | 6627 | IF_HUSH_LINENO_VAR(unsigned sv = G.lineno;) |
6625 | unsigned sv; | ||
6626 | 6628 | ||
6627 | sv = G.lineno; | 6629 | IF_HUSH_LINENO_VAR(G.lineno = 1;) |
6628 | G.lineno = 1; | ||
6629 | #endif | ||
6630 | setup_file_in_str(&input, f); | 6630 | setup_file_in_str(&input, f); |
6631 | parse_and_run_stream(&input, ';'); | 6631 | parse_and_run_stream(&input, ';'); |
6632 | #if ENABLE_HUSH_LINENO_VAR | 6632 | IF_HUSH_LINENO_VAR(G.lineno = sv;) |
6633 | G.lineno = sv; | ||
6634 | #endif | ||
6635 | } | 6633 | } |
6636 | 6634 | ||
6637 | #if ENABLE_HUSH_TICK | 6635 | #if ENABLE_HUSH_TICK |
@@ -6744,16 +6742,16 @@ static FILE *generate_stream_from_string(const char *s, pid_t *pid_p) | |||
6744 | static int process_command_subs(o_string *dest, const char *s) | 6742 | static int process_command_subs(o_string *dest, const char *s) |
6745 | { | 6743 | { |
6746 | FILE *fp; | 6744 | FILE *fp; |
6747 | struct in_str pipe_str; | ||
6748 | pid_t pid; | 6745 | pid_t pid; |
6749 | int status, ch, eol_cnt; | 6746 | int status, ch, eol_cnt; |
6750 | 6747 | ||
6751 | fp = generate_stream_from_string(s, &pid); | 6748 | fp = generate_stream_from_string(s, &pid); |
6752 | 6749 | ||
6753 | /* Now send results of command back into original context */ | 6750 | /* Now send results of command back into original context */ |
6754 | setup_file_in_str(&pipe_str, fp); | ||
6755 | eol_cnt = 0; | 6751 | eol_cnt = 0; |
6756 | while ((ch = i_getch(&pipe_str)) != EOF) { | 6752 | while ((ch = getc(fp)) != EOF) { |
6753 | if (ch == '\0') | ||
6754 | continue; | ||
6757 | if (ch == '\n') { | 6755 | if (ch == '\n') { |
6758 | eol_cnt++; | 6756 | eol_cnt++; |
6759 | continue; | 6757 | continue; |