diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-11-28 10:28:14 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-11-28 10:28:14 +0100 |
| commit | 259747caa7d86a5a46013b80a19b2ee2d4e0a73b (patch) | |
| tree | 539344bc2889d52cd8a68afe487815b8b6833634 /shell | |
| parent | 1b76ffaae400f266fe5aea0d5900a7e2ab9d7aa8 (diff) | |
| download | busybox-w32-259747caa7d86a5a46013b80a19b2ee2d4e0a73b.tar.gz busybox-w32-259747caa7d86a5a46013b80a19b2ee2d4e0a73b.tar.bz2 busybox-w32-259747caa7d86a5a46013b80a19b2ee2d4e0a73b.zip | |
hush: fix preprocessor directives indentation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/hush.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/shell/hush.c b/shell/hush.c index 25e5fb906..97202b953 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
| @@ -3653,9 +3653,9 @@ static void debug_print_tree(struct pipe *pi, int lvl) | |||
| 3653 | fdprintf(2, "%*s cmd %d assignment_cnt:%d", | 3653 | fdprintf(2, "%*s cmd %d assignment_cnt:%d", |
| 3654 | lvl*2, "", prn, | 3654 | lvl*2, "", prn, |
| 3655 | command->assignment_cnt); | 3655 | command->assignment_cnt); |
| 3656 | #if ENABLE_HUSH_LINENO_VAR | 3656 | # if ENABLE_HUSH_LINENO_VAR |
| 3657 | fdprintf(2, " LINENO:%u", command->lineno); | 3657 | fdprintf(2, " LINENO:%u", command->lineno); |
| 3658 | #endif | 3658 | # endif |
| 3659 | if (command->group) { | 3659 | if (command->group) { |
| 3660 | fdprintf(2, " group %s: (argv=%p)%s%s\n", | 3660 | fdprintf(2, " group %s: (argv=%p)%s%s\n", |
| 3661 | CMDTYPE[command->cmd_type], | 3661 | CMDTYPE[command->cmd_type], |
| @@ -4771,9 +4771,9 @@ static int add_till_closing_bracket(o_string *dest, struct in_str *input, unsign | |||
| 4771 | # endif | 4771 | # endif |
| 4772 | end_ch &= (DOUBLE_CLOSE_CHAR_FLAG - 1); | 4772 | end_ch &= (DOUBLE_CLOSE_CHAR_FLAG - 1); |
| 4773 | 4773 | ||
| 4774 | #if ENABLE_HUSH_INTERACTIVE | 4774 | # if ENABLE_HUSH_INTERACTIVE |
| 4775 | G.promptmode = 1; /* PS2 */ | 4775 | G.promptmode = 1; /* PS2 */ |
| 4776 | #endif | 4776 | # endif |
| 4777 | debug_printf_prompt("%s promptmode=%d\n", __func__, G.promptmode); | 4777 | debug_printf_prompt("%s promptmode=%d\n", __func__, G.promptmode); |
| 4778 | 4778 | ||
| 4779 | while (1) { | 4779 | while (1) { |
| @@ -4829,13 +4829,13 @@ static int add_till_closing_bracket(o_string *dest, struct in_str *input, unsign | |||
| 4829 | syntax_error_unterm_ch(end_ch); | 4829 | syntax_error_unterm_ch(end_ch); |
| 4830 | return 0; | 4830 | return 0; |
| 4831 | } | 4831 | } |
| 4832 | #if 0 | 4832 | # if 0 |
| 4833 | if (ch == '\n') { | 4833 | if (ch == '\n') { |
| 4834 | /* "backslash+newline", ignore both */ | 4834 | /* "backslash+newline", ignore both */ |
| 4835 | o_delchr(dest); /* undo insertion of '\' */ | 4835 | o_delchr(dest); /* undo insertion of '\' */ |
| 4836 | continue; | 4836 | continue; |
| 4837 | } | 4837 | } |
| 4838 | #endif | 4838 | # endif |
| 4839 | o_addchr(dest, ch); | 4839 | o_addchr(dest, ch); |
| 4840 | //bb_error_msg("%s:o_addchr('%c') after '\\'", __func__, ch); | 4840 | //bb_error_msg("%s:o_addchr('%c') after '\\'", __func__, ch); |
| 4841 | continue; | 4841 | continue; |
| @@ -4992,7 +4992,7 @@ static int parse_dollar(o_string *as_string, | |||
| 4992 | if (last_ch == 0) /* error? */ | 4992 | if (last_ch == 0) /* error? */ |
| 4993 | return 0; | 4993 | return 0; |
| 4994 | #else | 4994 | #else |
| 4995 | #error Simple code to only allow ${var} is not implemented | 4995 | # error Simple code to only allow ${var} is not implemented |
| 4996 | #endif | 4996 | #endif |
| 4997 | if (as_string) { | 4997 | if (as_string) { |
| 4998 | o_addstr(as_string, dest->data + pos); | 4998 | o_addstr(as_string, dest->data + pos); |
| @@ -8701,9 +8701,9 @@ static int process_wait_result(struct pipe *fg_pipe, pid_t childpid, int status) | |||
| 8701 | pi->cmds[i].pid = 0; | 8701 | pi->cmds[i].pid = 0; |
| 8702 | pi->alive_cmds--; | 8702 | pi->alive_cmds--; |
| 8703 | if (!pi->alive_cmds) { | 8703 | if (!pi->alive_cmds) { |
| 8704 | #if ENABLE_HUSH_BASH_COMPAT | 8704 | # if ENABLE_HUSH_BASH_COMPAT |
| 8705 | G.dead_job_exitcode = job_exited_or_stopped(pi); | 8705 | G.dead_job_exitcode = job_exited_or_stopped(pi); |
| 8706 | #endif | 8706 | # endif |
| 8707 | if (G_interactive_fd) { | 8707 | if (G_interactive_fd) { |
| 8708 | printf(JOB_STATUS_FORMAT, pi->jobid, | 8708 | printf(JOB_STATUS_FORMAT, pi->jobid, |
| 8709 | "Done", pi->cmdtext); | 8709 | "Done", pi->cmdtext); |
| @@ -10552,10 +10552,10 @@ static int FAST_FUNC builtin_type(char **argv) | |||
| 10552 | if (0) {} /* make conditional compile easier below */ | 10552 | if (0) {} /* make conditional compile easier below */ |
| 10553 | /*else if (find_alias(*argv)) | 10553 | /*else if (find_alias(*argv)) |
| 10554 | type = "an alias";*/ | 10554 | type = "an alias";*/ |
| 10555 | #if ENABLE_HUSH_FUNCTIONS | 10555 | # if ENABLE_HUSH_FUNCTIONS |
| 10556 | else if (find_function(*argv)) | 10556 | else if (find_function(*argv)) |
| 10557 | type = "a function"; | 10557 | type = "a function"; |
| 10558 | #endif | 10558 | # endif |
| 10559 | else if (find_builtin(*argv)) | 10559 | else if (find_builtin(*argv)) |
| 10560 | type = "a shell builtin"; | 10560 | type = "a shell builtin"; |
| 10561 | else if ((path = find_in_path(*argv)) != NULL) | 10561 | else if ((path = find_in_path(*argv)) != NULL) |
| @@ -10610,11 +10610,11 @@ static int FAST_FUNC builtin_read(char **argv) | |||
| 10610 | * Option string must start with "sr" to match BUILTIN_READ_xxx | 10610 | * Option string must start with "sr" to match BUILTIN_READ_xxx |
| 10611 | */ | 10611 | */ |
| 10612 | params.read_flags = getopt32(argv, | 10612 | params.read_flags = getopt32(argv, |
| 10613 | #if BASH_READ_D | 10613 | # if BASH_READ_D |
| 10614 | "!srn:p:t:u:d:", ¶ms.opt_n, ¶ms.opt_p, ¶ms.opt_t, ¶ms.opt_u, ¶ms.opt_d | 10614 | "!srn:p:t:u:d:", ¶ms.opt_n, ¶ms.opt_p, ¶ms.opt_t, ¶ms.opt_u, ¶ms.opt_d |
| 10615 | #else | 10615 | # else |
| 10616 | "!srn:p:t:u:", ¶ms.opt_n, ¶ms.opt_p, ¶ms.opt_t, ¶ms.opt_u | 10616 | "!srn:p:t:u:", ¶ms.opt_n, ¶ms.opt_p, ¶ms.opt_t, ¶ms.opt_u |
| 10617 | #endif | 10617 | # endif |
| 10618 | ); | 10618 | ); |
| 10619 | if ((uint32_t)params.read_flags == (uint32_t)-1) | 10619 | if ((uint32_t)params.read_flags == (uint32_t)-1) |
| 10620 | return EXIT_FAILURE; | 10620 | return EXIT_FAILURE; |
| @@ -10787,24 +10787,24 @@ static int FAST_FUNC builtin_export(char **argv) | |||
| 10787 | { | 10787 | { |
| 10788 | unsigned opt_unexport; | 10788 | unsigned opt_unexport; |
| 10789 | 10789 | ||
| 10790 | #if ENABLE_HUSH_EXPORT_N | 10790 | # if ENABLE_HUSH_EXPORT_N |
| 10791 | /* "!": do not abort on errors */ | 10791 | /* "!": do not abort on errors */ |
| 10792 | opt_unexport = getopt32(argv, "!n"); | 10792 | opt_unexport = getopt32(argv, "!n"); |
| 10793 | if (opt_unexport == (uint32_t)-1) | 10793 | if (opt_unexport == (uint32_t)-1) |
| 10794 | return EXIT_FAILURE; | 10794 | return EXIT_FAILURE; |
| 10795 | argv += optind; | 10795 | argv += optind; |
| 10796 | #else | 10796 | # else |
| 10797 | opt_unexport = 0; | 10797 | opt_unexport = 0; |
| 10798 | argv++; | 10798 | argv++; |
| 10799 | #endif | 10799 | # endif |
| 10800 | 10800 | ||
| 10801 | if (argv[0] == NULL) { | 10801 | if (argv[0] == NULL) { |
| 10802 | char **e = environ; | 10802 | char **e = environ; |
| 10803 | if (e) { | 10803 | if (e) { |
| 10804 | while (*e) { | 10804 | while (*e) { |
| 10805 | #if 0 | 10805 | # if 0 |
| 10806 | puts(*e++); | 10806 | puts(*e++); |
| 10807 | #else | 10807 | # else |
| 10808 | /* ash emits: export VAR='VAL' | 10808 | /* ash emits: export VAR='VAL' |
| 10809 | * bash: declare -x VAR="VAL" | 10809 | * bash: declare -x VAR="VAL" |
| 10810 | * we follow ash example */ | 10810 | * we follow ash example */ |
| @@ -10817,7 +10817,7 @@ static int FAST_FUNC builtin_export(char **argv) | |||
| 10817 | printf("export %.*s", (int)(p - s) + 1, s); | 10817 | printf("export %.*s", (int)(p - s) + 1, s); |
| 10818 | print_escaped(p + 1); | 10818 | print_escaped(p + 1); |
| 10819 | putchar('\n'); | 10819 | putchar('\n'); |
| 10820 | #endif | 10820 | # endif |
| 10821 | } | 10821 | } |
| 10822 | /*fflush_all(); - done after each builtin anyway */ | 10822 | /*fflush_all(); - done after each builtin anyway */ |
| 10823 | } | 10823 | } |
| @@ -11472,9 +11472,9 @@ static int FAST_FUNC builtin_kill(char **argv) | |||
| 11472 | 11472 | ||
| 11473 | #if ENABLE_HUSH_WAIT | 11473 | #if ENABLE_HUSH_WAIT |
| 11474 | /* http://www.opengroup.org/onlinepubs/9699919799/utilities/wait.html */ | 11474 | /* http://www.opengroup.org/onlinepubs/9699919799/utilities/wait.html */ |
| 11475 | #if !ENABLE_HUSH_JOB | 11475 | # if !ENABLE_HUSH_JOB |
| 11476 | # define wait_for_child_or_signal(pipe,pid) wait_for_child_or_signal(pid) | 11476 | # define wait_for_child_or_signal(pipe,pid) wait_for_child_or_signal(pid) |
| 11477 | #endif | 11477 | # endif |
| 11478 | static int wait_for_child_or_signal(struct pipe *waitfor_pipe, pid_t waitfor_pid) | 11478 | static int wait_for_child_or_signal(struct pipe *waitfor_pipe, pid_t waitfor_pid) |
| 11479 | { | 11479 | { |
| 11480 | int ret = 0; | 11480 | int ret = 0; |
| @@ -11506,7 +11506,7 @@ static int wait_for_child_or_signal(struct pipe *waitfor_pipe, pid_t waitfor_pid | |||
| 11506 | /* Can't pass waitfor_pipe into checkjobs(): it won't be interruptible */ | 11506 | /* Can't pass waitfor_pipe into checkjobs(): it won't be interruptible */ |
| 11507 | ret = checkjobs(NULL, waitfor_pid); /* waitpid(WNOHANG) inside */ | 11507 | ret = checkjobs(NULL, waitfor_pid); /* waitpid(WNOHANG) inside */ |
| 11508 | debug_printf_exec("checkjobs:%d\n", ret); | 11508 | debug_printf_exec("checkjobs:%d\n", ret); |
| 11509 | #if ENABLE_HUSH_JOB | 11509 | # if ENABLE_HUSH_JOB |
| 11510 | if (waitfor_pipe) { | 11510 | if (waitfor_pipe) { |
| 11511 | int rcode = job_exited_or_stopped(waitfor_pipe); | 11511 | int rcode = job_exited_or_stopped(waitfor_pipe); |
| 11512 | debug_printf_exec("job_exited_or_stopped:%d\n", rcode); | 11512 | debug_printf_exec("job_exited_or_stopped:%d\n", rcode); |
| @@ -11516,7 +11516,7 @@ static int wait_for_child_or_signal(struct pipe *waitfor_pipe, pid_t waitfor_pid | |||
| 11516 | break; | 11516 | break; |
| 11517 | } | 11517 | } |
| 11518 | } | 11518 | } |
| 11519 | #endif | 11519 | # endif |
| 11520 | /* if ECHILD, there are no children (ret is -1 or 0) */ | 11520 | /* if ECHILD, there are no children (ret is -1 or 0) */ |
| 11521 | /* if ret == 0, no children changed state */ | 11521 | /* if ret == 0, no children changed state */ |
| 11522 | /* if ret != 0, it's exitcode+1 of exited waitfor_pid child */ | 11522 | /* if ret != 0, it's exitcode+1 of exited waitfor_pid child */ |
| @@ -11524,12 +11524,12 @@ static int wait_for_child_or_signal(struct pipe *waitfor_pipe, pid_t waitfor_pid | |||
| 11524 | ret--; | 11524 | ret--; |
| 11525 | if (ret < 0) /* if ECHILD, may need to fix "ret" */ | 11525 | if (ret < 0) /* if ECHILD, may need to fix "ret" */ |
| 11526 | ret = 0; | 11526 | ret = 0; |
| 11527 | #if ENABLE_HUSH_BASH_COMPAT | 11527 | # if ENABLE_HUSH_BASH_COMPAT |
| 11528 | if (waitfor_pid == -1 && errno == ECHILD) { | 11528 | if (waitfor_pid == -1 && errno == ECHILD) { |
| 11529 | /* exitcode of "wait -n" with no children is 127, not 0 */ | 11529 | /* exitcode of "wait -n" with no children is 127, not 0 */ |
| 11530 | ret = 127; | 11530 | ret = 127; |
| 11531 | } | 11531 | } |
| 11532 | #endif | 11532 | # endif |
| 11533 | sigprocmask(SIG_SETMASK, &oldset, NULL); | 11533 | sigprocmask(SIG_SETMASK, &oldset, NULL); |
| 11534 | break; | 11534 | break; |
| 11535 | } | 11535 | } |
| @@ -11558,14 +11558,14 @@ static int FAST_FUNC builtin_wait(char **argv) | |||
| 11558 | int status; | 11558 | int status; |
| 11559 | 11559 | ||
| 11560 | argv = skip_dash_dash(argv); | 11560 | argv = skip_dash_dash(argv); |
| 11561 | #if ENABLE_HUSH_BASH_COMPAT | 11561 | # if ENABLE_HUSH_BASH_COMPAT |
| 11562 | if (argv[0] && strcmp(argv[0], "-n") == 0) { | 11562 | if (argv[0] && strcmp(argv[0], "-n") == 0) { |
| 11563 | /* wait -n */ | 11563 | /* wait -n */ |
| 11564 | /* (bash accepts "wait -n PID" too and ignores PID) */ | 11564 | /* (bash accepts "wait -n PID" too and ignores PID) */ |
| 11565 | G.dead_job_exitcode = -1; | 11565 | G.dead_job_exitcode = -1; |
| 11566 | return wait_for_child_or_signal(NULL, -1 /*no job, wait for one job*/); | 11566 | return wait_for_child_or_signal(NULL, -1 /*no job, wait for one job*/); |
| 11567 | } | 11567 | } |
| 11568 | #endif | 11568 | # endif |
| 11569 | if (argv[0] == NULL) { | 11569 | if (argv[0] == NULL) { |
| 11570 | /* Don't care about wait results */ | 11570 | /* Don't care about wait results */ |
| 11571 | /* Note 1: must wait until there are no more children */ | 11571 | /* Note 1: must wait until there are no more children */ |
| @@ -11589,7 +11589,7 @@ static int FAST_FUNC builtin_wait(char **argv) | |||
| 11589 | do { | 11589 | do { |
| 11590 | pid_t pid = bb_strtou(*argv, NULL, 10); | 11590 | pid_t pid = bb_strtou(*argv, NULL, 10); |
| 11591 | if (errno || pid <= 0) { | 11591 | if (errno || pid <= 0) { |
| 11592 | #if ENABLE_HUSH_JOB | 11592 | # if ENABLE_HUSH_JOB |
| 11593 | if (argv[0][0] == '%') { | 11593 | if (argv[0][0] == '%') { |
| 11594 | struct pipe *wait_pipe; | 11594 | struct pipe *wait_pipe; |
| 11595 | ret = 127; /* bash compat for bad jobspecs */ | 11595 | ret = 127; /* bash compat for bad jobspecs */ |
| @@ -11606,7 +11606,7 @@ static int FAST_FUNC builtin_wait(char **argv) | |||
| 11606 | /* else: parse_jobspec() already emitted error msg */ | 11606 | /* else: parse_jobspec() already emitted error msg */ |
| 11607 | continue; | 11607 | continue; |
| 11608 | } | 11608 | } |
| 11609 | #endif | 11609 | # endif |
| 11610 | /* mimic bash message */ | 11610 | /* mimic bash message */ |
| 11611 | bb_error_msg("wait: '%s': not a pid or valid job spec", *argv); | 11611 | bb_error_msg("wait: '%s': not a pid or valid job spec", *argv); |
| 11612 | ret = EXIT_FAILURE; | 11612 | ret = EXIT_FAILURE; |
| @@ -11628,7 +11628,7 @@ static int FAST_FUNC builtin_wait(char **argv) | |||
| 11628 | ret = G.last_bg_pid_exitcode; | 11628 | ret = G.last_bg_pid_exitcode; |
| 11629 | } else { | 11629 | } else { |
| 11630 | /* Example: "wait 1". mimic bash message */ | 11630 | /* Example: "wait 1". mimic bash message */ |
| 11631 | bb_error_msg("wait: pid %d is not a child of this shell", (int)pid); | 11631 | bb_error_msg("wait: pid %u is not a child of this shell", (unsigned)pid); |
| 11632 | } | 11632 | } |
| 11633 | } else { | 11633 | } else { |
| 11634 | /* ??? */ | 11634 | /* ??? */ |
