aboutsummaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-07-21 01:55:51 +0000
committerRoland McGrath <roland@gnu.org>1996-07-21 01:55:51 +0000
commited30638ace1966555acc08568500709df99beafc (patch)
tree3a0d40aa78bef0e828397aeb0f122169fcc4e50d /posix
parent5764121c46f961be40559886031cbc044544a987 (diff)
downloadglibc-ed30638ace1966555acc08568500709df99beafc.tar
glibc-ed30638ace1966555acc08568500709df99beafc.tar.gz
glibc-ed30638ace1966555acc08568500709df99beafc.tar.bz2
glibc-ed30638ace1966555acc08568500709df99beafc.zip
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.
Diffstat (limited to 'posix')
-rw-r--r--posix/fnmatch.h3
-rw-r--r--posix/glob.c22
-rw-r--r--posix/glob.h3
3 files changed, 24 insertions, 4 deletions
diff --git a/posix/fnmatch.h b/posix/fnmatch.h
index d9d73b3d86..9a0036e53a 100644
--- a/posix/fnmatch.h
+++ b/posix/fnmatch.h
@@ -23,7 +23,8 @@ Cambridge, MA 02139, USA. */
extern "C" {
#endif
-#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
+#if (defined (__cplusplus) || (defined (__STDC__) && __STDC__) \
+ || defined (WIN32))
#undef __P
#define __P(protos) protos
#else /* Not C++ or ANSI C. */
diff --git a/posix/glob.c b/posix/glob.c
index d6635fc9d0..76060e1425 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -65,7 +65,7 @@ Cambridge, MA 02139, USA. */
#endif
#endif
-#if !defined (_AMIGA) && !defined (VMS)
+#if !defined (_AMIGA) && !defined (VMS) && !defined(WIN32)
#include <pwd.h>
#endif
@@ -106,7 +106,7 @@ extern int errno;
#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
systems do not provide it. */
#define REAL_DIR_ENTRY(dp) 1
@@ -166,7 +166,11 @@ extern void bcopy ();
__inline
#endif
#ifndef __SASC
+#ifdef WIN32
+static void *
+#else
static char *
+#endif
my_realloc (p, n)
char *p;
unsigned int n;
@@ -192,7 +196,11 @@ my_realloc (p, n)
#include <alloca.h>
#else /* Not HAVE_ALLOCA_H. */
#ifndef _AIX
+#ifdef WIN32
+#include <malloc.h>
+#else
extern char *alloca ();
+#endif /* WIN32 */
#endif /* Not _AIX. */
#endif /* sparc or HAVE_ALLOCA_H. */
#endif /* GCC. */
@@ -449,6 +457,10 @@ glob (pattern, flags, errfunc, pglob)
if (dirname == NULL || dirname[0] == '\0')
dirname = "SYS:";
#else
+#ifdef WIN32
+ if (dirname == NULL || dirname[0] == '\0')
+ dirname = "c:/users/default"; /* poor default */
+#else
if (dirname == NULL || dirname[0] == '\0')
{
extern char *getlogin __P ((void));
@@ -462,6 +474,7 @@ glob (pattern, flags, errfunc, pglob)
}
if (dirname == NULL || dirname[0] == '\0')
dirname = (char *) "~"; /* No luck. */
+#endif /* WIN32 */
#endif
}
else
@@ -470,10 +483,15 @@ glob (pattern, flags, errfunc, pglob)
if (dirname == NULL || dirname[0] == '\0')
dirname = "SYS:";
#else
+#ifdef WIN32
+ if (dirname == NULL || dirname[0] == '\0')
+ dirname = "c:/users/default"; /* poor default */
+#else
/* Look up specific user's home directory. */
struct passwd *p = getpwnam (dirname + 1);
if (p != NULL)
dirname = p->pw_dir;
+#endif /* WIN32 */
#endif
}
}
diff --git a/posix/glob.h b/posix/glob.h
index ba24d890c4..571bd5e405 100644
--- a/posix/glob.h
+++ b/posix/glob.h
@@ -25,7 +25,8 @@ extern "C"
#endif
#undef __ptr_t
-#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
+#if (defined (__cplusplus) || (defined (__STDC__) && __STDC__) \
+ || defined (WIN32))
#undef __P
#define __P(protos) protos
#define __ptr_t void *