Formerly job.c.~109~

This commit is contained in:
Roland McGrath 1993-09-20 22:33:18 +00:00
parent f8c3e52b0f
commit 065ac461c5

27
job.c
View file

@ -1179,7 +1179,7 @@ construct_command_argv_internal (line, restp, shell, ifs)
char *line, **restp; char *line, **restp;
char *shell, *ifs; char *shell, *ifs;
{ {
static char sh_chars[] = "#;\"*?[]&|<>(){}=$`"; static char sh_chars[] = "#;\"*?[]&|<>(){}$`";
static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login", static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login",
"logout", "set", "umask", "wait", "while", "for", "logout", "set", "umask", "wait", "while", "for",
"case", "if", ":", ".", "break", "continue", "case", "if", ":", ".", "break", "continue",
@ -1189,7 +1189,7 @@ construct_command_argv_internal (line, restp, shell, ifs)
register char *p; register char *p;
register char *ap; register char *ap;
char *end; char *end;
int instring; int instring, word_has_equals, seen_nonequals;
char **new_argv = 0; char **new_argv = 0;
if (restp != NULL) if (restp != NULL)
@ -1223,7 +1223,7 @@ construct_command_argv_internal (line, restp, shell, ifs)
/* I is how many complete arguments have been found. */ /* I is how many complete arguments have been found. */
i = 0; i = 0;
instring = 0; instring = word_has_equals = seen_nonequals = 0;
for (p = line; *p != '\0'; ++p) for (p = line; *p != '\0'; ++p)
{ {
if (ap > end) if (ap > end)
@ -1244,6 +1244,17 @@ construct_command_argv_internal (line, restp, shell, ifs)
/* Not a special char. */ /* Not a special char. */
switch (*p) switch (*p)
{ {
case '=':
/* Equals is a special character in leading words before the
first word with no equals sign in it. This is not the case
with sh -k, but we never get here when using nonstandard
shell flags. */
if (! seen_nonequals)
goto slow;
word_has_equals = 1;
*ap++ = '=';
break;
case '\\': case '\\':
/* Backslash-newline combinations are eaten. */ /* Backslash-newline combinations are eaten. */
if (p[1] == '\n') if (p[1] == '\n')
@ -1295,6 +1306,16 @@ construct_command_argv_internal (line, restp, shell, ifs)
Terminate the text of the argument. */ Terminate the text of the argument. */
*ap++ = '\0'; *ap++ = '\0';
new_argv[++i] = ap; new_argv[++i] = ap;
/* Update SEEN_NONEQUALS, which tells us if every word
heretofore has contained an `='. */
seen_nonequals |= ! word_has_equals;
if (word_has_equals && ! seen_nonequals)
/* An `=' in a word before the first
word without one is magical. */
goto slow;
word_has_equals = 0; /* Prepare for the next word. */
/* If this argument is the command name, /* If this argument is the command name,
see if it is a built-in shell command. see if it is a built-in shell command.
If so, have the shell handle it. */ If so, have the shell handle it. */