summary refs log tree commit diff
path: root/src/expand.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-10-20 18:26:23 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2007-10-20 18:26:23 +0800
commita20ba85f697867e6f1d6f73bba80107af82902a8 (patch)
treed0164853008ad555636eb1ed4633d5be839cd8ff /src/expand.c
parent[SHELL] Replace shared illnum message by badnum function. (diff)
downloaddash-a20ba85f697867e6f1d6f73bba80107af82902a8.tar.gz
dash-a20ba85f697867e6f1d6f73bba80107af82902a8.zip
[EXPAND] Added configure --enable-glob and --enable-fnmatch options
Debian's libc6 as of 2.6.1-6 has working glob(3)/fnmatch(3) support.
This patch adds the options --enable-glob and --enable-fnmatch to
the configure script.  By default glob(3) and fnmatch(3) are still
unused.  However, on distros where the glibc is known to work you
may enable these options.
Diffstat (limited to 'src/expand.c')
-rw-r--r--src/expand.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/expand.c b/src/expand.c
index 5c31400..c489446 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -45,16 +45,9 @@
 #include <stdint.h>
 #include <limits.h>
 #include <string.h>
-#if defined(__GLIBC__)
-#if !defined(FNMATCH_BROKEN)
 #include <fnmatch.h>
-#if !defined(GLOB_BROKEN)
 #include <glob.h>
-#endif
-#else
 #include <ctype.h>
-#endif
-#endif
 
 /*
  * Routines to expand arguments to commands.  We have to deal with
@@ -127,18 +120,16 @@ STATIC void removerecordregions(int);
 STATIC void ifsbreakup(char *, struct arglist *);
 STATIC void ifsfree(void);
 STATIC void expandmeta(struct strlist *, int);
-#if defined(__GLIBC__) && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN)
+#ifdef HAVE_GLOB
 STATIC void addglob(const glob_t *);
 #else
 STATIC void expmeta(char *, char *);
-#endif
-STATIC void addfname(char *);
-#if !(defined(__GLIBC__) && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN))
 STATIC struct strlist *expsort(struct strlist *);
 STATIC struct strlist *msort(struct strlist *, int);
 #endif
+STATIC void addfname(char *);
 STATIC int patmatch(char *, const char *);
-#if !defined(__GLIBC__) || defined(FNMATCH_BROKEN)
+#ifndef HAVE_FNMATCH
 STATIC int pmatch(const char *, const char *);
 #else
 #define pmatch(a, b) !fnmatch((a), (b), 0)
@@ -1159,7 +1150,7 @@ ifsfree(void)
  * should be escapes.  The results are stored in the list exparg.
  */
 
-#if defined(__GLIBC__) && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN)
+#ifdef HAVE_GLOB
 STATIC void
 expandmeta(str, flag)
 	struct strlist *str;
@@ -1220,7 +1211,7 @@ addglob(pglob)
 }
 
 
-#else	/* defined(__GLIBC__) && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN) */
+#else	/* HAVE_GLOB */
 STATIC char *expdir;
 
 
@@ -1387,7 +1378,7 @@ out:
 	if (! atend)
 		endname[-1] = '/';
 }
-#endif	/* defined(__GLIBC__) && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN) */
+#endif	/* HAVE_GLOB */
 
 
 /*
@@ -1406,7 +1397,7 @@ addfname(char *name)
 }
 
 
-#if !(defined(__GLIBC__) && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN))
+#ifndef HAVE_GLOB
 /*
  * Sort the results of file name expansion.  It calculates the number of
  * strings to sort and then calls msort (short for merge sort) to do the
@@ -1479,7 +1470,7 @@ patmatch(char *pattern, const char *string)
 }
 
 
-#if !defined(__GLIBC__) || defined(FNMATCH_BROKEN)
+#ifndef HAVE_FNMATCH
 STATIC int ccmatch(const char *p, int chr, const char **r)
 {
 	static const struct class {