X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=libiberty%2Fchoose-temp.c;h=1a475dd6fb93b91cd2cb2d26416a7d779cec13ac;hp=089bd10208dbae02fa825ff5aaff5b176e4572bb;hb=da8bd873fe10f6278a039cd7feea5b00fb393221;hpb=4ae639597f68c1d6de4337dceeb61d532e732f72 diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c index 089bd10208d..1a475dd6fb9 100644 --- a/libiberty/choose-temp.c +++ b/libiberty/choose-temp.c @@ -19,25 +19,22 @@ Boston, MA 02111-1307, USA. */ /* This file exports two functions: choose_temp_base and make_temp_file. */ -/* This file lives in at least two places: libiberty and gcc. - Don't change one without the other. */ - -#if defined (IN_GCC) || defined (HAVE_CONFIG_H) +#ifdef HAVE_CONFIG_H #include "config.h" #endif -#ifdef IN_GCC -#include "system.h" -#else - -/* If we are in gcc, system.h has handled everything. When not in - gcc, if we have a config.h we assume that HAVE_SYS_FILE_H tells us - whether to include sys/file.h. However, libiberty does not have a - config.h, and instead arranges to define NO_SYS_FILE_H on the - command line when there is no sys/file.h. */ - -#if defined (HAVE_CONFIG_H) ? defined (HAVE_SYS_FILE_H) : ! defined (NO_SYS_FILE_H) +#include /* May get P_tmpdir. */ #include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_SYS_FILE_H #include /* May get R_OK, etc. on some systems. */ #endif @@ -47,14 +44,11 @@ Boston, MA 02111-1307, USA. */ #define X_OK 1 #endif -#include /* May get P_tmpdir. */ -#endif /* IN_GCC */ - #include "libiberty.h" -#ifdef IN_GCC extern int mkstemps (); -#else -#if defined (__MSDOS__) || defined (_WIN32) + +#ifndef IN_GCC +#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN)) #define DIR_SEPARATOR '\\' #endif #endif @@ -85,9 +79,11 @@ extern int mkstemps (); If success, DIR is returned. Otherwise NULL is returned. */ -static char * +static const char *try PARAMS ((const char *, const char *)); + +static const char * try (dir, base) - char *dir, *base; + const char *dir, *base; { if (base != 0) return base; @@ -108,7 +104,7 @@ try (dir, base) char * choose_temp_base () { - char *base = 0; + const char *base = 0; char *temp_filename; int len; static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 }; @@ -151,9 +147,9 @@ choose_temp_base () char * make_temp_file (suffix) - char *suffix; + const char *suffix; { - char *base = 0; + const char *base = 0; char *temp_filename; int base_len, suffix_len; int fd;