aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-17 16:13:35 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-17 16:13:35 +0200
commit203fd7bc66b869e5022ad33d26065e69eaaaf66b (patch)
tree23a0a01bc422e663f420492708ee3d6327d5fba8
parent68e980545af6a8ffb2980f94a6edac4dd89940f3 (diff)
downloadbusybox-w32-203fd7bc66b869e5022ad33d26065e69eaaaf66b.tar.gz
busybox-w32-203fd7bc66b869e5022ad33d26065e69eaaaf66b.tar.bz2
busybox-w32-203fd7bc66b869e5022ad33d26065e69eaaaf66b.zip
shells: expand TODO comments, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c1
-rw-r--r--shell/hush.c31
2 files changed, 27 insertions, 5 deletions
diff --git a/shell/ash.c b/shell/ash.c
index b0c7dac54..987d618c6 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -6680,6 +6680,7 @@ subevalvar(char *p, char *varname, int strloc, int subtype,
6680 if (*loc++ == ':') { 6680 if (*loc++ == ':') {
6681 len = number(loc); 6681 len = number(loc);
6682 } 6682 }
6683//TODO: number() chokes on "-n". In bash, LEN=-n means strlen()-n
6683 } 6684 }
6684 if (pos < 0) { 6685 if (pos < 0) {
6685 /* ${VAR:$((-n)):l} starts n chars from the end */ 6686 /* ${VAR:$((-n)):l} starts n chars from the end */
diff --git a/shell/hush.c b/shell/hush.c
index 8d9292ed1..fd2a3d0f5 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -41,14 +41,29 @@
41 * 41 *
42 * TODOs: 42 * TODOs:
43 * grep for "TODO" and fix (some of them are easy) 43 * grep for "TODO" and fix (some of them are easy)
44 * make complex ${var%...} constructs support optional
45 * make here documents optional
44 * special variables (done: PWD, PPID, RANDOM) 46 * special variables (done: PWD, PPID, RANDOM)
47 * follow IFS rules more precisely, including update semantics
45 * tilde expansion 48 * tilde expansion
46 * aliases 49 * aliases
47 * follow IFS rules more precisely, including update semantics
48 * builtins mandated by standards we don't support: 50 * builtins mandated by standards we don't support:
49 * [un]alias, command, fc, getopts, newgrp, readonly, times 51 * [un]alias, command, fc, getopts, readonly, times:
50 * make complex ${var%...} constructs support optional 52 * command -v CMD: print "/path/to/CMD"
51 * make here documents optional 53 * prints "CMD" for builtins
54 * prints "alias ALIAS='EXPANSION'" for aliases
55 * prints nothing and sets $? to 1 if not found
56 * command -V CMD: print "CMD is /path/CMD|a shell builtin|etc"
57 * command [-p] CMD: run CMD, even if a function CMD also exists
58 * (can use this to override standalone shell as well)
59 * -p: use default $PATH
60 * readonly VAR[=VAL]...: make VARs readonly
61 * readonly [-p]: list all such VARs (-p has no effect in bash)
62 * getopts: getopt() for shells
63 * times: print getrusage(SELF/CHILDREN).ru_utime/ru_stime
64 * fc -l[nr] [BEG] [END]: list range of commands in history
65 * fc [-e EDITOR] [BEG] [END]: edit/rerun range of commands
66 * fc -s [PAT=REP] [CMD]: rerun CMD, replacing PAT with REP
52 * 67 *
53 * Bash compat TODO: 68 * Bash compat TODO:
54 * redirection of stdout+stderr: &> and >& 69 * redirection of stdout+stderr: &> and >&
@@ -64,8 +79,13 @@
64 * The EXPR is evaluated according to ARITHMETIC EVALUATION. 79 * The EXPR is evaluated according to ARITHMETIC EVALUATION.
65 * This is exactly equivalent to let "EXPR". 80 * This is exactly equivalent to let "EXPR".
66 * $[EXPR]: synonym for $((EXPR)) 81 * $[EXPR]: synonym for $((EXPR))
82 * indirect expansion: ${!VAR}
83 * substring op on @: ${@:n:m}
67 * 84 *
68 * Won't do: 85 * Won't do:
86 * Some builtins mandated by standards:
87 * newgrp [GRP]: not a builtin in bash but a suid binary
88 * which spawns a new shell with new group ID
69 * In bash, export builtin is special, its arguments are assignments 89 * In bash, export builtin is special, its arguments are assignments
70 * and therefore expansion of them should be "one-word" expansion: 90 * and therefore expansion of them should be "one-word" expansion:
71 * $ export i=`echo 'a b'` # export has one arg: "i=a b" 91 * $ export i=`echo 'a b'` # export has one arg: "i=a b"
@@ -5703,7 +5723,7 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
5703 if (errmsg) 5723 if (errmsg)
5704 goto arith_err; 5724 goto arith_err;
5705 debug_printf_varexp("len:'%s'=%lld\n", exp_word, (long long)len); 5725 debug_printf_varexp("len:'%s'=%lld\n", exp_word, (long long)len);
5706 if (len >= 0) { /* bash compat: len < 0 is illegal */ 5726 if (len >= 0) {
5707 if (beg < 0) { 5727 if (beg < 0) {
5708 /* negative beg counts from the end */ 5728 /* negative beg counts from the end */
5709 beg = (arith_t)strlen(val) + beg; 5729 beg = (arith_t)strlen(val) + beg;
@@ -5723,6 +5743,7 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
5723 } 5743 }
5724 debug_printf_varexp("val:'%s'\n", val); 5744 debug_printf_varexp("val:'%s'\n", val);
5725 } else 5745 } else
5746//TODO: in bash, len=-n means strlen()-n
5726#endif /* HUSH_SUBSTR_EXPANSION && FEATURE_SH_MATH */ 5747#endif /* HUSH_SUBSTR_EXPANSION && FEATURE_SH_MATH */
5727 { 5748 {
5728 die_if_script("malformed ${%s:...}", var); 5749 die_if_script("malformed ${%s:...}", var);