aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-06 10:47:21 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-06 10:47:21 +0000
commitc8d27334a0921d6ca76862e9c7befe12a4df6dc6 (patch)
tree11ffb62d5b8f2af1acec07e2620d2b7f631dde17
parentd3f973eab29786a45cfebeba5d32b3647c343737 (diff)
downloadbusybox-w32-c8d27334a0921d6ca76862e9c7befe12a4df6dc6.tar.gz
busybox-w32-c8d27334a0921d6ca76862e9c7befe12a4df6dc6.tar.bz2
busybox-w32-c8d27334a0921d6ca76862e9c7befe12a4df6dc6.zip
hush: update TODO list; + my usual pointless tweaks :(
-rw-r--r--shell/hush.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 04853137b..119518bd1 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -6,6 +6,7 @@
6 * incidentally is a good match to today's BusyBox. 6 * incidentally is a good match to today's BusyBox.
7 * 7 *
8 * Copyright (C) 2000,2001 Larry Doolittle <larry@doolittle.boa.org> 8 * Copyright (C) 2000,2001 Larry Doolittle <larry@doolittle.boa.org>
9 * Copyright (C) 2008,2009 Denys Vlasenko <vda.linux@googlemail.com>
9 * 10 *
10 * Credits: 11 * Credits:
11 * The parser routines proper are all original material, first 12 * The parser routines proper are all original material, first
@@ -44,23 +45,24 @@
44 * Tilde Expansion 45 * Tilde Expansion
45 * Parameter Expansion for substring processing ${var#word} ${var%word} 46 * Parameter Expansion for substring processing ${var#word} ${var%word}
46 * 47 *
47 * Bash stuff maybe optional enable: 48 * Bash stuff (maybe optionally enable?):
48 * &> and >& redirection of stdout+stderr 49 * &> and >& redirection of stdout+stderr
49 * Brace expansion 50 * Brace expansion
50 * reserved words: [[ ]] function select 51 * reserved words: [[ ]] function select
51 * substrings ${var:1:5} 52 * substrings ${var:1:5}
52 * 53 *
53 * Major bugs: 54 * TODOs:
54 * job handling woefully incomplete and buggy (improved --vda) 55 * grep for "TODO" and fix (some of them are easy)
55 * to-do:
56 * port selected bugfixes from post-0.49 busybox lash - done?
57 * change { and } from special chars to reserved words 56 * change { and } from special chars to reserved words
58 * builtins: return, trap, ulimit 57 * builtins: return, ulimit
59 * test magic exec with redirection only
60 * follow IFS rules more precisely, including update semantics 58 * follow IFS rules more precisely, including update semantics
61 * figure out what to do with backslash-newline 59 * figure out what to do with backslash-newline
62 * propagate syntax errors, die on resource errors?
63 * continuation lines, both explicit and implicit - done? 60 * continuation lines, both explicit and implicit - done?
61 * SIGHUP handling
62 * ^Z handling (and explain it in comments for mere humans)
63 * separate job control from interactiveness
64 * (testcase: booting with init=/bin/hush does not show prompt (2009-04))
65 * functions
64 * 66 *
65 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 67 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
66 */ 68 */
@@ -5345,9 +5347,10 @@ static int builtin_trap(char **argv)
5345 if (!G.traps) 5347 if (!G.traps)
5346 G.traps = xzalloc(sizeof(G.traps[0]) * NSIG); 5348 G.traps = xzalloc(sizeof(G.traps[0]) * NSIG);
5347 5349
5348 if (!argv[1]) { 5350 argv++;
5349 /* No args: print all trapped. This isn't 100% correct as we should 5351 if (!*argv) {
5350 * be escaping the cmd so that it can be pasted back in ... 5352 /* No args: print all trapped. This isn't 100% correct as we
5353 * should be escaping the cmd so that it can be pasted back in
5351 */ 5354 */
5352 for (i = 0; i < NSIG; ++i) 5355 for (i = 0; i < NSIG; ++i)
5353 if (G.traps[i]) 5356 if (G.traps[i])
@@ -5357,8 +5360,8 @@ static int builtin_trap(char **argv)
5357 5360
5358 new_cmd = NULL; 5361 new_cmd = NULL;
5359 i = 0; 5362 i = 0;
5360 /* if first arg is decimal: reset all specified */ 5363 /* If first arg is decimal: reset all specified signals */
5361 sig = bb_strtou(*++argv, NULL, 10); 5364 sig = bb_strtou(*argv, NULL, 10);
5362 if (errno == 0) { 5365 if (errno == 0) {
5363 int ret; 5366 int ret;
5364 set_all: 5367 set_all:
@@ -5367,7 +5370,7 @@ static int builtin_trap(char **argv)
5367 sig = get_signum(*argv++); 5370 sig = get_signum(*argv++);
5368 if (sig < 0 || sig >= NSIG) { 5371 if (sig < 0 || sig >= NSIG) {
5369 ret = EXIT_FAILURE; 5372 ret = EXIT_FAILURE;
5370 /* mimic bash message exactly */ 5373 /* Mimic bash message exactly */
5371 bb_perror_msg("trap: %s: invalid signal specification", argv[i]); 5374 bb_perror_msg("trap: %s: invalid signal specification", argv[i]);
5372 continue; 5375 continue;
5373 } 5376 }
@@ -5385,7 +5388,7 @@ static int builtin_trap(char **argv)
5385 if (new_cmd) { 5388 if (new_cmd) {
5386 sigaddset(&G.blocked_set, sig); 5389 sigaddset(&G.blocked_set, sig);
5387 } else { 5390 } else {
5388 /* there was a trap handler, we are removing it 5391 /* There was a trap handler, we are removing it
5389 * (if sig has non-DFL handling, 5392 * (if sig has non-DFL handling,
5390 * we don't need to do anything) */ 5393 * we don't need to do anything) */
5391 if (sig < 32 && (G.non_DFL_mask & (1 << sig))) 5394 if (sig < 32 && (G.non_DFL_mask & (1 << sig)))
@@ -5397,16 +5400,14 @@ static int builtin_trap(char **argv)
5397 return ret; 5400 return ret;
5398 } 5401 }
5399 5402
5400 /* first arg is "-": reset all specified to default */ 5403 /* First arg is "-": reset all specified to default */
5401 /* first arg is "": ignore all specified */ 5404 /* First arg is "": ignore all specified */
5402 /* everything else: execute first arg upon signal */ 5405 /* Everything else: execute first arg upon signal */
5403 if (!argv[1]) { 5406 if (!argv[1]) {
5404 bb_error_msg("trap: invalid arguments"); 5407 bb_error_msg("trap: invalid arguments");
5405 return EXIT_FAILURE; 5408 return EXIT_FAILURE;
5406 } 5409 }
5407 if (LONE_DASH(*argv)) 5410 if (NOT_LONE_DASH(*argv))
5408 /* nothing! */;
5409 else
5410 new_cmd = *argv; 5411 new_cmd = *argv;
5411 argv++; 5412 argv++;
5412 goto set_all; 5413 goto set_all;