aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-11-08 17:34:44 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-11-08 17:34:44 +0100
commit5cc9bf6a21ae0738528c2fb301ff4be2ab662ee9 (patch)
tree94a72df32d8ad301d40b5652ef177db02e2f6a29
parent1eada9ad8d31addd57213a072ddfc278e5776740 (diff)
downloadbusybox-w32-5cc9bf6a21ae0738528c2fb301ff4be2ab662ee9.tar.gz
busybox-w32-5cc9bf6a21ae0738528c2fb301ff4be2ab662ee9.tar.bz2
busybox-w32-5cc9bf6a21ae0738528c2fb301ff4be2ab662ee9.zip
hush: deindent large block of code, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c115
1 files changed, 57 insertions, 58 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 78a8f5c03..a5f059924 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -7803,6 +7803,8 @@ static int run_list(struct pipe *pi)
7803 7803
7804 /* Go through list of pipes, (maybe) executing them. */ 7804 /* Go through list of pipes, (maybe) executing them. */
7805 for (; pi; pi = IF_HUSH_LOOPS(rword == RES_DONE ? loop_top : ) pi->next) { 7805 for (; pi; pi = IF_HUSH_LOOPS(rword == RES_DONE ? loop_top : ) pi->next) {
7806 int r;
7807
7806 if (G.flag_SIGINT) 7808 if (G.flag_SIGINT)
7807 break; 7809 break;
7808 if (G_flag_return_in_progress == 1) 7810 if (G_flag_return_in_progress == 1)
@@ -7953,74 +7955,71 @@ static int run_list(struct pipe *pi)
7953 * after run_pipe to collect any background children, 7955 * after run_pipe to collect any background children,
7954 * even if list execution is to be stopped. */ 7956 * even if list execution is to be stopped. */
7955 debug_printf_exec(": run_pipe with %d members\n", pi->num_cmds); 7957 debug_printf_exec(": run_pipe with %d members\n", pi->num_cmds);
7956 {
7957 int r;
7958#if ENABLE_HUSH_LOOPS
7959 G.flag_break_continue = 0;
7960#endif
7961 rcode = r = run_pipe(pi); /* NB: rcode is a smallint */
7962 if (r != -1) {
7963 /* We ran a builtin, function, or group.
7964 * rcode is already known
7965 * and we don't need to wait for anything. */
7966 debug_printf_exec(": builtin/func exitcode %d\n", rcode);
7967 G.last_exitcode = rcode;
7968 check_and_run_traps();
7969#if ENABLE_HUSH_LOOPS 7958#if ENABLE_HUSH_LOOPS
7970 /* Was it "break" or "continue"? */ 7959 G.flag_break_continue = 0;
7971 if (G.flag_break_continue) {
7972 smallint fbc = G.flag_break_continue;
7973 /* We might fall into outer *loop*,
7974 * don't want to break it too */
7975 if (loop_top) {
7976 G.depth_break_continue--;
7977 if (G.depth_break_continue == 0)
7978 G.flag_break_continue = 0;
7979 /* else: e.g. "continue 2" should *break* once, *then* continue */
7980 } /* else: "while... do... { we are here (innermost list is not a loop!) };...done" */
7981 if (G.depth_break_continue != 0 || fbc == BC_BREAK) {
7982 checkjobs(NULL, 0 /*(no pid to wait for)*/);
7983 break;
7984 }
7985 /* "continue": simulate end of loop */
7986 rword = RES_DONE;
7987 continue;
7988 }
7989#endif 7960#endif
7990 if (G_flag_return_in_progress == 1) { 7961 rcode = r = run_pipe(pi); /* NB: rcode is a smalluint, r is int */
7962 if (r != -1) {
7963 /* We ran a builtin, function, or group.
7964 * rcode is already known
7965 * and we don't need to wait for anything. */
7966 debug_printf_exec(": builtin/func exitcode %d\n", rcode);
7967 G.last_exitcode = rcode;
7968 check_and_run_traps();
7969#if ENABLE_HUSH_LOOPS
7970 /* Was it "break" or "continue"? */
7971 if (G.flag_break_continue) {
7972 smallint fbc = G.flag_break_continue;
7973 /* We might fall into outer *loop*,
7974 * don't want to break it too */
7975 if (loop_top) {
7976 G.depth_break_continue--;
7977 if (G.depth_break_continue == 0)
7978 G.flag_break_continue = 0;
7979 /* else: e.g. "continue 2" should *break* once, *then* continue */
7980 } /* else: "while... do... { we are here (innermost list is not a loop!) };...done" */
7981 if (G.depth_break_continue != 0 || fbc == BC_BREAK) {
7991 checkjobs(NULL, 0 /*(no pid to wait for)*/); 7982 checkjobs(NULL, 0 /*(no pid to wait for)*/);
7992 break; 7983 break;
7993 } 7984 }
7994 } else if (pi->followup == PIPE_BG) { 7985 /* "continue": simulate end of loop */
7995 /* What does bash do with attempts to background builtins? */ 7986 rword = RES_DONE;
7996 /* even bash 3.2 doesn't do that well with nested bg: 7987 continue;
7997 * try "{ { sleep 10; echo DEEP; } & echo HERE; } &". 7988 }
7998 * I'm NOT treating inner &'s as jobs */ 7989#endif
7990 if (G_flag_return_in_progress == 1) {
7991 checkjobs(NULL, 0 /*(no pid to wait for)*/);
7992 break;
7993 }
7994 } else if (pi->followup == PIPE_BG) {
7995 /* What does bash do with attempts to background builtins? */
7996 /* even bash 3.2 doesn't do that well with nested bg:
7997 * try "{ { sleep 10; echo DEEP; } & echo HERE; } &".
7998 * I'm NOT treating inner &'s as jobs */
7999#if ENABLE_HUSH_JOB 7999#if ENABLE_HUSH_JOB
8000 if (G.run_list_level == 1) 8000 if (G.run_list_level == 1)
8001 insert_bg_job(pi); 8001 insert_bg_job(pi);
8002#endif 8002#endif
8003 /* Last command's pid goes to $! */ 8003 /* Last command's pid goes to $! */
8004 G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid; 8004 G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid;
8005 debug_printf_exec(": cmd&: exitcode EXIT_SUCCESS\n"); 8005 debug_printf_exec(": cmd&: exitcode EXIT_SUCCESS\n");
8006/* Check pi->pi_inverted? "! sleep 1 & echo $?": bash says 1. dash and ash says 0 */ 8006/* Check pi->pi_inverted? "! sleep 1 & echo $?": bash says 1. dash and ash says 0 */
8007 G.last_exitcode = rcode = EXIT_SUCCESS; 8007 G.last_exitcode = rcode = EXIT_SUCCESS;
8008 check_and_run_traps(); 8008 check_and_run_traps();
8009 } else { 8009 } else {
8010#if ENABLE_HUSH_JOB 8010#if ENABLE_HUSH_JOB
8011 if (G.run_list_level == 1 && G_interactive_fd) { 8011 if (G.run_list_level == 1 && G_interactive_fd) {
8012 /* Waits for completion, then fg's main shell */ 8012 /* Waits for completion, then fg's main shell */
8013 rcode = checkjobs_and_fg_shell(pi); 8013 rcode = checkjobs_and_fg_shell(pi);
8014 debug_printf_exec(": checkjobs_and_fg_shell exitcode %d\n", rcode); 8014 debug_printf_exec(": checkjobs_and_fg_shell exitcode %d\n", rcode);
8015 } else 8015 } else
8016#endif 8016#endif
8017 { /* This one just waits for completion */ 8017 { /* This one just waits for completion */
8018 rcode = checkjobs(pi, 0 /*(no pid to wait for)*/); 8018 rcode = checkjobs(pi, 0 /*(no pid to wait for)*/);
8019 debug_printf_exec(": checkjobs exitcode %d\n", rcode); 8019 debug_printf_exec(": checkjobs exitcode %d\n", rcode);
8020 }
8021 G.last_exitcode = rcode;
8022 check_and_run_traps();
8023 } 8020 }
8021 G.last_exitcode = rcode;
8022 check_and_run_traps();
8024 } 8023 }
8025 8024
8026 /* Analyze how result affects subsequent commands */ 8025 /* Analyze how result affects subsequent commands */