summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorMike Frysinger2009-04-18 21:04:25 +0000
committerMike Frysinger2009-04-18 21:04:25 +0000
commit885b6f29ae2740399231427dc2c6efe47db9a80d (patch)
tree1fdf749b5f252e9d0a2dac5cd2db475714716fa5 /shell
parent6008d8a3cc80c1d758f99ed1229ca2b9bcd4c3b1 (diff)
downloadbusybox-885b6f29ae2740399231427dc2c6efe47db9a80d.zip
busybox-885b6f29ae2740399231427dc2c6efe47db9a80d.tar.gz
fix build errors when function support is turned off
Diffstat (limited to 'shell')
-rw-r--r--shell/hush.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 56a2897..ecacd96 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2901,13 +2901,17 @@ static void exec_function(nommu_save_t *nommu_save,
static int run_function(const struct function *funcp, char **argv)
{
int rc;
- smallint sv_flg;
save_arg_t sv;
+#if ENABLE_HUSH_FUNCTIONS
+ smallint sv_flg;
+#endif
save_and_replace_G_args(&sv, argv);
+#if ENABLE_HUSH_FUNCTIONS
/* "we are in function, ok to use return" */
sv_flg = G.flag_return_in_progress;
G.flag_return_in_progress = -1;
+#endif
/* On MMU, funcp->body is always non-NULL */
#if !BB_MMU
@@ -2921,7 +2925,9 @@ static int run_function(const struct function *funcp, char **argv)
rc = run_list(funcp->body);
}
+#if ENABLE_HUSH_FUNCTIONS
G.flag_return_in_progress = sv_flg;
+#endif
restore_G_args(&sv, argv);
return rc;
@@ -6775,8 +6781,10 @@ static int builtin_shift(char **argv)
static int builtin_source(char **argv)
{
FILE *input;
- smallint sv_flg;
save_arg_t sv;
+#if ENABLE_HUSH_FUNCTIONS
+ smallint sv_flg;
+#endif
if (*++argv == NULL)
return EXIT_FAILURE;
@@ -6789,16 +6797,20 @@ static int builtin_source(char **argv)
}
close_on_exec_on(fileno(input));
+#if ENABLE_HUSH_FUNCTIONS
sv_flg = G.flag_return_in_progress;
/* "we are inside sourced file, ok to use return" */
G.flag_return_in_progress = -1;
+#endif
save_and_replace_G_args(&sv, argv);
parse_and_run_file(input);
fclose(input);
restore_G_args(&sv, argv);
+#if ENABLE_HUSH_FUNCTIONS
G.flag_return_in_progress = sv_flg;
+#endif
return G.last_exitcode;
}