aboutsummaryrefslogtreecommitdiff
path: root/shell/shell_common.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-05-14 18:53:24 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-05-14 18:56:04 +0200
commitd8bd7012a30c6ce9efe26d06880ac223143709ad (patch)
treee7cfd214658e2fbece84619b03e193fbe6f659cf /shell/shell_common.c
parent875ce094cf2d421ba05bed6cfd6c948084d52abe (diff)
downloadbusybox-d8bd7012a30c6ce9efe26d06880ac223143709ad.tar.gz
hush: fix "export PS1=xyz" and "local PS1=xyz" messing up prompt
function old new delta helper_export_local 215 253 +38 leave_var_nest_level 107 127 +20 run_pipe 1840 1857 +17 handle_changed_special_names 101 105 +4 shell_builtin_read 1399 1398 -1 done_word 767 766 -1 parse_stream 2249 2245 -4 set_local_var 437 430 -7 is_well_formed_var_name 66 - -66 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 4/4 up/down: 79/-79) Total: 0 bytes text data bss dec hex filename 952376 485 7296 960157 ea69d busybox_old 952400 485 7296 960181 ea6b5 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/shell_common.c')
-rw-r--r--shell/shell_common.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index da3165329..e0582adfb 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -22,19 +22,6 @@
const char defifsvar[] ALIGN1 = "IFS= \t\n";
const char defoptindvar[] ALIGN1 = "OPTIND=1";
-
-int FAST_FUNC is_well_formed_var_name(const char *s, char terminator)
-{
- if (!s || !(isalpha(*s) || *s == '_'))
- return 0;
-
- do
- s++;
- while (isalnum(*s) || *s == '_');
-
- return *s == terminator;
-}
-
/* read builtin */
/* Needs to be interruptible: shell must handle traps and shell-special signals
@@ -70,7 +57,7 @@ shell_builtin_read(struct builtin_read_params *params)
argv = params->argv;
pp = argv;
while (*pp) {
- if (!is_well_formed_var_name(*pp, '\0')) {
+ if (endofname(*pp)[0] != '\0') {
/* Mimic bash message */
bb_error_msg("read: '%s': not a valid identifier", *pp);
return (const char *)(uintptr_t)1;