aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2010-11-20 13:05:17 -0800
committerDenys Vlasenko <vda.linux@googlemail.com>2010-11-28 03:56:39 +0100
commit85c62470b75b9256e36d8f488a0701aff94ca512 (patch)
tree64ca1cb31637f684755e54d180002c163d0626a3
parent89ca2f99a20e78f392fb95d52d62cb32925bc9b2 (diff)
downloadbusybox-85c62470b75b9256e36d8f488a0701aff94ca512.tar.gz
Support set -o xtrace/noexec alternates for set -x/-n
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/shell/hush.c b/shell/hush.c
index a710f7cd9..0cc587e19 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -673,9 +673,19 @@ struct function {
* vi off
* xtrace off
*/
-static const char o_opt_strings[] ALIGN1 = "pipefail\0";
+static const char o_opt_strings[] ALIGN1 =
+ "pipefail\0"
+ "noexec\0"
+#if ENABLE_HUSH_MODE_X
+ "xtrace\0"
+#endif
+ ;
enum {
OPT_O_PIPEFAIL,
+ OPT_O_NOEXEC,
+#if ENABLE_HUSH_MODE_X
+ OPT_O_XTRACE,
+#endif
NUM_OPT_O
};
@@ -734,10 +744,8 @@ struct globals {
*/
smallint flag_return_in_progress;
#endif
- smallint n_mode;
#if ENABLE_HUSH_MODE_X
- smallint x_mode;
-# define G_x_mode (G.x_mode)
+# define G_x_mode (G.o_opt[OPT_O_XTRACE])
#else
# define G_x_mode 0
#endif
@@ -7304,7 +7312,7 @@ static int run_and_free_list(struct pipe *pi)
{
int rcode = 0;
debug_printf_exec("run_and_free_list entered\n");
- if (!G.n_mode) {
+ if (!G.o_opt[OPT_O_NOEXEC]) {
debug_printf_exec(": run_list: 1st pipe with %d cmds\n", pi->num_cmds);
rcode = run_list(pi);
}
@@ -7407,7 +7415,7 @@ static int set_mode(int state, char mode, const char *o_opt)
int idx;
switch (mode) {
case 'n':
- G.n_mode = state;
+ G.o_opt[OPT_O_NOEXEC] = state;
break;
case 'x':
IF_HUSH_MODE_X(G_x_mode = state;)