/* Job execution and handling for GNU Make.
-Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
+Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify
_exit (127);
}
\f
-/* Figure out the argument list necessary to run LINE as a command.
- Try to avoid using a shell. This routine handles only ' quoting.
- Starting quotes may be escaped with a backslash. If any of the
- characters in sh_chars[] is seen, or any of the builtin commands
- listed in sh_cmds[] is the first word of a line, the shell is used.
+/* Figure out the argument list necessary to run LINE as a command. Try to
+ avoid using a shell. This routine handles only ' quoting, and " quoting
+ when no backslash, $ or ` characters are seen in the quotes. Starting
+ quotes may be escaped with a backslash. If any of the characters in
+ sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[]
+ is the first word of a line, the shell is used.
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
If *RESTP is NULL, newlines will be ignored.
string_char:
/* Inside a string, just copy any char except a closing quote
or a backslash-newline combination. */
- if (*p == '\'')
+ if (*p == instring)
instring = 0;
else if (*p == '\\' && p[1] == '\n')
goto swallow_escaped_newline;
*restp = p;
goto end_of_line;
}
+ /* Backslash, $, and ` are special inside double quotes.
+ If we see any of those, punt. */
+ else if (instring == '"' && index ("\\$`", *p) != 0)
+ goto slow;
else
*ap++ = *p;
}
break;
case '\'':
- instring = 1;
+ case '"':
+ instring = *p;
break;
case '\n':
continue;
}
- if (*p == '\\' || *p == '\''
+ if (*p == '\\' || *p == '\'' || *p == '"'
|| isspace (*p)
|| index (sh_chars, *p) != 0)
*ap++ = '\\';
return new_argv;
}
-/* Figure out the argument list necessary to run LINE as a command.
- Try to avoid using a shell. This routine handles only ' quoting.
- Starting quotes may be escaped with a backslash. If any of the
- characters in sh_chars[] is seen, or any of the builtin commands
- listed in sh_cmds[] is the first word of a line, the shell is used.
+/* Figure out the argument list necessary to run LINE as a command. Try to
+ avoid using a shell. This routine handles only ' quoting, and " quoting
+ when no backslash, $ or ` characters are seen in the quotes. Starting
+ quotes may be escaped with a backslash. If any of the characters in
+ sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[]
+ is the first word of a line, the shell is used.
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
If *RESTP is NULL, newlines will be ignored.