aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-11-28 10:28:14 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2019-11-28 10:28:14 +0100
commit259747caa7d86a5a46013b80a19b2ee2d4e0a73b (patch)
tree539344bc2889d52cd8a68afe487815b8b6833634
parent1b76ffaae400f266fe5aea0d5900a7e2ab9d7aa8 (diff)
downloadbusybox-259747caa7d86a5a46013b80a19b2ee2d4e0a73b.tar.gz
hush: fix preprocessor directives indentation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c64
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)
fdprintf(2, "%*s cmd %d assignment_cnt:%d",
lvl*2, "", prn,
command->assignment_cnt);
-#if ENABLE_HUSH_LINENO_VAR
+# if ENABLE_HUSH_LINENO_VAR
fdprintf(2, " LINENO:%u", command->lineno);
-#endif
+# endif
if (command->group) {
fdprintf(2, " group %s: (argv=%p)%s%s\n",
CMDTYPE[command->cmd_type],
@@ -4771,9 +4771,9 @@ static int add_till_closing_bracket(o_string *dest, struct in_str *input, unsign
# endif
end_ch &= (DOUBLE_CLOSE_CHAR_FLAG - 1);
-#if ENABLE_HUSH_INTERACTIVE
+# if ENABLE_HUSH_INTERACTIVE
G.promptmode = 1; /* PS2 */
-#endif
+# endif
debug_printf_prompt("%s promptmode=%d\n", __func__, G.promptmode);
while (1) {
@@ -4829,13 +4829,13 @@ static int add_till_closing_bracket(o_string *dest, struct in_str *input, unsign
syntax_error_unterm_ch(end_ch);
return 0;
}
-#if 0
+# if 0
if (ch == '\n') {
/* "backslash+newline", ignore both */
o_delchr(dest); /* undo insertion of '\' */
continue;
}
-#endif
+# endif
o_addchr(dest, ch);
//bb_error_msg("%s:o_addchr('%c') after '\\'", __func__, ch);
continue;
@@ -4992,7 +4992,7 @@ static int parse_dollar(o_string *as_string,
if (last_ch == 0) /* error? */
return 0;
#else
-#error Simple code to only allow ${var} is not implemented
+# error Simple code to only allow ${var} is not implemented
#endif
if (as_string) {
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)
pi->cmds[i].pid = 0;
pi->alive_cmds--;
if (!pi->alive_cmds) {
-#if ENABLE_HUSH_BASH_COMPAT
+# if ENABLE_HUSH_BASH_COMPAT
G.dead_job_exitcode = job_exited_or_stopped(pi);
-#endif
+# endif
if (G_interactive_fd) {
printf(JOB_STATUS_FORMAT, pi->jobid,
"Done", pi->cmdtext);
@@ -10552,10 +10552,10 @@ static int FAST_FUNC builtin_type(char **argv)
if (0) {} /* make conditional compile easier below */
/*else if (find_alias(*argv))
type = "an alias";*/
-#if ENABLE_HUSH_FUNCTIONS
+# if ENABLE_HUSH_FUNCTIONS
else if (find_function(*argv))
type = "a function";
-#endif
+# endif
else if (find_builtin(*argv))
type = "a shell builtin";
else if ((path = find_in_path(*argv)) != NULL)
@@ -10610,11 +10610,11 @@ static int FAST_FUNC builtin_read(char **argv)
* Option string must start with "sr" to match BUILTIN_READ_xxx
*/
params.read_flags = getopt32(argv,
-#if BASH_READ_D
+# if BASH_READ_D
"!srn:p:t:u:d:", &params.opt_n, &params.opt_p, &params.opt_t, &params.opt_u, &params.opt_d
-#else
+# else
"!srn:p:t:u:", &params.opt_n, &params.opt_p, &params.opt_t, &params.opt_u
-#endif
+# endif
);
if ((uint32_t)params.read_flags == (uint32_t)-1)
return EXIT_FAILURE;
@@ -10787,24 +10787,24 @@ static int FAST_FUNC builtin_export(char **argv)
{
unsigned opt_unexport;
-#if ENABLE_HUSH_EXPORT_N
+# if ENABLE_HUSH_EXPORT_N
/* "!": do not abort on errors */
opt_unexport = getopt32(argv, "!n");
if (opt_unexport == (uint32_t)-1)
return EXIT_FAILURE;
argv += optind;
-#else
+# else
opt_unexport = 0;
argv++;
-#endif
+# endif
if (argv[0] == NULL) {
char **e = environ;
if (e) {
while (*e) {
-#if 0
+# if 0
puts(*e++);
-#else
+# else
/* ash emits: export VAR='VAL'
* bash: declare -x VAR="VAL"
* we follow ash example */
@@ -10817,7 +10817,7 @@ static int FAST_FUNC builtin_export(char **argv)
printf("export %.*s", (int)(p - s) + 1, s);
print_escaped(p + 1);
putchar('\n');
-#endif
+# endif
}
/*fflush_all(); - done after each builtin anyway */
}
@@ -11472,9 +11472,9 @@ static int FAST_FUNC builtin_kill(char **argv)
#if ENABLE_HUSH_WAIT
/* http://www.opengroup.org/onlinepubs/9699919799/utilities/wait.html */
-#if !ENABLE_HUSH_JOB
-# define wait_for_child_or_signal(pipe,pid) wait_for_child_or_signal(pid)
-#endif
+# if !ENABLE_HUSH_JOB
+# define wait_for_child_or_signal(pipe,pid) wait_for_child_or_signal(pid)
+# endif
static int wait_for_child_or_signal(struct pipe *waitfor_pipe, pid_t waitfor_pid)
{
int ret = 0;
@@ -11506,7 +11506,7 @@ static int wait_for_child_or_signal(struct pipe *waitfor_pipe, pid_t waitfor_pid
/* Can't pass waitfor_pipe into checkjobs(): it won't be interruptible */
ret = checkjobs(NULL, waitfor_pid); /* waitpid(WNOHANG) inside */
debug_printf_exec("checkjobs:%d\n", ret);
-#if ENABLE_HUSH_JOB
+# if ENABLE_HUSH_JOB
if (waitfor_pipe) {
int rcode = job_exited_or_stopped(waitfor_pipe);
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
break;
}
}
-#endif
+# endif
/* if ECHILD, there are no children (ret is -1 or 0) */
/* if ret == 0, no children changed state */
/* 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
ret--;
if (ret < 0) /* if ECHILD, may need to fix "ret" */
ret = 0;
-#if ENABLE_HUSH_BASH_COMPAT
+# if ENABLE_HUSH_BASH_COMPAT
if (waitfor_pid == -1 && errno == ECHILD) {
/* exitcode of "wait -n" with no children is 127, not 0 */
ret = 127;
}
-#endif
+# endif
sigprocmask(SIG_SETMASK, &oldset, NULL);
break;
}
@@ -11558,14 +11558,14 @@ static int FAST_FUNC builtin_wait(char **argv)
int status;
argv = skip_dash_dash(argv);
-#if ENABLE_HUSH_BASH_COMPAT
+# if ENABLE_HUSH_BASH_COMPAT
if (argv[0] && strcmp(argv[0], "-n") == 0) {
/* wait -n */
/* (bash accepts "wait -n PID" too and ignores PID) */
G.dead_job_exitcode = -1;
return wait_for_child_or_signal(NULL, -1 /*no job, wait for one job*/);
}
-#endif
+# endif
if (argv[0] == NULL) {
/* Don't care about wait results */
/* Note 1: must wait until there are no more children */
@@ -11589,7 +11589,7 @@ static int FAST_FUNC builtin_wait(char **argv)
do {
pid_t pid = bb_strtou(*argv, NULL, 10);
if (errno || pid <= 0) {
-#if ENABLE_HUSH_JOB
+# if ENABLE_HUSH_JOB
if (argv[0][0] == '%') {
struct pipe *wait_pipe;
ret = 127; /* bash compat for bad jobspecs */
@@ -11606,7 +11606,7 @@ static int FAST_FUNC builtin_wait(char **argv)
/* else: parse_jobspec() already emitted error msg */
continue;
}
-#endif
+# endif
/* mimic bash message */
bb_error_msg("wait: '%s': not a pid or valid job spec", *argv);
ret = EXIT_FAILURE;
@@ -11628,7 +11628,7 @@ static int FAST_FUNC builtin_wait(char **argv)
ret = G.last_bg_pid_exitcode;
} else {
/* Example: "wait 1". mimic bash message */
- bb_error_msg("wait: pid %d is not a child of this shell", (int)pid);
+ bb_error_msg("wait: pid %u is not a child of this shell", (unsigned)pid);
}
} else {
/* ??? */