summaryrefslogtreecommitdiff
path: root/libc/misc/fnmatch
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/fnmatch')
-rw-r--r--libc/misc/fnmatch/Makefile.in20
-rw-r--r--libc/misc/fnmatch/fnmatch.c62
-rw-r--r--libc/misc/fnmatch/fnmatch_loop.c9
-rw-r--r--libc/misc/fnmatch/fnmatch_old.c7
4 files changed, 23 insertions, 75 deletions
diff --git a/libc/misc/fnmatch/Makefile.in b/libc/misc/fnmatch/Makefile.in
index c31de9cd6..ab43e00f1 100644
--- a/libc/misc/fnmatch/Makefile.in
+++ b/libc/misc/fnmatch/Makefile.in
@@ -1,25 +1,23 @@
# Makefile for uClibc
#
-# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-ifeq ($(UCLIBC_HAS_FNMATCH_OLD),y)
-CSRC := fnmatch_old.c
-else
-CSRC := fnmatch.c
-endif
+subdirs += libc/misc/fnmatch
+
+CSRC-y := $(if $(UCLIBC_HAS_FNMATCH_OLD),fnmatch_old.c,fnmatch.c)
MISC_FNMATCH_DIR := $(top_srcdir)libc/misc/fnmatch
MISC_FNMATCH_OUT := $(top_builddir)libc/misc/fnmatch
-MISC_FNMATCH_SRC := $(patsubst %.c,$(MISC_FNMATCH_DIR)/%.c,$(CSRC))
-MISC_FNMATCH_OBJ := $(patsubst %.c,$(MISC_FNMATCH_OUT)/%.o,$(CSRC))
+MISC_FNMATCH_SRC := $(patsubst %.c,$(MISC_FNMATCH_DIR)/%.c,$(CSRC-y))
+MISC_FNMATCH_OBJ := $(patsubst %.c,$(MISC_FNMATCH_OUT)/%.o,$(CSRC-y))
libc-$(UCLIBC_HAS_FNMATCH) += $(MISC_FNMATCH_OBJ)
-objclean-y += misc_fnmatch_objclean
+objclean-y += CLEAN_libc/misc/fnmatch
-misc_fnmatch_objclean:
- $(RM) $(MISC_FNMATCH_OUT)/*.{o,os}
+CLEAN_libc/misc/fnmatch:
+ $(do_rm) $(addprefix $(MISC_FNMATCH_OUT)/*., o os)
diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c
index 8592d4cf6..d54b6e7c7 100644
--- a/libc/misc/fnmatch/fnmatch.c
+++ b/libc/misc/fnmatch/fnmatch.c
@@ -13,14 +13,15 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+/* unistd.h must be included with _LIBC defined: we need smallint */
+#include <unistd.h>
#include <features.h>
#ifdef __UCLIBC__
# undef _LIBC
@@ -41,7 +42,6 @@
#include <errno.h>
#include <fnmatch.h>
#include <ctype.h>
-#include <unistd.h>
#if HAVE_STRING_H || defined _LIBC
# include <string.h>
@@ -53,51 +53,12 @@
# include <stdlib.h>
#endif
-#ifdef __UCLIBC__
-#define __memset memset
-/* Experimentally off - libc_hidden_proto(memchr) */
-/* Experimentally off - libc_hidden_proto(memset) */
-/* Experimentally off - libc_hidden_proto(mempcpy) */
-/* Experimentally off - libc_hidden_proto(strcat) */
-/* Experimentally off - libc_hidden_proto(strcmp) */
-/*libc_hidden_proto(strchr)*/
-/*libc_hidden_proto(strchrnul)*/
-/* Experimentally off - libc_hidden_proto(strlen) */
-/* Experimentally off - libc_hidden_proto(strcoll) */
-#ifdef __UCLIBC_HAS_XLOCALE__
-libc_hidden_proto(__ctype_b_loc)
-libc_hidden_proto(__ctype_tolower_loc)
-#elif defined __UCLIBC_HAS_CTYPE_TABLES__
-libc_hidden_proto(__ctype_b)
-libc_hidden_proto(__ctype_tolower)
-#endif
-libc_hidden_proto(tolower)
-libc_hidden_proto(fnmatch)
-libc_hidden_proto(getenv)
-#endif
-
/* For platform which support the ISO C amendement 1 functionality we
support user defined character classes. */
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
# include <wchar.h>
# include <wctype.h>
-# ifdef __UCLIBC__
-libc_hidden_proto(wctype)
-libc_hidden_proto(iswctype)
-libc_hidden_proto(btowc)
-# ifdef __UCLIBC_HAS_LOCALE__
-libc_hidden_proto(wmemchr)
-libc_hidden_proto(wmempcpy)
-libc_hidden_proto(wcscat)
-/*libc_hidden_proto(wcschr)*/
-/*libc_hidden_proto(wcschrnul)*/
-libc_hidden_proto(wcslen)
-libc_hidden_proto(wcscoll)
-libc_hidden_proto(towlower)
-libc_hidden_proto(mbsrtowcs)
-# endif
-# endif
#endif
/* We need some of the locale data (the collation sequence information)
@@ -368,13 +329,6 @@ is_char_class (const wchar_t *wcs)
# include "fnmatch_loop.c"
# endif
-#ifdef __UCLIBC_HAS_WCHAR__
-libc_hidden_proto(_stdlib_mb_cur_max)
-#else
-#undef MB_CUR_MAX
-#define MB_CUR_MAX 1
-#endif
-
int
fnmatch (const char *pattern, const char *string, int flags)
{
@@ -388,7 +342,7 @@ fnmatch (const char *pattern, const char *string, int flags)
wchar_t *wstring = NULL;
/* Convert the strings into wide characters. */
- __memset (&ps, '\0', sizeof (ps));
+ memset (&ps, '\0', sizeof (ps));
p = pattern;
#ifdef _LIBC
n = strnlen (pattern, 1024);
@@ -405,7 +359,7 @@ fnmatch (const char *pattern, const char *string, int flags)
already done? */
return -1;
if (p)
- __memset (&ps, '\0', sizeof (ps));
+ memset (&ps, '\0', sizeof (ps));
}
if (__builtin_expect (p != NULL, 0))
{
@@ -437,7 +391,7 @@ fnmatch (const char *pattern, const char *string, int flags)
already done? */
return -1;
if (p)
- __memset (&ps, '\0', sizeof (ps));
+ memset (&ps, '\0', sizeof (ps));
}
if (__builtin_expect (p != NULL, 0))
{
diff --git a/libc/misc/fnmatch/fnmatch_loop.c b/libc/misc/fnmatch/fnmatch_loop.c
index af41727c0..6d037f8f9 100644
--- a/libc/misc/fnmatch/fnmatch_loop.c
+++ b/libc/misc/fnmatch/fnmatch_loop.c
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
@@ -508,7 +507,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
if (symb_table[2 * elem] == hash
&& (c1
== extra[symb_table[2 * elem + 1]])
- && __memcmp (str,
+ && memcmp (str,
&extra[symb_table[2 * elem
+ 1]
+ 1], c1) == 0)
@@ -729,7 +728,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
if (symb_table[2 * elem] == hash
&& (c1
== extra[symb_table[2 * elem + 1]])
- && __memcmp (str,
+ && memcmp (str,
&extra[symb_table[2 * elem + 1]
+ 1], c1) == 0)
{
diff --git a/libc/misc/fnmatch/fnmatch_old.c b/libc/misc/fnmatch/fnmatch_old.c
index 577e35676..8da456333 100644
--- a/libc/misc/fnmatch/fnmatch_old.c
+++ b/libc/misc/fnmatch/fnmatch_old.c
@@ -12,10 +12,9 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
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. */
+not, see <http://www.gnu.org/licenses/>. */
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -23,9 +22,7 @@ Cambridge, MA 02139, USA. */
#include <fnmatch.h>
#include <ctype.h>
-libc_hidden_proto(fnmatch)
-libc_hidden_proto(tolower)
/* 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