Sat Jul 20 21:55:31 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>

Win32 hacks from <Rob_Tulloh@tivoli.com>.
	* posix/glob.c [WIN32]: Don't include <pwd.h>; don't use d_ino;
	use void * for my_realloc; include <malloc.h> for alloca.
	(glob) [WIN32]: Use "c:/users/default" for ~ if no HOME variable.
	* posix/fnmatch.h [WIN32]: Use prototypes even if [!__STDC__].
	* posix/glob.h: Likewise.
This commit is contained in:
Roland McGrath 1996-07-21 01:55:51 +00:00
parent 5764121c46
commit ed30638ace
3 changed files with 24 additions and 4 deletions

View File

@ -23,7 +23,8 @@ Cambridge, MA 02139, USA. */
extern "C" { extern "C" {
#endif #endif
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) #if (defined (__cplusplus) || (defined (__STDC__) && __STDC__) \
|| defined (WIN32))
#undef __P #undef __P
#define __P(protos) protos #define __P(protos) protos
#else /* Not C++ or ANSI C. */ #else /* Not C++ or ANSI C. */

View File

@ -65,7 +65,7 @@ Cambridge, MA 02139, USA. */
#endif #endif
#endif #endif
#if !defined (_AMIGA) && !defined (VMS) #if !defined (_AMIGA) && !defined (VMS) && !defined(WIN32)
#include <pwd.h> #include <pwd.h>
#endif #endif
@ -106,7 +106,7 @@ extern int errno;
#endif #endif
#if defined (POSIX) && !defined (__GNU_LIBRARY__) #if (defined (POSIX) || defined (WIN32)) && !defined (__GNU_LIBRARY__)
/* Posix does not require that the d_ino field be present, and some /* Posix does not require that the d_ino field be present, and some
systems do not provide it. */ systems do not provide it. */
#define REAL_DIR_ENTRY(dp) 1 #define REAL_DIR_ENTRY(dp) 1
@ -166,7 +166,11 @@ extern void bcopy ();
__inline __inline
#endif #endif
#ifndef __SASC #ifndef __SASC
#ifdef WIN32
static void *
#else
static char * static char *
#endif
my_realloc (p, n) my_realloc (p, n)
char *p; char *p;
unsigned int n; unsigned int n;
@ -192,7 +196,11 @@ my_realloc (p, n)
#include <alloca.h> #include <alloca.h>
#else /* Not HAVE_ALLOCA_H. */ #else /* Not HAVE_ALLOCA_H. */
#ifndef _AIX #ifndef _AIX
#ifdef WIN32
#include <malloc.h>
#else
extern char *alloca (); extern char *alloca ();
#endif /* WIN32 */
#endif /* Not _AIX. */ #endif /* Not _AIX. */
#endif /* sparc or HAVE_ALLOCA_H. */ #endif /* sparc or HAVE_ALLOCA_H. */
#endif /* GCC. */ #endif /* GCC. */
@ -448,6 +456,10 @@ glob (pattern, flags, errfunc, pglob)
#ifdef _AMIGA #ifdef _AMIGA
if (dirname == NULL || dirname[0] == '\0') if (dirname == NULL || dirname[0] == '\0')
dirname = "SYS:"; dirname = "SYS:";
#else
#ifdef WIN32
if (dirname == NULL || dirname[0] == '\0')
dirname = "c:/users/default"; /* poor default */
#else #else
if (dirname == NULL || dirname[0] == '\0') if (dirname == NULL || dirname[0] == '\0')
{ {
@ -462,6 +474,7 @@ glob (pattern, flags, errfunc, pglob)
} }
if (dirname == NULL || dirname[0] == '\0') if (dirname == NULL || dirname[0] == '\0')
dirname = (char *) "~"; /* No luck. */ dirname = (char *) "~"; /* No luck. */
#endif /* WIN32 */
#endif #endif
} }
else else
@ -469,11 +482,16 @@ glob (pattern, flags, errfunc, pglob)
#ifdef _AMIGA #ifdef _AMIGA
if (dirname == NULL || dirname[0] == '\0') if (dirname == NULL || dirname[0] == '\0')
dirname = "SYS:"; dirname = "SYS:";
#else
#ifdef WIN32
if (dirname == NULL || dirname[0] == '\0')
dirname = "c:/users/default"; /* poor default */
#else #else
/* Look up specific user's home directory. */ /* Look up specific user's home directory. */
struct passwd *p = getpwnam (dirname + 1); struct passwd *p = getpwnam (dirname + 1);
if (p != NULL) if (p != NULL)
dirname = p->pw_dir; dirname = p->pw_dir;
#endif /* WIN32 */
#endif #endif
} }
} }

View File

@ -25,7 +25,8 @@ extern "C"
#endif #endif
#undef __ptr_t #undef __ptr_t
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) #if (defined (__cplusplus) || (defined (__STDC__) && __STDC__) \
|| defined (WIN32))
#undef __P #undef __P
#define __P(protos) protos #define __P(protos) protos
#define __ptr_t void * #define __ptr_t void *