summaryrefslogtreecommitdiff
path: root/libiberty/pexecute.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1997-10-14 19:10:45 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1997-10-14 19:10:45 +0000
commit8f71bf1d543bc7f8060e71577454e7cf1283fe57 (patch)
treeb6cfbdffaad259ea4ff8c43d7e1e9abb33446d1f /libiberty/pexecute.c
parentf65e414240ee016cf507291d503077291abd3616 (diff)
downloadgcc-8f71bf1d543bc7f8060e71577454e7cf1283fe57.tar.gz
Tue Oct 14 12:01:00 1997 Mark Mitchell <mmitchell@usa.net>
* cplus-dem.c (demangle_signature): Don't look for return types on constructors. Handle member template constructors. and update from devo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@15901 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/pexecute.c')
-rw-r--r--libiberty/pexecute.c55
1 files changed, 52 insertions, 3 deletions
diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c
index ab5f392780c..b8594eb0954 100644
--- a/libiberty/pexecute.c
+++ b/libiberty/pexecute.c
@@ -23,11 +23,14 @@ Boston, MA 02111-1307, USA. */
/* This file lives in at least two places: libiberty and gcc.
Don't change one without the other. */
+#ifdef IN_GCC
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <errno.h>
#ifdef IN_GCC
-#include "config.h"
#include "gansidecl.h"
/* ??? Need to find a suitable header file. */
#define PEXECUTE_FIRST 1
@@ -223,6 +226,51 @@ pwait (pid, status, flags)
extern int _spawnv ();
extern int _spawnvp ();
+#ifdef __CYGWIN32__
+
+#define fix_argv(argvec) (argvec)
+
+#else
+
+/* This is a kludge to get around the Microsoft C spawn functions' propensity
+ to remove the outermost set of double quotes from all arguments. */
+
+const char * const *
+fix_argv (argvec)
+ char **argvec;
+{
+ int i;
+
+ for (i = 1; argvec[i] != 0; i++)
+ {
+ int len, j;
+ char *temp, *newtemp;
+
+ temp = argvec[i];
+ len = strlen (temp);
+ for (j = 0; j < len; j++)
+ {
+ if (temp[j] == '"')
+ {
+ newtemp = xmalloc (len + 2);
+ strncpy (newtemp, temp, j);
+ newtemp [j] = '\\';
+ strncpy (&newtemp [j+1], &temp [j], len-j);
+ newtemp [len+1] = 0;
+ temp = newtemp;
+ len++;
+ j++;
+ }
+ }
+
+ argvec[i] = temp;
+ }
+
+ return (const char * const *) argvec;
+}
+
+#endif /* ! defined (__CYGWIN32__) */
+
int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
const char *program;
@@ -236,7 +284,8 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
abort ();
- pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv) (_P_NOWAIT, program, argv);
+ pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
+ (_P_NOWAIT, program, fix_argv(argv));
if (pid == -1)
{
*errmsg_fmt = install_error_msg;
@@ -254,7 +303,7 @@ pwait (pid, status, flags)
{
/* ??? Here's an opportunity to canonicalize the values in STATUS.
Needed? */
- return cwait (status, pid, WAIT_CHILD);
+ return _cwait (status, pid, WAIT_CHILD);
}
#endif /* _WIN32 */