diff --git a/posix/glob.c b/posix/glob.c
index 5e4b7fc..d33f9ab 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -15,91 +15,71 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _LIBC
-/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
-   optimizes away the pattern == NULL || pglob == NULL tests below.  */
-# define _GL_ARG_NONNULL(params)
-# include <config.h>
-#endif
-
 #include <glob.h>
-
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
-
-/* Outcomment the following line for production quality code.  */
-/* #define NDEBUG 1 */
 #include <assert.h>
 
-#include <stdio.h>		/* Needed on stupid SunOS for assert.  */
-
 #ifndef GLOB_ONLY_P
+# include <unistd.h>
+# if !defined POSIX && defined _POSIX_VERSION
+#  define POSIX
+# endif
 
-#include <unistd.h>
-#if !defined POSIX && defined _POSIX_VERSION
-# define POSIX
-#endif
+# include <pwd.h>
 
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# define WINDOWS32
-#endif
+# include <errno.h>
+# ifndef __set_errno
+#  define __set_errno(val) errno = (val)
+# endif
 
-#ifndef WINDOWS32
-# include <pwd.h>
-#endif
+# include <dirent.h>
+# include <stdlib.h>
+# include <string.h>
+# include <alloca.h>
 
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(val) errno = (val)
-#endif
+# ifdef _LIBC
+#  undef strdup
+#  define strdup(str)		__strdup (str)
+#  define sysconf(id)		__sysconf (id)
+#  define closedir(dir)		__closedir (dir)
+#  define opendir(name)		__opendir (name)
+#  define readdir(str)		__readdir64 (str)
+#  define getpwnam_r(name, bufp, buf, len, res) \
+    __getpwnam_r (name, bufp, buf, len, res)
+#  ifndef __stat64
+#   define __stat64(fname, buf)	__xstat64 (_STAT_VER, fname, buf)
+#  endif
+#  define struct_stat64		struct stat64
+# else /* !_LIBC */
+#  define __getlogin_r(buf, len) getlogin_r (buf, len)
+#  define __stat64(fname, buf)   stat (fname, buf)
+#  define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
+#  define struct_stat64          struct stat
+#  ifndef __MVS__
+#   define __alloca              alloca
+#  endif
+#  define __readdir              readdir
+#  define __glob_pattern_p       glob_pattern_p
+#  define COMPILE_GLOB64
+# endif /* _LIBC */
+
+# include <fnmatch.h>
 
-#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-#include <alloca.h>
-
-#ifdef _LIBC
-# undef strdup
-# define strdup(str) __strdup (str)
-# define sysconf(id) __sysconf (id)
-# define closedir(dir) __closedir (dir)
-# define opendir(name) __opendir (name)
-# define readdir(str) __readdir64 (str)
-# define getpwnam_r(name, bufp, buf, len, res) \
-   __getpwnam_r (name, bufp, buf, len, res)
-# ifndef __stat64
-#  define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
+# ifdef _SC_GETPW_R_SIZE_MAX
+#  define GETPW_R_SIZE_MAX()	sysconf (_SC_GETPW_R_SIZE_MAX)
+# else
+#  define GETPW_R_SIZE_MAX()	(-1)
 # endif
-# define struct_stat64		struct stat64
-#else /* !_LIBC */
-# define __getlogin_r(buf, len) getlogin_r (buf, len)
-# define __stat64(fname, buf)   stat (fname, buf)
-# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
-# define struct_stat64          struct stat
-# ifndef __MVS__
-#  define __alloca              alloca
+# ifdef _SC_LOGIN_NAME_MAX
+#  define GET_LOGIN_NAME_MAX()	sysconf (_SC_LOGIN_NAME_MAX)
+# else
+#  define GET_LOGIN_NAME_MAX()	(-1)
 # endif
-# define __readdir              readdir
-# define __glob_pattern_p       glob_pattern_p
-# define COMPILE_GLOB64
-#endif /* _LIBC */
-
-#include <fnmatch.h>
-
-#ifdef _SC_GETPW_R_SIZE_MAX
-# define GETPW_R_SIZE_MAX()	sysconf (_SC_GETPW_R_SIZE_MAX)
-#else
-# define GETPW_R_SIZE_MAX()	(-1)
-#endif
-#ifdef _SC_LOGIN_NAME_MAX
-# define GET_LOGIN_NAME_MAX()	sysconf (_SC_LOGIN_NAME_MAX)
-#else
-# define GET_LOGIN_NAME_MAX()	(-1)
-#endif
 
 static const char *next_brace_sub (const char *begin, int flags) __THROWNL;
 
@@ -151,7 +131,7 @@ readdir_result_might_be_dir (struct readdir_result d)
 
 # endif /* defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE */
 
-# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
+# if defined _LIBC || defined D_INO_IN_DIRENT
 /* Initializer for skip_entry.  POSIX does not require that the d_ino
    field be present, and some systems do not provide it. */
 #  define D_INO_TO_RESULT(source) false,
@@ -161,20 +141,20 @@ readdir_result_might_be_dir (struct readdir_result d)
 
 /* Construct an initializer for a struct readdir_result object from a
    struct dirent *.  No copy of the name is made.  */
-#define READDIR_RESULT_INITIALIZER(source) \
+# define READDIR_RESULT_INITIALIZER(source) \
   {					   \
     source->d_name,			   \
     D_TYPE_TO_RESULT (source)		   \
     D_INO_TO_RESULT (source)		   \
   }
 
-#endif /* !defined GLOB_ONLY_P */
+# endif /* !defined GLOB_ONLY_P */
 
 /* Call gl_readdir on STREAM.  This macro can be overridden to reduce
    type safety if an old interface version needs to be supported.  */
-#ifndef GL_READDIR
-# define GL_READDIR(pglob, stream) ((pglob)->gl_readdir (stream))
-#endif
+# ifndef GL_READDIR
+#  define GL_READDIR(pglob, stream) ((pglob)->gl_readdir (stream))
+# endif
 
 /* Extract name and type from directory entry.  No copy of the name is
    made.  If SOURCE is NULL, result name is NULL.  Keep in sync with
@@ -191,7 +171,7 @@ convert_dirent (const struct dirent *source)
   return result;
 }
 
-#ifndef COMPILE_GLOB64
+# ifndef COMPILE_GLOB64
 /* Like convert_dirent, but works on struct dirent64 instead.  Keep in
    sync with convert_dirent above.  */
 static struct readdir_result
@@ -205,44 +185,27 @@ convert_dirent64 (const struct dirent64 *source)
   struct readdir_result result = READDIR_RESULT_INITIALIZER (source);
   return result;
 }
-#endif
-
-
-#ifndef attribute_hidden
-# define attribute_hidden
-#endif
-
-#ifndef __attribute_noinline__
-# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)
-#  define __attribute_noinline__ /* Ignore */
-#else
-#  define __attribute_noinline__ __attribute__ ((__noinline__))
 # endif
-#endif
-
-#ifndef __glibc_unlikely
-# define __glibc_unlikely(expr) __builtin_expect (expr, 0)
-#endif
 
-#ifndef _LIBC
+# ifndef _LIBC
 /* The results of opendir() in this file are not used with dirfd and fchdir,
    and we do not leak fds to any single-threaded code that could use stdio,
    therefore save some unnecessary recursion in fchdir.c and opendir_safer.c.
    FIXME - if the kernel ever adds support for multi-thread safety for
    avoiding standard fds, then we should use opendir_safer.  */
-# ifdef GNULIB_defined_opendir
-#  undef opendir
-# endif
-# ifdef GNULIB_defined_closedir
-#  undef closedir
-# endif
+#  ifdef GNULIB_defined_opendir
+#   undef opendir
+#  endif
+#  ifdef GNULIB_defined_closedir
+#   undef closedir
+#  endif
 
 /* Just use malloc.  */
-# define __libc_use_alloca(n) false
-# define alloca_account(len, avar) ((void) (len), (void) (avar), (void *) 0)
-# define extend_alloca_account(buf, len, newlen, avar) \
+#  define __libc_use_alloca(n) false
+#  define alloca_account(len, avar) ((void) (len), (void) (avar), (void *) 0)
+#  define extend_alloca_account(buf, len, newlen, avar) \
     ((void) (buf), (void) (len), (void) (newlen), (void) (avar), (void *) 0)
-#endif
+# endif
 
 /* Set *R = A + B.  Return true if the answer is mathematically
    incorrect due to overflow; in this case, *R is the low order
@@ -252,16 +215,16 @@ static bool size_add_wrapv (size_t a, size_t b, size_t *r);
 static bool glob_use_alloca (size_t alloca_used, size_t len);
 
 /* We must not compile this function twice.  */
-#ifndef GLOB_COMPAT_BUILD
+# ifndef GLOB_COMPAT_BUILD
 static bool
 size_add_wrapv (size_t a, size_t b, size_t *r)
 {
-#if 5 <= __GNUC__
+# if 5 <= __GNUC__
   return __builtin_add_overflow (a, b, r);
-#else
+# else
   *r = a + b;
   return *r < a;
-#endif
+# endif
 }
 
 static bool
@@ -271,7 +234,7 @@ glob_use_alloca (size_t alloca_used, size_t len)
   return (!size_add_wrapv (alloca_used, len, &size)
 	  && __libc_use_alloca (size));
 }
-#endif
+#endif /* GLOB_ONLY_P  */
 
 static int glob_in_dir (const char *pattern, const char *directory,
 			int flags, int (*errfunc) (const char *, int),
@@ -514,14 +477,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 
   /* Find the filename.  */
   filename = strrchr (pattern, '/');
-#if defined __MSDOS__ || defined WINDOWS32
-  /* The case of "d:pattern".  Since `:' is not allowed in
-     file names, we can safely assume that wherever it
-     happens in pattern, it signals the filename part.  This
-     is so we could some day support patterns like "[a-z]:foo".  */
-  if (filename == NULL)
-    filename = strchr (pattern, ':');
-#endif /* __MSDOS__ || WINDOWS32 */
   dirname_modified = 0;
   if (filename == NULL)
     {
@@ -546,11 +501,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 	    }
 
 	  filename = pattern;
-#ifdef _AMIGA
-	  dirname = (char *) "";
-#else
 	  dirname = (char *) ".";
-#endif
 	  dirlen = 0;
 	}
     }
@@ -567,24 +518,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
     {
       char *newp;
       dirlen = filename - pattern;
-#if defined __MSDOS__ || defined WINDOWS32
-      if (*filename == ':'
-	  || (filename > pattern + 1 && filename[-1] == ':'))
-	{
-	  char *drive_spec;
-
-	  ++dirlen;
-	  drive_spec = __alloca (dirlen + 1);
-	  *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0';
-	  /* For now, disallow wildcards in the drive spec, to
-	     prevent infinite recursion in glob.  */
-	  if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE)))
-	    return GLOB_NOMATCH;
-	  /* If this is "d:pattern", we need to copy ':' to DIRNAME
-	     as well.  If it's "d:/pattern", don't remove the slash
-	     from "d:/", since "d:" and "d:/" are not the same.*/
-	}
-#endif
       if (glob_use_alloca (alloca_used, dirlen + 1))
 	newp = alloca_account (dirlen + 1, alloca_used);
       else
@@ -598,13 +531,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
       dirname = newp;
       ++filename;
 
-      if (filename[0] == '\0'
-#if defined __MSDOS__ || defined WINDOWS32
-	  && dirname[dirlen - 1] != ':'
-	  && (dirlen < 3 || dirname[dirlen - 2] != ':'
-	      || dirname[dirlen - 1] != '/')
-#endif
-	  && dirlen > 1)
+      if (filename[0] == '\0' && dirlen > 1)
 	/* "pattern/".  Expand "pattern", appending slashes.  */
 	{
 	  int orig_flags = flags;
@@ -648,32 +575,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 	  /* Look up home directory.  */
 	  char *home_dir = getenv ("HOME");
 	  int malloc_home_dir = 0;
-# ifdef _AMIGA
-	  if (home_dir == NULL || home_dir[0] == '\0')
-	    home_dir = "SYS:";
-# else
-#  ifdef WINDOWS32
-	  /* Windows NT defines HOMEDRIVE and HOMEPATH.  But give preference
-	     to HOME, because the user can change HOME.  */
-	  if (home_dir == NULL || home_dir[0] == '\0')
-	    {
-	      const char *home_drive = getenv ("HOMEDRIVE");
-	      const char *home_path = getenv ("HOMEPATH");
-
-	      if (home_drive != NULL && home_path != NULL)
-		{
-		  size_t home_drive_len = strlen (home_drive);
-		  size_t home_path_len = strlen (home_path);
-		  char *mem = alloca (home_drive_len + home_path_len + 1);
-
-		  memcpy (mem, home_drive, home_drive_len);
-		  memcpy (mem + home_drive_len, home_path, home_path_len + 1);
-		  home_dir = mem;
-		}
-	      else
-		home_dir = "c:/users/default"; /* poor default */
-	    }
-#  else
 	  if (home_dir == NULL || home_dir[0] == '\0')
 	    {
 	      int success;
@@ -815,8 +716,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 		  malloc_home_dir = 0;
 		}
 	    }
-#  endif /* WINDOWS32 */
-# endif
 	  /* Now construct the full directory.  */
 	  if (dirname[1] == '\0')
 	    {
@@ -861,7 +760,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 	    }
 	  dirname_modified = 1;
 	}
-# if !defined _AMIGA && !defined WINDOWS32
       else
 	{
 	  char *end_name = strchr (dirname, '/');
@@ -1039,7 +937,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 	      }
 	  }
 	}
-# endif	/* Not Amiga && not WINDOWS32.  */
     }
 
   /* Now test whether we looked for "~" or "~NAME".  In this case we
@@ -1167,20 +1064,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 	{
 	  size_t old_pathc;
 
-#ifdef SHELL
-	  {
-	    /* Make globbing interruptible in the bash shell. */
-	    extern int interrupt_state;
-
-	    if (interrupt_state)
-	      {
-		globfree (&dirs);
-		retval = GLOB_ABORTED;
-		goto out;
-	      }
-	  }
-#endif /* SHELL.  */
-
 	  old_pathc = pglob->gl_pathc;
 	  status = glob_in_dir (filename, dirs.gl_pathv[i],
 				((flags | GLOB_APPEND)
@@ -1387,9 +1270,9 @@ globfree (glob_t *pglob)
       pglob->gl_pathv = NULL;
     }
 }
-#if defined _LIBC && !defined globfree
+# if defined _LIBC && !defined globfree
 libc_hidden_def (globfree)
-#endif
+# endif
 
 
 /* Do a collated comparison of A and B.  */
@@ -1418,31 +1301,12 @@ prefix_array (const char *dirname, char **array, size_t n)
 {
   size_t i;
   size_t dirlen = strlen (dirname);
-#if defined __MSDOS__ || defined WINDOWS32
-  int sep_char = '/';
-# define DIRSEP_CHAR sep_char
-#else
 # define DIRSEP_CHAR '/'
-#endif
 
   if (dirlen == 1 && dirname[0] == '/')
     /* DIRNAME is just "/", so normal prepending would get us "//foo".
        We want "/foo" instead, so don't prepend any chars from DIRNAME.  */
     dirlen = 0;
-#if defined __MSDOS__ || defined WINDOWS32
-  else if (dirlen > 1)
-    {
-      if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
-	/* DIRNAME is "d:/".  Don't prepend the slash from DIRNAME.  */
-	--dirlen;
-      else if (dirname[dirlen - 1] == ':')
-	{
-	  /* DIRNAME is "d:".  Use `:' instead of `/'.  */
-	  --dirlen;
-	  sep_char = ':';
-	}
-    }
-#endif
 
   for (i = 0; i < n; ++i)
     {
@@ -1469,7 +1333,7 @@ prefix_array (const char *dirname, char **array, size_t n)
 
 
 /* We must not compile this function twice.  */
-#ifndef NO_GLOB_PATTERN_P
+# ifndef NO_GLOB_PATTERN_P
 int
 __glob_pattern_type (const char *pattern, int quote)
 {
@@ -1512,10 +1376,10 @@ __glob_pattern_p (const char *pattern, int quote)
 {
   return __glob_pattern_type (pattern, quote) == 1;
 }
-# ifdef _LIBC
+#  ifdef _LIBC
 weak_alias (__glob_pattern_p, glob_pattern_p)
+#  endif
 # endif
-#endif
 
 
 /* We put this in a separate function mainly to allow the memory
@@ -1666,11 +1530,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
 	  int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
 		     ? -1 : dirfd ((DIR *) stream));
 	  int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
-			   | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
-#if defined _AMIGA || defined VMS
-			   | FNM_CASEFOLD
-#endif
-			   );
+			   | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0));
 	  flags |= GLOB_MAGCHAR;
 
 	  while (1)
