diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/fnmatch.h | 4 | ||||
-rw-r--r-- | posix/getopt.c | 2 | ||||
-rw-r--r-- | posix/glob.c | 41 | ||||
-rw-r--r-- | posix/glob.h | 4 |
4 files changed, 27 insertions, 24 deletions
diff --git a/posix/fnmatch.h b/posix/fnmatch.h index 58880eceec..38b7255f4d 100644 --- a/posix/fnmatch.h +++ b/posix/fnmatch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,7 @@ extern "C" { #endif #if (defined (__cplusplus) || (defined (__STDC__) && __STDC__) \ - || defined (WIN32)) + || defined (WINDOWS32)) #undef __P #define __P(protos) protos #else /* Not C++ or ANSI C. */ diff --git a/posix/getopt.c b/posix/getopt.c index 59b51cd679..c5574eab69 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -76,7 +76,7 @@ #endif #endif -#if defined (WIN32) && !defined (__CYGWIN32__) +#if defined (_WINDOWS32) && !defined (__CYGWIN32__) /* It's not Unix, really. See? Capital letters. */ #include <windows.h> #define getpid() GetCurrentProcessId() diff --git a/posix/glob.c b/posix/glob.c index 6d9af102f8..6a82fe0254 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -37,6 +37,8 @@ /* #define NDEBUG 1 */ #include <assert.h> +#include <stdio.h> /* Needed on stupid SunOS for assert. */ + /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C @@ -69,7 +71,7 @@ #endif #endif -#if !defined (_AMIGA) && !defined (VMS) && !defined(WIN32) +#if !defined (_AMIGA) && !defined (VMS) && !defined(WINDOWS32) #include <pwd.h> #endif @@ -113,7 +115,7 @@ extern int errno; #endif -#if (defined (POSIX) || defined (WIN32)) && !defined (__GNU_LIBRARY__) +#if (defined (POSIX) || defined (WINDOWS32)) && !defined (__GNU_LIBRARY__) /* Posix does not require that the d_ino field be present, and some systems do not provide it. */ #define REAL_DIR_ENTRY(dp) 1 @@ -173,7 +175,7 @@ extern void bcopy (); __inline #endif #ifndef __SASC -#ifdef WIN32 +#ifdef WINDOWS32 static void * #else static char * @@ -203,11 +205,11 @@ my_realloc (p, n) #include <alloca.h> #else /* Not HAVE_ALLOCA_H. */ #ifndef _AIX -#ifdef WIN32 +#ifdef WINDOWS32 #include <malloc.h> #else extern char *alloca (); -#endif /* WIN32 */ +#endif /* WINDOWS32 */ #endif /* Not _AIX. */ #endif /* sparc or HAVE_ALLOCA_H. */ #endif /* GCC. */ @@ -265,7 +267,8 @@ static inline #endif const char * -next_brace_sub (const char *begin) +next_brace_sub (begin) + const char *begin; { unsigned int depth = 0; const char *cp = begin; @@ -504,17 +507,15 @@ glob (pattern, flags, errfunc, pglob) if (home_dir == NULL || home_dir[0] == '\0') home_dir = "SYS:"; #else -#ifdef WIN32 +#ifdef WINDOWS32 if (home_dir == NULL || home_dir[0] == '\0') home_dir = "c:/users/default"; /* poor default */ #else if (home_dir == NULL || home_dir[0] == '\0') { - extern char *getlogin __P ((void)); - extern int getlogin_r __P ((char *, size_t)); int success; - #if defined HAVE_GETLOGIN_R || defined _LIBC + extern int getlogin_r __P ((char *, size_t)); size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1; char *name; @@ -522,11 +523,13 @@ glob (pattern, flags, errfunc, pglob) /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try a moderate value. */ buflen = 16; - name = __alloca (buflen); + name = (char *) __alloca (buflen); success = getlogin_r (name, buflen) >= 0; #else + extern char *getlogin __P ((void)); char *name; + success = (name = getlogin ()) != NULL; #endif if (success) @@ -536,7 +539,7 @@ glob (pattern, flags, errfunc, pglob) char *pwtmpbuf; struct passwd pwbuf, *p; - pwtmpbuf = __alloca (pwbuflen); + pwtmpbuf = (char *) __alloca (pwbuflen); success = (__getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) >= 0); @@ -550,7 +553,7 @@ glob (pattern, flags, errfunc, pglob) } if (home_dir == NULL || home_dir[0] == '\0') home_dir = (char *) "~"; /* No luck. */ -#endif /* WIN32 */ +#endif /* WINDOWS32 */ #endif /* Now construct the full directory. */ if (dirname[1] == '\0') @@ -559,13 +562,13 @@ glob (pattern, flags, errfunc, pglob) { char *newp; size_t home_len = strlen (home_dir); - newp = __alloca (home_len + dirlen); + newp = (char *) __alloca (home_len + dirlen); memcpy (newp, home_dir, home_len); memcpy (&newp[home_len], &dirname[1], dirlen); dirname = newp; } } -#if !defined _AMIGA && !defined WIN32 +#if !defined _AMIGA && !defined WINDOWS32 else { char *end_name = strchr (dirname, '/'); @@ -576,7 +579,7 @@ glob (pattern, flags, errfunc, pglob) user_name = dirname + 1; else { - user_name = __alloca (end_name - dirname); + user_name = (char *) __alloca (end_name - dirname); memcpy (user_name, dirname + 1, end_name - dirname); user_name[end_name - dirname - 1] = '\0'; } @@ -585,7 +588,7 @@ glob (pattern, flags, errfunc, pglob) { #if defined HAVE_GETPWNAM_R || defined _LIBC size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX); - char *pwtmpbuf = __alloca (buflen); + char *pwtmpbuf = (char *) __alloca (buflen); struct passwd pwbuf, *p; if (__getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0) home_dir = p->pw_dir; @@ -605,14 +608,14 @@ glob (pattern, flags, errfunc, pglob) char *newp; size_t home_len = strlen (home_dir); size_t rest_len = end_name == NULL ? 0 : strlen (end_name); - newp = __alloca (home_len + rest_len + 1); + newp = (char *) __alloca (home_len + rest_len + 1); memcpy (newp, home_dir, home_len); memcpy (&newp[home_len], end_name, rest_len); newp[home_len + rest_len] = '\0'; dirname = newp; } } -#endif /* Not Amiga && not Win32. */ +#endif /* Not Amiga && not WINDOWS32. */ } #endif /* Not VMS. */ diff --git a/posix/glob.h b/posix/glob.h index db44f7a69c..515514a4c2 100644 --- a/posix/glob.h +++ b/posix/glob.h @@ -28,7 +28,7 @@ extern "C" #undef __ptr_t #if (defined (__cplusplus) || (defined (__STDC__) && __STDC__) \ - || defined (WIN32)) + || defined (WINDOWS32)) #undef __P #define __P(protos) protos #define __ptr_t void * @@ -54,7 +54,7 @@ extern "C" GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ GLOB_NOMAGIC|GLOB_TILDE) -#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE) +#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE) || defined (_GNU_SOURCE) #define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ #define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ #define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ |