aboutsummaryrefslogtreecommitdiff
path: root/gdb/fork-child.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-07-27 17:43:09 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-07-27 17:43:09 +0000
commit38bbfd37955ebeb355922d7dad7d33d64537d5f2 (patch)
treef9d1de18bbd98a9c6d63fc678adeb35a82b41e64 /gdb/fork-child.c
parent4e95866e2c5d769e6b7db09ca3247d497af941c9 (diff)
downloadfsf-binutils-gdb-38bbfd37955ebeb355922d7dad7d33d64537d5f2.zip
fsf-binutils-gdb-38bbfd37955ebeb355922d7dad7d33d64537d5f2.tar.gz
fsf-binutils-gdb-38bbfd37955ebeb355922d7dad7d33d64537d5f2.tar.bz2
* fork-child.c (fork_inferior): Only quote exec file if needed.
* mipsread.c (parse_symbol): Remove 21 Jul 93 change with stTypedef inside an stBlock.
Diffstat (limited to 'gdb/fork-child.c')
-rw-r--r--gdb/fork-child.c56
1 files changed, 47 insertions, 9 deletions
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index b413889..40f7680 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -97,20 +97,58 @@ fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun)
#endif
strcat (shell_command, "exec ");
- /* Now add exec_file, quoting as necessary. Quoting in this style is
- said to work with all shells. */
+ /* Now add exec_file, quoting as necessary. */
{
char *p;
+ int need_to_quote;
- strcat (shell_command, "'");
- for (p = exec_file; *p != '\0'; ++p)
+ /* Quoting in this style is said to work with all shells. But csh
+ on IRIX 4.0.1 can't deal with it. So we only quote it if we need
+ to. */
+ p = exec_file;
+ while (1)
{
- if (*p == '\'')
- strcat (shell_command, "'\\''");
- else
- strncat (shell_command, p, 1);
+ switch (*p)
+ {
+ case '\'':
+ case '"':
+ case '(':
+ case ')':
+ case '$':
+ case '&':
+ case ';':
+ case '<':
+ case '>':
+ case ' ':
+ case '\n':
+ case '\t':
+ need_to_quote = 1;
+ goto end_scan;
+
+ case '\0':
+ need_to_quote = 0;
+ goto end_scan;
+
+ default:
+ break;
+ }
+ ++p;
+ }
+ end_scan:
+ if (need_to_quote)
+ {
+ strcat (shell_command, "'");
+ for (p = exec_file; *p != '\0'; ++p)
+ {
+ if (*p == '\'')
+ strcat (shell_command, "'\\''");
+ else
+ strncat (shell_command, p, 1);
+ }
+ strcat (shell_command, "'");
}
- strcat (shell_command, "'");
+ else
+ strcat (shell_command, exec_file);
}
strcat (shell_command, " ");