hush: update TODO list; + my usual pointless tweaks :(

This commit is contained in:
Denis Vlasenko 2009-04-06 10:47:21 +00:00
parent d3f973eab2
commit c8d27334a0

View File

@ -6,6 +6,7 @@
* incidentally is a good match to today's BusyBox. * incidentally is a good match to today's BusyBox.
* *
* Copyright (C) 2000,2001 Larry Doolittle <larry@doolittle.boa.org> * Copyright (C) 2000,2001 Larry Doolittle <larry@doolittle.boa.org>
* Copyright (C) 2008,2009 Denys Vlasenko <vda.linux@googlemail.com>
* *
* Credits: * Credits:
* The parser routines proper are all original material, first * The parser routines proper are all original material, first
@ -44,23 +45,24 @@
* Tilde Expansion * Tilde Expansion
* Parameter Expansion for substring processing ${var#word} ${var%word} * Parameter Expansion for substring processing ${var#word} ${var%word}
* *
* Bash stuff maybe optional enable: * Bash stuff (maybe optionally enable?):
* &> and >& redirection of stdout+stderr * &> and >& redirection of stdout+stderr
* Brace expansion * Brace expansion
* reserved words: [[ ]] function select * reserved words: [[ ]] function select
* substrings ${var:1:5} * substrings ${var:1:5}
* *
* Major bugs: * TODOs:
* job handling woefully incomplete and buggy (improved --vda) * grep for "TODO" and fix (some of them are easy)
* to-do:
* port selected bugfixes from post-0.49 busybox lash - done?
* change { and } from special chars to reserved words * change { and } from special chars to reserved words
* builtins: return, trap, ulimit * builtins: return, ulimit
* test magic exec with redirection only
* follow IFS rules more precisely, including update semantics * follow IFS rules more precisely, including update semantics
* figure out what to do with backslash-newline * figure out what to do with backslash-newline
* propagate syntax errors, die on resource errors?
* continuation lines, both explicit and implicit - done? * continuation lines, both explicit and implicit - done?
* SIGHUP handling
* ^Z handling (and explain it in comments for mere humans)
* separate job control from interactiveness
* (testcase: booting with init=/bin/hush does not show prompt (2009-04))
* functions
* *
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/ */
@ -5345,9 +5347,10 @@ static int builtin_trap(char **argv)
if (!G.traps) if (!G.traps)
G.traps = xzalloc(sizeof(G.traps[0]) * NSIG); G.traps = xzalloc(sizeof(G.traps[0]) * NSIG);
if (!argv[1]) { argv++;
/* No args: print all trapped. This isn't 100% correct as we should if (!*argv) {
* be escaping the cmd so that it can be pasted back in ... /* No args: print all trapped. This isn't 100% correct as we
* should be escaping the cmd so that it can be pasted back in
*/ */
for (i = 0; i < NSIG; ++i) for (i = 0; i < NSIG; ++i)
if (G.traps[i]) if (G.traps[i])
@ -5357,8 +5360,8 @@ static int builtin_trap(char **argv)
new_cmd = NULL; new_cmd = NULL;
i = 0; i = 0;
/* if first arg is decimal: reset all specified */ /* If first arg is decimal: reset all specified signals */
sig = bb_strtou(*++argv, NULL, 10); sig = bb_strtou(*argv, NULL, 10);
if (errno == 0) { if (errno == 0) {
int ret; int ret;
set_all: set_all:
@ -5367,7 +5370,7 @@ static int builtin_trap(char **argv)
sig = get_signum(*argv++); sig = get_signum(*argv++);
if (sig < 0 || sig >= NSIG) { if (sig < 0 || sig >= NSIG) {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
/* mimic bash message exactly */ /* Mimic bash message exactly */
bb_perror_msg("trap: %s: invalid signal specification", argv[i]); bb_perror_msg("trap: %s: invalid signal specification", argv[i]);
continue; continue;
} }
@ -5385,7 +5388,7 @@ static int builtin_trap(char **argv)
if (new_cmd) { if (new_cmd) {
sigaddset(&G.blocked_set, sig); sigaddset(&G.blocked_set, sig);
} else { } else {
/* there was a trap handler, we are removing it /* There was a trap handler, we are removing it
* (if sig has non-DFL handling, * (if sig has non-DFL handling,
* we don't need to do anything) */ * we don't need to do anything) */
if (sig < 32 && (G.non_DFL_mask & (1 << sig))) if (sig < 32 && (G.non_DFL_mask & (1 << sig)))
@ -5397,16 +5400,14 @@ static int builtin_trap(char **argv)
return ret; return ret;
} }
/* first arg is "-": reset all specified to default */ /* First arg is "-": reset all specified to default */
/* first arg is "": ignore all specified */ /* First arg is "": ignore all specified */
/* everything else: execute first arg upon signal */ /* Everything else: execute first arg upon signal */
if (!argv[1]) { if (!argv[1]) {
bb_error_msg("trap: invalid arguments"); bb_error_msg("trap: invalid arguments");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (LONE_DASH(*argv)) if (NOT_LONE_DASH(*argv))
/* nothing! */;
else
new_cmd = *argv; new_cmd = *argv;
argv++; argv++;
goto set_all; goto set_all;