pexecute.c: Updates from gcc.
* pexecute.c: Updates from gcc. Copy in gcc has been removed. This is the canonical copy. Define ISSPACE if !IN_GCC. From-SVN: r22243
This commit is contained in:
parent
2a63377ccf
commit
3f3726a3fe
2 changed files with 34 additions and 15 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat Sep 5 03:24:49 1998 Jeffrey A Law (law@cygnus.com)
|
||||||
|
|
||||||
|
* pexecute.c: Updates from gcc. Copy in gcc has been removed. This
|
||||||
|
is the canonical copy. Define ISSPACE if !IN_GCC.
|
||||||
|
|
||||||
Wed Aug 19 14:05:01 1998 Mumit Khan <khan@xraylith.wisc.edu>
|
Wed Aug 19 14:05:01 1998 Mumit Khan <khan@xraylith.wisc.edu>
|
||||||
|
|
||||||
* cplus-dem.c (work_stuff): Add dllimported.
|
* cplus-dem.c (work_stuff): Add dllimported.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Utilities to execute a program in a subprocess (possibly linked by pipes
|
/* Utilities to execute a program in a subprocess (possibly linked by pipes
|
||||||
with other subprocesses), and wait for it.
|
with other subprocesses), and wait for it.
|
||||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of the libiberty library.
|
This file is part of the libiberty library.
|
||||||
Libiberty is free software; you can redistribute it and/or
|
Libiberty is free software; you can redistribute it and/or
|
||||||
|
@ -25,10 +25,12 @@ Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifdef IN_GCC
|
#ifdef IN_GCC
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#include "system.h"
|
||||||
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#define ISSPACE (x) isspace(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef IN_GCC
|
#ifdef IN_GCC
|
||||||
#include "gansidecl.h"
|
#include "gansidecl.h"
|
||||||
|
@ -166,7 +168,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||||
char *cp;
|
char *cp;
|
||||||
for (cp = argv[i]; *cp; cp++)
|
for (cp = argv[i]; *cp; cp++)
|
||||||
{
|
{
|
||||||
if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp))
|
if (*cp == '"' || *cp == '\'' || *cp == '\\' || ISSPACE (*cp))
|
||||||
fputc ('\\', argfile);
|
fputc ('\\', argfile);
|
||||||
fputc (*cp, argfile);
|
fputc (*cp, argfile);
|
||||||
}
|
}
|
||||||
|
@ -509,7 +511,7 @@ static int first_time = 1;
|
||||||
int
|
int
|
||||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||||
const char *program;
|
const char *program;
|
||||||
char **argv;
|
char * const *argv;
|
||||||
const char *this_pname;
|
const char *this_pname;
|
||||||
const char *temp_base;
|
const char *temp_base;
|
||||||
char **errmsg_fmt, **errmsg_arg;
|
char **errmsg_fmt, **errmsg_arg;
|
||||||
|
@ -538,14 +540,18 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||||
fputc (' ', stdout);
|
fputc (' ', stdout);
|
||||||
for (i=1; argv[i]; i++)
|
for (i=1; argv[i]; i++)
|
||||||
{
|
{
|
||||||
/* We have to quote every arg, so that when the echo is
|
|
||||||
executed, the quotes are stripped and the original arg
|
|
||||||
is left. */
|
|
||||||
fputc ('\'', stdout);
|
fputc ('\'', stdout);
|
||||||
|
/* See if we have an argument that needs fixing. */
|
||||||
|
if (strchr(argv[i], '/'))
|
||||||
|
{
|
||||||
|
tmpname = (char *) xmalloc (256);
|
||||||
|
mpwify_filename (argv[i], tmpname);
|
||||||
|
argv[i] = tmpname;
|
||||||
|
}
|
||||||
for (cp = argv[i]; *cp; cp++)
|
for (cp = argv[i]; *cp; cp++)
|
||||||
{
|
{
|
||||||
/* Write an Option-d esc char in front of special chars. */
|
/* Write an Option-d escape char in front of special chars. */
|
||||||
if (strchr ("\"'+", *cp))
|
if (strchr("'+", *cp))
|
||||||
fputc ('\266', stdout);
|
fputc ('\266', stdout);
|
||||||
fputc (*cp, stdout);
|
fputc (*cp, stdout);
|
||||||
}
|
}
|
||||||
|
@ -560,15 +566,20 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||||
|
|
||||||
for (i=1; argv[i]; i++)
|
for (i=1; argv[i]; i++)
|
||||||
{
|
{
|
||||||
|
/* See if we have an argument that needs fixing. */
|
||||||
|
if (strchr(argv[i], '/'))
|
||||||
|
{
|
||||||
|
tmpname = (char *) xmalloc (256);
|
||||||
|
mpwify_filename (argv[i], tmpname);
|
||||||
|
argv[i] = tmpname;
|
||||||
|
}
|
||||||
if (strchr (argv[i], ' '))
|
if (strchr (argv[i], ' '))
|
||||||
fputc ('\'', stdout);
|
fputc ('\'', stdout);
|
||||||
for (cp = argv[i]; *cp; cp++)
|
for (cp = argv[i]; *cp; cp++)
|
||||||
{
|
{
|
||||||
/* Write an Option-d esc char in front of special chars. */
|
/* Write an Option-d escape char in front of special chars. */
|
||||||
if (strchr ("\"'+", *cp))
|
if (strchr("'+", *cp))
|
||||||
{
|
fputc ('\266', stdout);
|
||||||
fputc ('\266', stdout);
|
|
||||||
}
|
|
||||||
fputc (*cp, stdout);
|
fputc (*cp, stdout);
|
||||||
}
|
}
|
||||||
if (strchr (argv[i], ' '))
|
if (strchr (argv[i], ' '))
|
||||||
|
@ -628,6 +639,9 @@ pfinish ()
|
||||||
|
|
||||||
extern int execv ();
|
extern int execv ();
|
||||||
extern int execvp ();
|
extern int execvp ();
|
||||||
|
#ifdef IN_GCC
|
||||||
|
extern char * my_strerror PROTO ((int));
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
|
||||||
|
|
Loading…
Add table
Reference in a new issue