aboutsummaryrefslogtreecommitdiff
path: root/shell/shell_common.c
diff options
context:
space:
mode:
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 @@
22const char defifsvar[] ALIGN1 = "IFS= \t\n"; 22const char defifsvar[] ALIGN1 = "IFS= \t\n";
23const char defoptindvar[] ALIGN1 = "OPTIND=1"; 23const char defoptindvar[] ALIGN1 = "OPTIND=1";
24 24
25
26int FAST_FUNC is_well_formed_var_name(const char *s, char terminator)
27{
28 if (!s || !(isalpha(*s) || *s == '_'))
29 return 0;
30
31 do
32 s++;
33 while (isalnum(*s) || *s == '_');
34
35 return *s == terminator;
36}
37
38/* read builtin */ 25/* read builtin */
39 26
40/* Needs to be interruptible: shell must handle traps and shell-special signals 27/* Needs to be interruptible: shell must handle traps and shell-special signals
@@ -70,7 +57,7 @@ shell_builtin_read(struct builtin_read_params *params)
70 argv = params->argv; 57 argv = params->argv;
71 pp = argv; 58 pp = argv;
72 while (*pp) { 59 while (*pp) {
73 if (!is_well_formed_var_name(*pp, '\0')) { 60 if (endofname(*pp)[0] != '\0') {
74 /* Mimic bash message */ 61 /* Mimic bash message */
75 bb_error_msg("read: '%s': not a valid identifier", *pp); 62 bb_error_msg("read: '%s': not a valid identifier", *pp);
76 return (const char *)(uintptr_t)1; 63 return (const char *)(uintptr_t)1;