X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffnmatch.c;h=2fb65b521604bf4306e494cdcfd1d31755bbc941;hb=d49260b109750904af0f17a1b44530a56eeed71d;hp=be662d9d25f5f527fae84263ac081a47ad8d9dd3;hpb=07fc05974df6ec335447f994e9b1df774ab364c3;p=gnulib.git diff --git a/lib/fnmatch.c b/lib/fnmatch.c index be662d9d2..2fb65b521 100644 --- a/lib/fnmatch.c +++ b/lib/fnmatch.c @@ -15,10 +15,26 @@ License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include + +/* 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 + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + #if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS) extern int errno; #endif @@ -77,7 +93,8 @@ fnmatch (pattern, string, flags) return 0; { - char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? FOLD (*p) : c; + char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + c1 = FOLD (c1); for (--p; *n != '\0'; ++n) if ((c == '[' || FOLD (*n) == c1) && fnmatch (p, n, flags & ~FNM_PERIOD) == 0) @@ -179,3 +196,5 @@ fnmatch (pattern, string, flags) return FNM_NOMATCH; } + +#endif /* _LIBC or not __GNU_LIBRARY__. */