Mail Archives: djgpp-workers/1999/08/01/10:23:53
These are the patches for the libiberty subdirectory.
1999-07-30 Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
* pexecute.c (pexecute) [__GO32__]: Use P_WAIT instead of literal
1. Cast program to "char *", to shut up gcc.
(pwait) [__DJGPP__]: Return ECHILD if called with a wrong pid.
Fix the status code to conform to DJGPP's WIF* macros.
1999-07-13 Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
* choose-temp.c (DIR_SEPARATOR): For DJGPP, use the forward
slash. Define to ':' for MPW.
(IS_DIR_SEPARATOR): New macro.
(choose_temp_base): Use IS_DIR_SEPARATOR.
* argv.c (BACKSLASH_AS_SLASH) [__MSDOS__ || _WIN32]: Define.
(buildargv) [BACKSLASH_AS_SLASH]: Backslash is an escape character
only before a quote character.
*** libiberty/pexecute.c~0 Fri May 1 18:47:52 1998
--- libiberty/pexecute.c Fri Jul 30 19:12:16 1999
*************** pexecute (program, argv, this_pname, tem
*** 140,146 ****
#ifdef __GO32__
/* ??? What are the possible return values from spawnv? */
! rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
#else
char *scmd, *rf;
FILE *argfile;
--- 140,146 ----
#ifdef __GO32__
/* ??? What are the possible return values from spawnv? */
! rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv);
#else
char *scmd, *rf;
FILE *argfile;
*************** pexecute (program, argv, this_pname, tem
*** 187,193 ****
if (rc == -1)
{
*errmsg_fmt = install_error_msg;
! *errmsg_arg = program;
return -1;
}
--- 187,193 ----
if (rc == -1)
{
*errmsg_fmt = install_error_msg;
! *errmsg_arg = (char *)program;
return -1;
}
*************** pwait (pid, status, flags)
*** 207,219 ****
/* Called twice for the same child? */
|| pid == last_reaped)
{
! /* ??? ECHILD would be a better choice. Can we use it here? */
errno = EINVAL;
return -1;
}
! /* ??? Here's an opportunity to canonicalize the values in STATUS.
! Needed? */
*status = last_status;
last_reaped = last_pid;
return last_pid;
}
--- 207,227 ----
/* Called twice for the same child? */
|| pid == last_reaped)
{
! /* ECHILD is a better choice, if we can use it. */
! #ifdef __DJGPP__
! errno = ECHILD;
! #else
errno = EINVAL;
+ #endif
return -1;
}
! /* Here's an opportunity to canonicalize the values in STATUS, if
! needed. */
! #ifdef __DJGPP__
! *status = (last_status >> 8);
! #else
*status = last_status;
+ #endif
last_reaped = last_pid;
return last_pid;
}
*** libiberty/choose-temp.c1~ Fri May 1 18:47:48 1998
--- libiberty/choose-temp.c Sat Jul 31 14:28:00 1999
*************** extern char *xmalloc ();
*** 51,59 ****
#include "ansidecl.h"
#include "libiberty.h"
#if defined (__MSDOS__) || defined (_WIN32)
#define DIR_SEPARATOR '\\'
#endif
! #endif
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
--- 51,74 ----
#include "ansidecl.h"
#include "libiberty.h"
#if defined (__MSDOS__) || defined (_WIN32)
+ #define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\')
+ /* For DJGPP, use the forward slash. This is better, since some
+ utilities have only halfhearted support for DOSish style file
+ names with backslashes, whereas DJGPP library can use both
+ styles alike. So it is better to return forward slashes to the
+ application. */
+ #ifndef __DJGPP__
#define DIR_SEPARATOR '\\'
#endif
! #else
! #ifdef MPW
! #define IS_DIR_SEPARATOR(c) ((c) == ':')
! #define DIR_SEPARATOR ':'
! #else
! #define IS_DIR_SEPARATOR(c) ((c) == '/')
! #endif /* !MPW */
! #endif /* !__MSDOS__, !_WIN32 */
! #endif /* !IN_GCC */
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
*************** choose_temp_base ()
*** 133,147 ****
+ strlen (TEMP_FILE) + 1);
strcpy (temp_filename, base);
- #ifndef MPW
if (len != 0
! && temp_filename[len-1] != '/'
! && temp_filename[len-1] != DIR_SEPARATOR)
temp_filename[len++] = DIR_SEPARATOR;
- #else /* MPW */
- if (temp_filename[len-1] != ':')
- temp_filename[len++] = ':';
- #endif /* MPW */
strcpy (temp_filename + len, TEMP_FILE);
mktemp (temp_filename);
--- 148,156 ----
+ strlen (TEMP_FILE) + 1);
strcpy (temp_filename, base);
if (len != 0
! && !IS_DIR_SEPARATOR (temp_filename[len-1]))
temp_filename[len++] = DIR_SEPARATOR;
strcpy (temp_filename + len, TEMP_FILE);
mktemp (temp_filename);
*** libiberty/argv.c1~ Fri May 1 18:47:48 1998
--- libiberty/argv.c Tue Jul 27 19:15:56 1999
*************** extern char *strdup (); /* Duplicate a
*** 55,60 ****
--- 55,64 ----
#endif /* __STDC__ */
+ #if defined(__MSDOS__) || defined(_WIN32)
+ #define BACKSLASH_AS_SLASH
+ #endif
+
#include "alloca-conf.h"
#ifndef NULL
*************** char *input;
*** 277,282 ****
--- 281,290 ----
}
else if (*input == '\\')
{
+ #ifdef BACKSLASH_AS_SLASH
+ /* Don't break dosish file names. */
+ if (input[1] == '\'' || input[1] == '"')
+ #endif
bsquote = 1;
}
else if (squote)
- Raw text -