This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[eliz@is.elta.co.il: Shell escape in the DJGPP port of GDB]


------- Start of forwarded message -------
Date: Sun, 27 Jun 1999 18:58:13 +0300 (IDT)
From: Eli Zaretskii <eliz@is.elta.co.il>
X-Sender: eliz@is
To: DJ Delorie <dj@delorie.com>
cc: Robert Hoehne <robert.hoehne@gmx.net>
Subject: Shell escape in the DJGPP port of GDB
Content-Type: TEXT/PLAIN; charset=US-ASCII

These patches make the shell command work correctly in the GDB port.

1999-06-26  Eli Zaretskii  <eliz@is.elta.co.il>

	* command.c (CANT_FORK) [__MSDOS__]: Define.
	(shell_escape) [CANT_FORK]: If ARG is NULL, pass an empty string
	to `system'.
	[__DJGPP__]: Return to the original directory after the shell
	exits.

*** ./gdb/command.c~0	Thu Dec 31 21:58:04 1998
- --- ./gdb/command.c	Sat May 22 12:56:30 1999
*************** Foundation, Inc., 59 Temple Place - Suit
*** 35,40 ****
- --- 35,45 ----
  
  #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 *));
*************** shell_escape (arg, from_tty)
*** 1441,1449 ****
       int from_tty;
  {
  #ifdef CANT_FORK
!   /* FIXME: what about errors (I don't know how GO32 system() handles
!      them)?  */
!   system (arg);
  #else /* Can fork.  */
    int rc, status, pid;
    char *p, *user_shell;
- --- 1446,1474 ----
       int from_tty;
  {
  #ifdef CANT_FORK
!   /* 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;
------- End of forwarded message -------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]