aboutsummaryrefslogtreecommitdiff
path: root/gdb/command.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-08-23 22:40:00 +0000
committerJason Molenda <jmolenda@apple.com>1999-08-23 22:40:00 +0000
commit53a5351d907ef4eacd463a48a86d35b2b70b9f60 (patch)
tree22c35199ec70962e33c63d2111f333bfdcce02e1 /gdb/command.c
parent093505ad6138b9e165876765ecd667c90fc921ae (diff)
downloadgdb-53a5351d907ef4eacd463a48a86d35b2b70b9f60.zip
gdb-53a5351d907ef4eacd463a48a86d35b2b70b9f60.tar.gz
gdb-53a5351d907ef4eacd463a48a86d35b2b70b9f60.tar.bz2
import gdb-1999-08-23 snapshot
Diffstat (limited to 'gdb/command.c')
-rw-r--r--gdb/command.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/gdb/command.c b/gdb/command.c
index dc39265..277d7e5 100644
--- a/gdb/command.c
+++ b/gdb/command.c
@@ -36,6 +36,11 @@
#include "wait.h"
+/* FIXME: this should be auto-configured! */
+#ifdef __MSDOS__
+# define CANT_FORK
+#endif
+
/* Prototypes for local functions */
static void undef_cmd_error PARAMS ((char *, char *));
@@ -1453,9 +1458,29 @@ shell_escape (arg, from_tty)
int from_tty;
{
#ifdef CANT_FORK
- /* FIXME: what about errors (I don't know how GO32 system() handles
- them)? */
- system (arg);
+ /* If ARG is NULL, they want an inferior shell, but `system' just
+ reports if the shell is available when passed a NULL arg. */
+ int rc = system (arg ? arg : "");
+
+ if (!arg)
+ arg = "inferior shell";
+
+ if (rc == -1)
+ {
+ fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg,
+ safe_strerror (errno));
+ gdb_flush (gdb_stderr);
+ }
+ else if (rc)
+ {
+ fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc);
+ gdb_flush (gdb_stderr);
+ }
+#ifdef __DJGPP__
+ /* Make sure to return to the directory GDB thinks it is, in case the
+ shell command we just ran changed it. */
+ chdir (current_directory);
+#endif
#else /* Can fork. */
int rc, status, pid;
char *p, *user_shell;