summaryrefslogtreecommitdiffstats
path: root/libc/misc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/Makefile73
-rw-r--r--libc/misc/assert/Makefile46
-rw-r--r--libc/misc/ctype/Makefile71
-rw-r--r--libc/misc/dirent/Makefile48
-rw-r--r--libc/misc/dirent/alphasort.c2
-rw-r--r--libc/misc/dirent/alphasort64.c2
-rw-r--r--libc/misc/dirent/closedir.c2
-rw-r--r--libc/misc/dirent/opendir.c6
-rw-r--r--libc/misc/dirent/readdir64_r.c2
-rw-r--r--libc/misc/dirent/readdir_r.c2
-rw-r--r--libc/misc/dirent/scandir.c2
-rw-r--r--libc/misc/dirent/scandir64.c2
-rw-r--r--libc/misc/error/Makefile41
-rw-r--r--libc/misc/error/error.c4
-rw-r--r--libc/misc/file/Makefile50
-rw-r--r--libc/misc/file/lockf.c2
-rw-r--r--libc/misc/file/lockf64.c2
-rw-r--r--libc/misc/fnmatch/Makefile46
-rw-r--r--libc/misc/ftw/Makefile45
-rw-r--r--libc/misc/ftw/ftw.c16
-rw-r--r--libc/misc/glob/Makefile48
-rw-r--r--libc/misc/glob/glob.c29
-rw-r--r--libc/misc/gnu/Makefile46
-rw-r--r--libc/misc/internals/Makefile61
-rw-r--r--libc/misc/internals/Makefile.in10
-rw-r--r--libc/misc/internals/tempname.c26
-rw-r--r--libc/misc/internals/tempname.h4
-rw-r--r--libc/misc/intl/Makefile52
-rw-r--r--libc/misc/intl/intl.c4
-rw-r--r--libc/misc/locale/Makefile74
-rw-r--r--libc/misc/locale/Makefile.in17
-rw-r--r--libc/misc/locale/locale.c58
-rw-r--r--libc/misc/mntent/Makefile46
-rw-r--r--libc/misc/mntent/mntent.c3
-rw-r--r--libc/misc/pthread/Makefile41
-rw-r--r--libc/misc/regex/regex.c9
-rw-r--r--libc/misc/regex/regex_old.c3
-rw-r--r--libc/misc/search/Makefile75
-rw-r--r--libc/misc/search/hsearch_r.c6
-rw-r--r--libc/misc/search/lsearch.c2
-rw-r--r--libc/misc/search/tsearch.c3
-rw-r--r--libc/misc/statfs/Makefile48
-rw-r--r--libc/misc/statfs/fstatfs64.c2
-rw-r--r--libc/misc/statfs/fstatvfs.c2
-rw-r--r--libc/misc/statfs/fstatvfs64.c2
-rw-r--r--libc/misc/statfs/internal_statvfs.c18
-rw-r--r--libc/misc/statfs/statfs64.c2
-rw-r--r--libc/misc/statfs/statvfs.c2
-rw-r--r--libc/misc/statfs/statvfs64.c2
-rw-r--r--libc/misc/syslog/Makefile50
-rw-r--r--libc/misc/syslog/syslog.c30
-rw-r--r--libc/misc/sysvipc/Makefile81
-rw-r--r--libc/misc/sysvipc/shm.c3
-rw-r--r--libc/misc/time/Makefile76
-rw-r--r--libc/misc/time/time.c80
-rw-r--r--libc/misc/ttyent/Makefile41
-rw-r--r--libc/misc/ttyent/getttyent.c14
-rw-r--r--libc/misc/utmp/Makefile46
-rw-r--r--libc/misc/utmp/utent.c22
-rw-r--r--libc/misc/utmp/wtent.c14
-rw-r--r--libc/misc/wchar/wchar.c6
-rw-r--r--libc/misc/wctype/wctype.c4
-rw-r--r--libc/misc/wordexp/Makefile41
-rw-r--r--libc/misc/wordexp/wordexp.c81
64 files changed, 450 insertions, 1298 deletions
diff --git a/libc/misc/Makefile b/libc/misc/Makefile
index 9d2d74a2b..11f362a5e 100644
--- a/libc/misc/Makefile
+++ b/libc/misc/Makefile
@@ -1,70 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../
-include $(TOPDIR)Rules.mak
-
-
-DIRS = assert ctype dirent file fnmatch internals \
- mntent syslog time utmp sysvipc statfs \
- error ttyent gnu search locale
-ifeq ($(strip $(UCLIBC_HAS_REGEX)),y)
-DIRS += regex
-endif
-ifeq ($(strip $(UCLIBC_HAS_WORDEXP)),y)
-DIRS += wordexp
-endif
-ifeq ($(strip $(UCLIBC_HAS_THREADS)),y)
-DIRS += pthread
-endif
-ifeq ($(strip $(UCLIBC_HAS_WCHAR)),y)
-DIRS += wctype wchar
-endif
-ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
-DIRS += intl
-endif
-ifeq ($(strip $(UCLIBC_HAS_FTW)),y)
-DIRS += ftw
-endif
-ifeq ($(strip $(UCLIBC_HAS_GLOB)),y)
-DIRS += glob
-endif
-
-all: subdirs
-
-tags:
- ctags -R
-
-clean: subdirs_clean
- $(RM) *.[oa] *~ core
-
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
-
-$(patsubst %, _dir_%, $(DIRS)) : dummy
- $(MAKE) -C $(patsubst _dir_%, %, $@)
-
-$(patsubst %, _dirclean_%, $(DIRS)) : dummy
- $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-.PHONY: dummy
+top_srcdir=../../
+top_builddir=../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/assert/Makefile b/libc/misc/assert/Makefile
index 57a2c0154..4a8f4a072 100644
--- a/libc/misc/assert/Makefile
+++ b/libc/misc/assert/Makefile
@@ -1,43 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=__assert.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.assert
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/assert/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/ctype/Makefile b/libc/misc/ctype/Makefile
index dd7b799bd..4a8f4a072 100644
--- a/libc/misc/ctype/Makefile
+++ b/libc/misc/ctype/Makefile
@@ -1,68 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-MSRC=ctype.c
-MOBJ= isalnum.o isalpha.o isascii.o iscntrl.o isdigit.o \
- isgraph.o islower.o isprint.o ispunct.o isspace.o \
- isupper.o isxdigit.o toascii.o tolower.o toupper.o \
- isblank.o isxlower.o isxupper.o
-
-ifeq ($(UCLIBC_HAS_CTYPE_TABLES),y)
-MOBJ += __C_ctype_b.o __C_ctype_tolower.o __C_ctype_toupper.o \
- __ctype_b_loc.o __ctype_tolower_loc.o __ctype_toupper_loc.o \
- __ctype_assert.o isctype.o
-endif
-
-MOBJx= isalnum_l.o isalpha_l.o isascii_l.o iscntrl_l.o isdigit_l.o \
- isgraph_l.o islower_l.o isprint_l.o ispunct_l.o isspace_l.o \
- isupper_l.o isxdigit_l.o toascii_l.o tolower_l.o toupper_l.o \
- isblank_l.o # isxlower_l.o isxupper_l.o
-
-OBJS=$(MOBJ)
-
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
- OBJS += $(MOBJx)
-endif
-
-OBJ_LIST=../../obj.misc.ctype
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/ctype/%, $(OBJS)) > $(OBJ_LIST)
-
-$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(MOBJx): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* -D__UCLIBC_DO_XLOCALE $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(OBJS): Makefile
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/dirent/Makefile b/libc/misc/dirent/Makefile
index 1f1032642..4a8f4a072 100644
--- a/libc/misc/dirent/Makefile
+++ b/libc/misc/dirent/Makefile
@@ -1,45 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2001 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=alphasort.c closedir.c dirfd.c opendir.c readdir.c rewinddir.c scandir.c \
- seekdir.c telldir.c readdir64.c alphasort64.c scandir64.c readdir_r.c \
- readdir64_r.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.dirent
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/dirent/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/dirent/alphasort.c b/libc/misc/dirent/alphasort.c
index dcf970070..feae021e6 100644
--- a/libc/misc/dirent/alphasort.c
+++ b/libc/misc/dirent/alphasort.c
@@ -4,7 +4,7 @@
int alphasort(const void * a, const void * b)
{
- return strcmp ((*(const struct dirent **) a)->d_name,
+ return __strcmp ((*(const struct dirent **) a)->d_name,
(*(const struct dirent **) b)->d_name);
}
diff --git a/libc/misc/dirent/alphasort64.c b/libc/misc/dirent/alphasort64.c
index bcae8108f..5801f4940 100644
--- a/libc/misc/dirent/alphasort64.c
+++ b/libc/misc/dirent/alphasort64.c
@@ -19,7 +19,7 @@
int alphasort64(const void * a, const void * b)
{
- return strcmp ((*(const struct dirent64 **) a)->d_name,
+ return __strcmp ((*(const struct dirent64 **) a)->d_name,
(*(const struct dirent64 **) b)->d_name);
}
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c
index 068e2d3e2..57600ab69 100644
--- a/libc/misc/dirent/closedir.c
+++ b/libc/misc/dirent/closedir.c
@@ -29,5 +29,5 @@ int closedir(DIR * dir)
#endif
free(dir->dd_buf);
free(dir);
- return close(fd);
+ return __close(fd);
}
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index 017684b40..9f5f75e3f 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -24,7 +24,7 @@ DIR *opendir(const char *name)
__set_errno(ENOTDIR);
return NULL;
}
- if ((fd = open(name, O_RDONLY)) < 0)
+ if ((fd = __open(name, O_RDONLY)) < 0)
return NULL;
/* According to POSIX, directory streams should be closed when
* exec. From "Anna Pluzhnikov" <besp@midway.uchicago.edu>.
@@ -32,7 +32,7 @@ DIR *opendir(const char *name)
if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
return NULL;
if (!(ptr = malloc(sizeof(*ptr)))) {
- close(fd);
+ __close(fd);
__set_errno(ENOMEM);
return NULL;
}
@@ -45,7 +45,7 @@ DIR *opendir(const char *name)
ptr->dd_max = 512;
if (!(buf = calloc(1, ptr->dd_max))) {
- close(fd);
+ __close(fd);
free(ptr);
__set_errno(ENOMEM);
return NULL;
diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c
index da3564edb..1daae5116 100644
--- a/libc/misc/dirent/readdir64_r.c
+++ b/libc/misc/dirent/readdir64_r.c
@@ -62,7 +62,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
if (de == NULL) {
*result = NULL;
} else {
- *result = memcpy (entry, de, de->d_reclen);
+ *result = __memcpy (entry, de, de->d_reclen);
}
ret = 0;
diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c
index 245dcbdde..1c8eeadce 100644
--- a/libc/misc/dirent/readdir_r.c
+++ b/libc/misc/dirent/readdir_r.c
@@ -48,7 +48,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
if (de == NULL) {
*result = NULL;
} else {
- *result = memcpy (entry, de, de->d_reclen);
+ *result = __memcpy (entry, de, de->d_reclen);
}
ret = 0;
diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c
index cb3d505db..8b08e4884 100644
--- a/libc/misc/dirent/scandir.c
+++ b/libc/misc/dirent/scandir.c
@@ -72,7 +72,7 @@ int scandir(const char *dir, struct dirent ***namelist,
if (vnew == NULL)
break;
- names[pos++] = (struct dirent *) memcpy (vnew, current, dsize);
+ names[pos++] = (struct dirent *) __memcpy (vnew, current, dsize);
}
if (unlikely(errno != 0))
diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c
index b4cc57a36..2916285eb 100644
--- a/libc/misc/dirent/scandir64.c
+++ b/libc/misc/dirent/scandir64.c
@@ -87,7 +87,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist,
if (vnew == NULL)
break;
- names[pos++] = (struct dirent64 *) memcpy (vnew, current, dsize);
+ names[pos++] = (struct dirent64 *) __memcpy (vnew, current, dsize);
}
if (unlikely(errno != 0))
diff --git a/libc/misc/error/Makefile b/libc/misc/error/Makefile
index 1ef71dfa7..4a8f4a072 100644
--- a/libc/misc/error/Makefile
+++ b/libc/misc/error/Makefile
@@ -1,38 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=error.c err.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.error
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/error/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c
index eddf24587..0a19e3923 100644
--- a/libc/misc/error/error.c
+++ b/libc/misc/error/error.c
@@ -22,6 +22,8 @@
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
/* Adjusted slightly by Erik Andersen <andersen@uclibc.org> */
+#define strerror __strerror
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -68,7 +70,7 @@ void __error_at_line (int status, int errnum, const char *file_name,
static unsigned int old_line_number;
if (old_line_number == line_number &&
- (file_name == old_file_name || !strcmp (old_file_name, file_name)))
+ (file_name == old_file_name || !__strcmp (old_file_name, file_name)))
/* Simply return and print nothing. */
return;
diff --git a/libc/misc/file/Makefile b/libc/misc/file/Makefile
index a590f6ab5..4a8f4a072 100644
--- a/libc/misc/file/Makefile
+++ b/libc/misc/file/Makefile
@@ -1,47 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-ifeq ($(strip $(UCLIBC_HAS_LFS)),y)
-CSRC = lockf.c lockf64.c
-else
-CSRC = lockf.c
-endif
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.file
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/file/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/file/lockf.c b/libc/misc/file/lockf.c
index f95b24fac..0962031da 100644
--- a/libc/misc/file/lockf.c
+++ b/libc/misc/file/lockf.c
@@ -28,7 +28,7 @@ int lockf (int fd, int cmd, off_t len)
{
struct flock fl;
- memset ((char *) &fl, '\0', sizeof (fl));
+ __memset ((char *) &fl, '\0', sizeof (fl));
/* lockf is always relative to the current file position. */
fl.l_whence = SEEK_CUR;
diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c
index 5638d6938..eb70e8ddd 100644
--- a/libc/misc/file/lockf64.c
+++ b/libc/misc/file/lockf64.c
@@ -62,7 +62,7 @@ int lockf64 (int fd, int cmd, off64_t len64)
return -1;
}
- memset((char *) &fl, '\0', sizeof (fl));
+ __memset((char *) &fl, '\0', sizeof (fl));
/* lockf is always relative to the current file position. */
fl.l_whence = SEEK_CUR;
diff --git a/libc/misc/fnmatch/Makefile b/libc/misc/fnmatch/Makefile
index 535169550..4a8f4a072 100644
--- a/libc/misc/fnmatch/Makefile
+++ b/libc/misc/fnmatch/Makefile
@@ -1,43 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=fnmatch.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.fnmatch
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/fnmatch/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/ftw/Makefile b/libc/misc/ftw/Makefile
index a8d52bf32..4a8f4a072 100644
--- a/libc/misc/ftw/Makefile
+++ b/libc/misc/ftw/Makefile
@@ -1,42 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=ftw.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-MSRC=ftw.c
-MOBJ=ftw.o ftw64.o
-OBJS=$(MOBJ)
-
-OBJ_LIST=../../obj.misc.ftw
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/ftw/%, $(OBJS)) > $(OBJ_LIST)
-
-$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c
index e58c3e6ca..c36ae45b6 100644
--- a/libc/misc/ftw/ftw.c
+++ b/libc/misc/ftw/ftw.c
@@ -18,6 +18,12 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+/* used by D_EXACT_NAMLEN */
+#define strlen __strlen
+
+#define mempcpy __mempcpy
+#define tsearch __tsearch
+
#define _GNU_SOURCE
#include <features.h>
@@ -421,7 +427,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st)
/* Next, update the `struct FTW' information. */
++data->ftw.level;
- startp = strchr (data->dirbuf, '\0');
+ startp = __strchr (data->dirbuf, '\0');
/* There always must be a directory name. */
assert (startp != data->dirbuf);
if (startp[-1] != '/')
@@ -457,7 +463,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st)
while (result == 0 && *runp != '\0')
{
- char *endp = strchr (runp, '\0');
+ char *endp = __strchr (runp, '\0');
result = process_entry (data, &dir, runp, endp - runp);
@@ -498,7 +504,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flag
__set_errno (ENOENT);
return -1;
}
- if ((strlen(dir)+1) > NAME_MAX) {
+ if ((__strlen(dir)+1) > NAME_MAX) {
__set_errno(ENAMETOOLONG);
return -1;
}
@@ -507,10 +513,10 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flag
data.actdir = 0;
data.dirstreams = (struct dir_data **) alloca (data.maxdir
* sizeof (struct dir_data *));
- memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *));
+ __memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *));
/* PATH_MAX is always defined when we get here. */
- data.dirbufsize = MAX (2 * strlen (dir), PATH_MAX);
+ data.dirbufsize = MAX (2 * __strlen (dir), PATH_MAX);
data.dirbuf = (char *) malloc (data.dirbufsize);
if (data.dirbuf == NULL)
return -1;
diff --git a/libc/misc/glob/Makefile b/libc/misc/glob/Makefile
index e753c936a..4a8f4a072 100644
--- a/libc/misc/glob/Makefile
+++ b/libc/misc/glob/Makefile
@@ -1,45 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=glob.c glob64.c glob-hooks.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.glob
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/glob/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-glob64.o: glob64.c glob.c
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c
index 0d788df53..22f1874ab 100644
--- a/libc/misc/glob/glob.c
+++ b/libc/misc/glob/glob.c
@@ -15,6 +15,9 @@ 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. */
+#define strrchr __strrchr
+#define strcoll __strcoll
+
#include <features.h>
#include <stdlib.h>
#include <string.h>
@@ -124,7 +127,7 @@ glob (pattern, flags, errfunc, pglob)
{
dirlen = filename - pattern;
dirname = (char *) alloca (dirlen + 1);
- memcpy (dirname, pattern, dirlen);
+ __memcpy (dirname, pattern, dirlen);
dirname[dirlen] = '\0';
++filename;
}
@@ -216,11 +219,11 @@ glob (pattern, flags, errfunc, pglob)
/* No matches. */
if (flags & GLOB_NOCHECK)
{
- size_t len = strlen (pattern) + 1;
+ size_t len = __strlen (pattern) + 1;
char *patcopy = (char *) malloc (len);
if (patcopy == NULL)
return GLOB_NOSPACE;
- memcpy (patcopy, pattern, len);
+ __memcpy (patcopy, pattern, len);
pglob->gl_pathv
= (char **) realloc (pglob->gl_pathv,
@@ -278,7 +281,7 @@ glob (pattern, flags, errfunc, pglob)
for (i = oldcount; i < pglob->gl_pathc; ++i)
if (lstat (pglob->gl_pathv[i], &st) == 0 &&
S_ISDIR (st.st_mode))
- strcat (pglob->gl_pathv[i], "/");
+ __strcat (pglob->gl_pathv[i], "/");
}
if (!(flags & GLOB_NOSORT))
@@ -340,7 +343,7 @@ prefix_array (dirname, array, n, add_slash)
int add_slash;
{
register size_t i;
- size_t dirlen = strlen (dirname);
+ size_t dirlen = __strlen (dirname);
if (dirlen == 1 && dirname[0] == '/')
/* DIRNAME is just "/", so normal prepending would get us "//foo".
@@ -349,7 +352,7 @@ prefix_array (dirname, array, n, add_slash)
for (i = 0; i < n; ++i)
{
- size_t eltlen = strlen (array[i]) + 1;
+ size_t eltlen = __strlen (array[i]) + 1;
char *new = (char *) malloc (dirlen + 1 + eltlen + (add_slash ? 1 : 0));
if (new == NULL)
{
@@ -358,9 +361,9 @@ prefix_array (dirname, array, n, add_slash)
return 1;
}
- memcpy (new, dirname, dirlen);
+ __memcpy (new, dirname, dirlen);
new[dirlen] = '/';
- memcpy (&new[dirlen + 1], array[i], eltlen);
+ __memcpy (&new[dirlen + 1], array[i], eltlen);
free ((__ptr_t) array[i]);
array[i] = new;
}
@@ -433,7 +436,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
#endif
}
- if ((!meta && strcmp (pattern, name) == 0)
+ if ((!meta && __strcmp (pattern, name) == 0)
|| fnmatch (pattern, name,
(!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)) == 0)
@@ -441,12 +444,12 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
struct globlink *new
= (struct globlink *) alloca (sizeof (struct globlink));
if (len == 0)
- len = strlen (name);
+ len = __strlen (name);
new->name
= (char *) malloc (len + ((flags & GLOB_MARK) ? 1 : 0) + 1);
if (new->name == NULL)
goto memory_error;
- memcpy ((__ptr_t) new->name, name, len);
+ __memcpy ((__ptr_t) new->name, name, len);
new->name[len] = '\0';
new->next = names;
names = new;
@@ -458,14 +461,14 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
if (nfound == 0 && (flags & GLOB_NOCHECK))
{
- size_t len = strlen (pattern);
+ size_t len = __strlen (pattern);
nfound = 1;
names = (struct globlink *) alloca (sizeof (struct globlink));
names->next = NULL;
names->name = (char *) malloc (len + (flags & GLOB_MARK ? 1 : 0) + 1);
if (names->name == NULL)
goto memory_error;
- memcpy (names->name, pattern, len);
+ __memcpy (names->name, pattern, len);
names->name[len] = '\0';
}
diff --git a/libc/misc/gnu/Makefile b/libc/misc/gnu/Makefile
index a338b8131..4a8f4a072 100644
--- a/libc/misc/gnu/Makefile
+++ b/libc/misc/gnu/Makefile
@@ -1,43 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=obstack.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.gnu
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/gnu/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/internals/Makefile b/libc/misc/internals/Makefile
index 1df05a934..4a8f4a072 100644
--- a/libc/misc/internals/Makefile
+++ b/libc/misc/internals/Makefile
@@ -1,58 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=__uClibc_main.c tempname.c errno.c __errno_location.c __h_errno_location.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-
-__uClibc_main.o: CFLAGS += $(SSP_DISABLE_FLAGS)
-
-OBJS=$(COBJS)
-
-ifeq ($(UCLIBC_HAS_THREADS),y)
-CFLAGS += $(PTINC)
-endif
-
-OBJ_LIST=../../obj.misc.internals
-
-all: $(OBJ_LIST) interp.o static.o
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/internals/%, $(OBJS)) > $(OBJ_LIST)
-
-interp.c: Makefile
- echo "/* Force shared libraries to know about the correct library loader */" > interp.c
- echo "#include <features.h>" >> interp.c
- echo "#ifdef __HAVE_ELF__" >> interp.c
- echo "const char __dl_ldso__[] __attribute__ ((section " \
- "(\".interp\"))) =\""$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)"\";" >> interp.c
- echo "#endif" >> interp.c
-
-$(COBJS) interp.o static.o: %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] interp.c *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/internals/Makefile.in b/libc/misc/internals/Makefile.in
index 8863aba7b..4c7012d9a 100644
--- a/libc/misc/internals/Makefile.in
+++ b/libc/misc/internals/Makefile.in
@@ -16,14 +16,6 @@ MISC_INTERNALS_OUT:=$(top_builddir)libc/misc/internals
MISC_INTERNALS_SRC:=$(patsubst %.c,$(MISC_INTERNALS_DIR)/%.c,$(CSRC))
MISC_INTERNALS_OBJ:=$(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC))
-$(MISC_INTERNALS_OUT)/interp.c: $(top_builddir)include/headers_done
- $(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@
- $(Q)echo "#include <features.h>" >> $@
- $(Q)echo "#ifdef __HAVE_ELF__" >> $@
- $(Q)echo "const char __dl_ldso__[] __attribute__ ((section " \
- "(\".interp\"))) =\""$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)"\";" >> $@
- $(Q)echo "#endif" >> $@
-
libc-a-y+=$(MISC_INTERNALS_OBJ)
libc-so-y+=$(MISC_INTERNALS_OBJ:.o=.os)
libc-shared-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.oS
@@ -34,4 +26,4 @@ libc-multi-y+=$(MISC_INTERNALS_SRC)
objclean-y+=misc_internals_objclean
misc_internals_objclean:
- $(RM) $(MISC_INTERNALS_OUT)/{*.{o,os,oS},interp.c}
+ $(RM) $(MISC_INTERNALS_OUT)/*.{o,os,oS}
diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c
index cd1f3497b..360c76879 100644
--- a/libc/misc/internals/tempname.c
+++ b/libc/misc/internals/tempname.c
@@ -31,6 +31,8 @@
* Use brain damaged getpid() if real random fails.
*/
+#define open64 __open64
+
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
@@ -59,7 +61,7 @@ static int direxists (const char *dir)
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
doesn't exist, none of the searched dirs exists, or there's not
enough space in TMPL. */
-int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
+int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir,
const char *pfx, int try_tmpdir)
{
//const char *d;
@@ -72,7 +74,7 @@ int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
}
else
{
- plen = strlen (pfx);
+ plen = __strlen (pfx);
if (plen > 5)
plen = 5;
}
@@ -94,7 +96,7 @@ int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
{
if (direxists (P_tmpdir))
dir = P_tmpdir;
- else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
+ else if (__strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
dir = "/tmp";
else
{
@@ -103,7 +105,7 @@ int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
}
}
- dlen = strlen (dir);
+ dlen = __strlen (dir);
while (dlen > 1 && dir[dlen - 1] == '/')
dlen--; /* remove trailing slashes */
@@ -126,13 +128,13 @@ static unsigned int fillrand(unsigned char *buf, unsigned int len)
{
int fd;
unsigned int result = -1;
- fd = open("/dev/urandom", O_RDONLY);
+ fd = __open("/dev/urandom", O_RDONLY);
if (fd < 0) {
- fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
+ fd = __open("/dev/random", O_RDONLY | O_NONBLOCK);
}
if (fd >= 0) {
- result = read(fd, buf, len);
- close(fd);
+ result = __read(fd, buf, len);
+ __close(fd);
}
return result;
}
@@ -175,15 +177,15 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len)
__GT_DIR: create a directory, which will be mode 0700.
*/
-int __gen_tempname (char *tmpl, int kind)
+int attribute_hidden __gen_tempname (char *tmpl, int kind)
{
char *XXXXXX;
unsigned int k;
int len, i, count, fd, save_errno = errno;
unsigned char randomness[6];
- len = strlen (tmpl);
- if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
+ len = __strlen (tmpl);
+ if (len < 6 || __strcmp (&tmpl[len - 6], "XXXXXX"))
{
__set_errno (EINVAL);
return -1;
@@ -223,7 +225,7 @@ int __gen_tempname (char *tmpl, int kind)
continue;
}
case __GT_FILE:
- fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+ fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
break;
#if defined __UCLIBC_HAS_LFS__
case __GT_BIGFILE:
diff --git a/libc/misc/internals/tempname.h b/libc/misc/internals/tempname.h
index f068727a7..dfe9399ca 100644
--- a/libc/misc/internals/tempname.h
+++ b/libc/misc/internals/tempname.h
@@ -4,8 +4,8 @@
#define __need_size_t
#include <stddef.h>
extern int __path_search (char *tmpl, size_t tmpl_len, const char *dir,
- const char *pfx, int try_tmpdir);
-extern int __gen_tempname (char *__tmpl, int __kind);
+ const char *pfx, int try_tmpdir) attribute_hidden;
+extern int __gen_tempname (char *__tmpl, int __kind) attribute_hidden;
/* The __kind argument to __gen_tempname may be one of: */
#define __GT_FILE 0 /* create a file */
diff --git a/libc/misc/intl/Makefile b/libc/misc/intl/Makefile
index e0eb06493..4a8f4a072 100644
--- a/libc/misc/intl/Makefile
+++ b/libc/misc/intl/Makefile
@@ -1,49 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-MSRC= intl.c
-MOBJ= __uClibc_dgettext.o __uClibc_dcgettext.o \
- __uClibc_textdomain.o __uClibc_bindtextdomain.o # for libstd++
-
-OBJS=$(MOBJ)
-
-OBJ_LIST=../../obj.misc.intl
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/intl/%, $(OBJS)) > $(OBJ_LIST)
-
-$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/intl/intl.c b/libc/misc/intl/intl.c
index f3255828c..e882f441c 100644
--- a/libc/misc/intl/intl.c
+++ b/libc/misc/intl/intl.c
@@ -60,7 +60,7 @@ char *__uClibc_textdomain(const char *domainname)
{
static const char default_str[] = "messages";
- if (domainname && *domainname && strcmp(domainname, default_str)) {
+ if (domainname && *domainname && __strcmp(domainname, default_str)) {
__set_errno(EINVAL);
return NULL;
}
@@ -82,7 +82,7 @@ char *__uClibc_bindtextdomain(const char *domainname, const char *dirname)
#if 1
&& ((dirname[0] != '/') || dirname[1])
#else
- && strcmp(dirname, dir)
+ && __strcmp(dirname, dir)
#endif
)
) {
diff --git a/libc/misc/locale/Makefile b/libc/misc/locale/Makefile
index 5ab005538..4a8f4a072 100644
--- a/libc/misc/locale/Makefile
+++ b/libc/misc/locale/Makefile
@@ -1,71 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000-2002 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-MSRC= locale.c
-MOBJ= setlocale.o localeconv.o _locale_init.o nl_langinfo.o
-MOBJx=
-
-ifeq ($(UCLIBC_HAS_LOCALE),y)
- MOBJ += newlocale.o __locale_mbrtowc_l.o
-endif
-
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
- MOBJx += nl_langinfo_l.o duplocale.o freelocale.o uselocale.o __curlocale.o
-endif
-
-DATA=
-ifeq ($(UCLIBC_HAS_LOCALE),y)
- DATA = locale_data.o
-endif
-
-OBJS= $(MOBJ) $(MOBJx) $(DATA)
-
-OBJ_LIST=../../obj.misc.locale
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/locale/%, $(OBJS)) > $(OBJ_LIST)
-
-$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(MOBJx): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* -D__UCLIBC_DO_XLOCALE $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-locale_data.o:
- $(LN) -sf ../../../extra/locale/locale_data.c
- $(CC) $(CFLAGS) -c -D__WCHAR_ENABLED -I../../../extra/locale locale_data.c -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(OBJS): Makefile
-
-clean:
- $(RM) *.[oa] *~ core locale_data.c
-.PHONY: data
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/locale/Makefile.in b/libc/misc/locale/Makefile.in
index 9d0074521..f4439cdf5 100644
--- a/libc/misc/locale/Makefile.in
+++ b/libc/misc/locale/Makefile.in
@@ -18,11 +18,6 @@ ifeq ($(UCLIBC_HAS_XLOCALE),y)
MOBJx:=nl_langinfo_l.o duplocale.o freelocale.o uselocale.o __curlocale.o
endif
-DATA:=
-ifeq ($(UCLIBC_HAS_LOCALE),y)
-DATA:=locale_data.o
-endif
-
MISC_LOCALE_NO_MULTI=localeconv.o
MISC_LOCALE_DIR:=$(top_srcdir)libc/misc/locale
@@ -31,7 +26,6 @@ MISC_LOCALE_OUT:=$(top_builddir)libc/misc/locale
MISC_LOCALE_MSRC:=$(MISC_LOCALE_DIR)/$(MSRC)
MISC_LOCALE_MOBJ:=$(patsubst %.o,$(MISC_LOCALE_OUT)/%.o,$(MOBJ))
MISC_LOCALE_MOBJx:=$(patsubst %.o,$(MISC_LOCALE_OUT)/%.o,$(MOBJx))
-MISC_LOCALE_DATA:=$(patsubst %.o,$(MISC_LOCALE_OUT)/%.o,$(DATA))
MISC_LOCALE_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(filter-out $(MISC_LOCALE_NO_MULTI),$(notdir $(MISC_LOCALE_MOBJ)))))
@@ -47,26 +41,17 @@ $(MISC_LOCALE_MOBJx): $(MISC_LOCALE_MSRC)
$(MISC_LOCALE_MOBJx:.o=.os): $(MISC_LOCALE_MSRC)
$(compile.m) -D__UCLIBC_DO_XLOCALE
-$(MISC_LOCALE_DATA): $(top_builddir)extra/locale/$(notdir $(MISC_LOCALE_DATA:.o=.c))
- $(compile.c) -D__WCHAR_ENABLED -I$(dir $<)
-
-$(MISC_LOCALE_DATA:.o=.os): $(top_builddir)extra/locale/$(notdir $(MISC_LOCALE_DATA:.o=.c))
- $(compile.c) -D__WCHAR_ENABLED -I$(dir $<)
-
libc-a-y+=$(MISC_LOCALE_MOBJ)
-libc-a-$(UCLIBC_HAS_LOCALE)+=$(MISC_LOCALE_DATA)
libc-a-$(UCLIBC_HAS_XLOCALE)+=$(MISC_LOCALE_MOBJx)
libc-so-y+=$(MISC_LOCALE_MOBJ:.o=.os)
-libc-so-$(UCLIBC_HAS_LOCALE)+=$(MISC_LOCALE_DATA:.o=.os)
libc-so-$(UCLIBC_HAS_XLOCALE)+=$(MISC_LOCALE_MOBJx:.o=.os)
CFLAGS-multi-y+=$(MISC_LOCALE_DEF)
libc-multi-y+=$(MISC_LOCALE_MSRC)
libc-nomulti-y+=$(patsubst %.o,$(MISC_LOCALE_OUT)/%.o,$(MISC_LOCALE_NO_MULTI))
-libc-nomulti-$(UCLIBC_HAS_LOCALE)+=$(MISC_LOCALE_DATA)
libc-nomulti-$(UCLIBC_HAS_XLOCALE)+=$(MISC_LOCALE_MOBJx)
objclean-y+=misc_locale_objclean
misc_locale_objclean:
- $(RM) $(MISC_LOCALE_OUT)/{*.{o,os},locale_data.c}
+ $(RM) $(MISC_LOCALE_OUT)/{*.{o,os}}
diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c
index 6e5830733..77d3f1e5d 100644
--- a/libc/misc/locale/locale.c
+++ b/libc/misc/locale/locale.c
@@ -46,6 +46,8 @@
* locale support had (8-bit codesets only).
*/
+#define strtok_r __strtok_r
+
#define _GNU_SOURCE
#define __CTYPE_HAS_8_BIT_LOCALES 1
@@ -153,7 +155,7 @@ char *setlocale(int category, register const char *locale)
&& ( (!locale) /* Request for locale category string. */
|| (!*locale) /* Implementation-defined default is C. */
|| ((*locale == 'C') && !locale[1])
- || (!strcmp(locale, "POSIX"))) )
+ || (!__strcmp(locale, "POSIX"))) )
? (char *) C_string /* Always in C/POSIX locale. */
: NULL;
}
@@ -224,7 +226,7 @@ static void update_hr_locale(const unsigned char *spec)
*n = 0;
} else {
char at = 0;
- memcpy(n, LOCALE_NAMES + 5*((*loc)-1), 5);
+ __memcpy(n, LOCALE_NAMES + 5*((*loc)-1), 5);
if (n[2] != '_') {
at = n[2];
n[2] = '_';
@@ -453,7 +455,7 @@ static int init_cur_collate(int der_num, __collate_t *cur_collate)
+ cdd->base_idx * sizeof(coldata_base_t)
)/2 );
- memcpy(cur_collate, cdb, offsetof(coldata_base_t,index2weight_offset));
+ __memcpy(cur_collate, cdb, offsetof(coldata_base_t,index2weight_offset));
cur_collate->undefined_idx = cdd->undefined_idx;
cur_collate->ti_mask = (1 << cur_collate->ti_shift)-1;
@@ -505,9 +507,9 @@ static int init_cur_collate(int der_num, __collate_t *cur_collate)
cur_collate->index2ruleidx = cur_collate->index2weight
+ cur_collate->max_col_index + 1;
- memcpy(cur_collate->index2weight, cur_collate->index2weight_tbl,
+ __memcpy(cur_collate->index2weight, cur_collate->index2weight_tbl,
cur_collate->num_col_base * sizeof(uint16_t));
- memcpy(cur_collate->index2ruleidx, cur_collate->index2ruleidx_tbl,
+ __memcpy(cur_collate->index2ruleidx, cur_collate->index2ruleidx_tbl,
cur_collate->num_col_base * sizeof(uint16_t));
/* now do the overrides */
@@ -592,7 +594,7 @@ int _locale_set_l(const unsigned char *p, __locale_t base)
return 0; /* calloc failed. */
}
free(base->collate.index2weight);
- memcpy(&base->collate, &newcol, sizeof(__collate_t));
+ __memcpy(&base->collate, &newcol, sizeof(__collate_t));
}
do {
@@ -662,15 +664,15 @@ int _locale_set_l(const unsigned char *p, __locale_t base)
* All of this will be replaced in the next generation
* of locale support anyway... */
- memcpy(base->__ctype_b_data,
+ __memcpy(base->__ctype_b_data,
__C_ctype_b - __UCLIBC_CTYPE_B_TBL_OFFSET,
(256 + __UCLIBC_CTYPE_B_TBL_OFFSET)
* sizeof(__ctype_mask_t));
- memcpy(base->__ctype_tolower_data,
+ __memcpy(base->__ctype_tolower_data,
__C_ctype_tolower - __UCLIBC_CTYPE_TO_TBL_OFFSET,
(256 + __UCLIBC_CTYPE_TO_TBL_OFFSET)
* sizeof(__ctype_touplow_t));
- memcpy(base->__ctype_toupper_data,
+ __memcpy(base->__ctype_toupper_data,
__C_ctype_toupper - __UCLIBC_CTYPE_TO_TBL_OFFSET,
(256 + __UCLIBC_CTYPE_TO_TBL_OFFSET)
* sizeof(__ctype_touplow_t));
@@ -780,7 +782,7 @@ int _locale_set_l(const unsigned char *p, __locale_t base)
d = base->outdigit_length;
x = &base->outdigit0_mb;
for (c = 0 ; c < 10 ; c++) {
- ((unsigned char *)d)[c] = strlen(x[c]);
+ ((unsigned char *)d)[c] = __strlen(x[c]);
assert(d[c] > 0);
}
} else if (i == LC_NUMERIC) {
@@ -845,10 +847,10 @@ static const uint16_t __code2flag[16] = {
void _locale_init_l(__locale_t base)
{
- memset(base->cur_locale, 0, LOCALE_SELECTOR_SIZE);
+ __memset(base->cur_locale, 0, LOCALE_SELECTOR_SIZE);
base->cur_locale[0] = '#';
- memcpy(base->category_item_count,
+ __memcpy(base->category_item_count,
__locale_mmap->lc_common_item_offsets_LEN,
LC_ALL);
@@ -1070,14 +1072,14 @@ static int find_locale(int category_mask, const char *p,
char buf[18]; /* TODO: 7+{max codeset name length} */
const char *q;
- if ((q = strchr(p,'@')) != NULL) {
+ if ((q = __strchr(p,'@')) != NULL) {
if ((((size_t)((q-p)-5)) > (sizeof(buf) - 5)) || (p[2] != '_')) {
return 0;
}
/* locale name at least 5 chars long and 3rd char is '_' */
s = LOCALE_AT_MODIFIERS;
do {
- if (!strcmp(s+2, q+1)) {
+ if (!__strcmp(s+2, q+1)) {
break;
}
s += 2 + *s; /* TODO - fix this throughout */
@@ -1086,7 +1088,7 @@ static int find_locale(int category_mask, const char *p,
return 0;
}
assert(q - p < sizeof(buf));
- memcpy(buf, p, q-p);
+ __memcpy(buf, p, q-p);
buf[q-p] = 0;
buf[2] = s[1];
p = buf;
@@ -1094,19 +1096,19 @@ static int find_locale(int category_mask, const char *p,
#endif
lang_cult = codeset = 0; /* Assume C and default codeset. */
- if (((*p == 'C') && !p[1]) || !strcmp(p, posix)) {
+ if (((*p == 'C') && !p[1]) || !__strcmp(p, posix)) {
goto FIND_LOCALE;
}
- if ((strlen(p) > 5) && (p[5] == '.')) { /* Codeset in locale name? */
+ if ((__strlen(p) > 5) && (p[5] == '.')) { /* Codeset in locale name? */
/* TODO: maybe CODESET_LIST + *s ??? */
/* 7bit is 1, UTF-8 is 2, 8-bit is >= 3 */
codeset = 2;
- if (strcmp(utf8,p+6) != 0) {/* TODO - fix! */
+ if (__strcmp(utf8,p+6) != 0) {/* TODO - fix! */
s = CODESET_LIST;
do {
++codeset; /* Increment codeset first. */
- if (!strcmp(CODESET_LIST+*s, p+6)) {
+ if (!__strcmp(CODESET_LIST+*s, p+6)) {
goto FIND_LANG_CULT;
}
} while (*++s);
@@ -1119,7 +1121,7 @@ static int find_locale(int category_mask, const char *p,
do { /* TODO -- do a binary search? */
/* TODO -- fix gen_mmap!*/
++lang_cult; /* Increment first since C/POSIX is 0. */
- if (!strncmp(s,p,5)) { /* Found a matching locale name; */
+ if (!__strncmp(s,p,5)) { /* Found a matching locale name; */
goto FIND_LOCALE;
}
s += 5;
@@ -1161,14 +1163,14 @@ static unsigned char *composite_locale(int category_mask, const char *locale,
int c;
int component_mask;
- if (!strchr(locale,'=')) {
+ if (!__strchr(locale,'=')) {
if (!find_locale(category_mask, locale, new_locale)) {
return NULL;
}
return new_locale;
}
- if (strlen(locale) >= sizeof(buf)) {
+ if (__strlen(locale) >= sizeof(buf)) {
return NULL;
}
stpcpy(buf, locale);
@@ -1177,7 +1179,7 @@ static unsigned char *composite_locale(int category_mask, const char *locale,
t = strtok_r(buf, "=", &e); /* This can't fail because of strchr test above. */
do {
c = 0;
- while (strcmp(CATEGORY_NAMES + (int) CATEGORY_NAMES[c], t)) {
+ while (__strcmp(CATEGORY_NAMES + (int) CATEGORY_NAMES[c], t)) {
if (++c == LC_ALL) { /* Unknown category name! */
return NULL;
}
@@ -1219,7 +1221,7 @@ __locale_t __newlocale(int category_mask, const char *locale, __locale_t base)
#ifdef __UCLIBC_MJN3_ONLY__
#warning TODO: Rename cur_locale to locale_selector.
#endif
- strcpy((char *) new_selector,
+ __strcpy((char *) new_selector,
(base ? (char *) base->cur_locale : C_LOCALE_SELECTOR));
if (!*locale) { /* locale == "", so check environment. */
@@ -1308,9 +1310,9 @@ __locale_t __duplocale(__locale_t dataset)
if ((i2w = calloc(n, sizeof(uint16_t)))
!= NULL
) {
- memcpy(r, dataset, sizeof(__uclibc_locale_t));
+ __memcpy(r, dataset, sizeof(__uclibc_locale_t));
r->collate.index2weight = i2w;
- memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t));
+ __memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t));
} else {
free(r);
r = NULL;
@@ -1413,8 +1415,8 @@ __locale_t weak_function __curlocale_set(__locale_t newloc)
#define Cc2wc_ROW_LEN __LOCALE_DATA_Cc2wc_ROW_LEN
extern size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn,
- const char **__restrict src, size_t n,
- mbstate_t *ps, int allow_continuation);
+ const char **__restrict src, size_t n,
+ mbstate_t *ps, int allow_continuation) attribute_hidden;
int __locale_mbrtowc_l(wchar_t *__restrict dst,
const char *__restrict src,
diff --git a/libc/misc/mntent/Makefile b/libc/misc/mntent/Makefile
index 34a3d6f71..4a8f4a072 100644
--- a/libc/misc/mntent/Makefile
+++ b/libc/misc/mntent/Makefile
@@ -1,43 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=mntent.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.mntent
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/mntent/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c
index d98a6870f..1af5a6b67 100644
--- a/libc/misc/mntent/mntent.c
+++ b/libc/misc/mntent/mntent.c
@@ -1,3 +1,6 @@
+#define strtok_r __strtok_r
+#define strstr __strstr
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/libc/misc/pthread/Makefile b/libc/misc/pthread/Makefile
index e222e1442..4a8f4a072 100644
--- a/libc/misc/pthread/Makefile
+++ b/libc/misc/pthread/Makefile
@@ -1,38 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=no-tsd.c weaks.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.pthread
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/pthread/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) $(PTINC) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c
index 5e09af6d9..d367211c5 100644
--- a/libc/misc/regex/regex.c
+++ b/libc/misc/regex/regex.c
@@ -44,6 +44,15 @@ extern wctype_t __wctype (__const char *__property) attribute_hidden;
extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/;
#endif
+
+#define memcmp __memcmp
+#define memcpy __memcpy
+#define memmove __memmove
+#define memset __memset
+#define strchr __strchr
+#define strcmp __strcmp
+#define strlen __strlen
+#define strncpy __strncpy
#endif
/* Make sure noone compiles this code with a C++ compiler. */
diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c
index 3e9d2eb30..69b77c4c3 100644
--- a/libc/misc/regex/regex_old.c
+++ b/libc/misc/regex/regex_old.c
@@ -21,7 +21,6 @@
02111-1307 USA. */
#define HAVE_MEMPCPY
-#define __mempcpy __libc_mempcpy
#define memset __memset
#define memcmp __memcmp
#define strcmp __strcmp
@@ -40,7 +39,7 @@
#define STDC_HEADERS
#define RE_TRANSLATE_TYPE char *
-extern void *__libc_mempcpy (void *__restrict __dest,
+extern void *__mempcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n) /*attribute_hidden*/;
/* AIX requires this to be the first thing in the file. */
diff --git a/libc/misc/search/Makefile b/libc/misc/search/Makefile
index 7e67bb4e5..4a8f4a072 100644
--- a/libc/misc/search/Makefile
+++ b/libc/misc/search/Makefile
@@ -1,72 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-MSRC1=tsearch.c
-MOBJ1=tsearch.o tfind.o tdelete.o twalk.o tdestroy.o
-
-MSRC2=lsearch.c
-MOBJ2=lfind.o lsearch.o
-
-MSRC3=insremque.c
-MOBJ3=insque.o remque.o
-
-MSRC4=hsearch_r.c
-MOBJ4=hcreate_r.o hdestroy_r.o hsearch_r.o
-
-CSRC=hsearch.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-
-OBJS=$(COBJS) $(MOBJ1) $(MOBJ2) $(MOBJ3) $(MOBJ4)
-
-OBJ_LIST=../../obj.misc.search
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/search/%, $(OBJS)) > $(OBJ_LIST)
-
-$(MOBJ1): $(MSRC1)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(MOBJ2): $(MSRC2)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(MOBJ3): $(MSRC3)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(MOBJ4): $(MSRC4)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/search/hsearch_r.c b/libc/misc/search/hsearch_r.c
index 10efb1a88..0f96180b1 100644
--- a/libc/misc/search/hsearch_r.c
+++ b/libc/misc/search/hsearch_r.c
@@ -140,7 +140,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval,
{
unsigned int hval;
unsigned int count;
- unsigned int len = strlen (item.key);
+ unsigned int len = __strlen (item.key);
unsigned int idx;
/* Compute an value for the given string. Perhaps use a better method. */
@@ -166,7 +166,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval,
unsigned hval2;
if (htab->table[idx].used == hval
- && strcmp (item.key, htab->table[idx].entry.key) == 0)
+ && __strcmp (item.key, htab->table[idx].entry.key) == 0)
{
*retval = &htab->table[idx].entry;
return 1;
@@ -190,7 +190,7 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval,
/* If entry is found use it. */
if (htab->table[idx].used == hval
- && strcmp (item.key, htab->table[idx].entry.key) == 0)
+ && __strcmp (item.key, htab->table[idx].entry.key) == 0)
{
*retval = &htab->table[idx].entry;
return 1;
diff --git a/libc/misc/search/lsearch.c b/libc/misc/search/lsearch.c
index 2a9996d47..4bc45ca36 100644
--- a/libc/misc/search/lsearch.c
+++ b/libc/misc/search/lsearch.c
@@ -37,7 +37,7 @@ void *lsearch(const void *key, void *base, size_t *nmemb,
register char *p;
if ((p = lfind(key, base, nmemb, size, compar)) == NULL) {
- p = memcpy((base + (size * (*nmemb))), key, size);
+ p = __memcpy((base + (size * (*nmemb))), key, size);
++(*nmemb);
}
return (p);
diff --git a/libc/misc/search/tsearch.c b/libc/misc/search/tsearch.c
index 72abcee7b..1da6b571e 100644
--- a/libc/misc/search/tsearch.c
+++ b/libc/misc/search/tsearch.c
@@ -51,7 +51,7 @@ register node **rootp; address of tree root
int (*compar)(); ordering function
*/
-void *tsearch(__const void *key, void **vrootp, __compar_fn_t compar)
+void attribute_hidden *__tsearch(__const void *key, void **vrootp, __compar_fn_t compar)
{
register node *q;
register node **rootp = (node **) vrootp;
@@ -77,6 +77,7 @@ void *tsearch(__const void *key, void **vrootp, __compar_fn_t compar)
}
return (q);
}
+strong_alias(__tsearch,tsearch)
#endif
#ifdef L_tfind
diff --git a/libc/misc/statfs/Makefile b/libc/misc/statfs/Makefile
index bbb9dd0bc..4a8f4a072 100644
--- a/libc/misc/statfs/Makefile
+++ b/libc/misc/statfs/Makefile
@@ -1,45 +1,13 @@
# Makefile for uClibc
-# Copyright (C) 2001,2002 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-ifeq ($(strip $(UCLIBC_HAS_LFS)),y)
-CSRC = fstatfs64.c statfs64.c statvfs.c statvfs64.c fstatvfs.c fstatvfs64.c
-else
-CSRC = statvfs.c fstatvfs.c
-endif
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.statfs
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/statfs/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/statfs/fstatfs64.c b/libc/misc/statfs/fstatfs64.c
index 1040e1fe1..b793002fb 100644
--- a/libc/misc/statfs/fstatfs64.c
+++ b/libc/misc/statfs/fstatfs64.c
@@ -57,7 +57,7 @@ int fstatfs64 (int fd, struct statfs64 *buf)
buf->f_ffree = buf32.f_ffree;
buf->f_fsid = buf32.f_fsid;
buf->f_namelen = buf32.f_namelen;
- memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+ __memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
return 0;
}
diff --git a/libc/misc/statfs/fstatvfs.c b/libc/misc/statfs/fstatvfs.c
index 5e08f51ad..b79195e73 100644
--- a/libc/misc/statfs/fstatvfs.c
+++ b/libc/misc/statfs/fstatvfs.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define strsep __strsep
+
#include <features.h>
#define __USE_GNU
diff --git a/libc/misc/statfs/fstatvfs64.c b/libc/misc/statfs/fstatvfs64.c
index ed4b63234..0d7416df3 100644
--- a/libc/misc/statfs/fstatvfs64.c
+++ b/libc/misc/statfs/fstatvfs64.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define strsep __strsep
+
#include <features.h>
#ifdef __UCLIBC_HAS_LFS__
diff --git a/libc/misc/statfs/internal_statvfs.c b/libc/misc/statfs/internal_statvfs.c
index aa7af44f5..8f7e386c4 100644
--- a/libc/misc/statfs/internal_statvfs.c
+++ b/libc/misc/statfs/internal_statvfs.c
@@ -39,7 +39,7 @@
buf->__f_unused = 0;
#endif
buf->f_namemax = fsbuf.f_namelen;
- memset (buf->__f_spare, '\0', 6 * sizeof (int));
+ __memset (buf->__f_spare, '\0', 6 * sizeof (int));
/* What remains to do is to fill the fields f_favail and f_flag. */
@@ -79,21 +79,21 @@
char *opt;
while ((opt = strsep (&cp, ",")) != NULL)
- if (strcmp (opt, "ro") == 0)
+ if (__strcmp (opt, "ro") == 0)
buf->f_flag |= ST_RDONLY;
- else if (strcmp (opt, "nosuid") == 0)
+ else if (__strcmp (opt, "nosuid") == 0)
buf->f_flag |= ST_NOSUID;
- else if (strcmp (opt, "noexec") == 0)
+ else if (__strcmp (opt, "noexec") == 0)
buf->f_flag |= ST_NOEXEC;
- else if (strcmp (opt, "nodev") == 0)
+ else if (__strcmp (opt, "nodev") == 0)
buf->f_flag |= ST_NODEV;
- else if (strcmp (opt, "sync") == 0)
+ else if (__strcmp (opt, "sync") == 0)
buf->f_flag |= ST_SYNCHRONOUS;
- else if (strcmp (opt, "mand") == 0)
+ else if (__strcmp (opt, "mand") == 0)
buf->f_flag |= ST_MANDLOCK;
- else if (strcmp (opt, "noatime") == 0)
+ else if (__strcmp (opt, "noatime") == 0)
buf->f_flag |= ST_NOATIME;
- else if (strcmp (opt, "nodiratime") == 0)
+ else if (__strcmp (opt, "nodiratime") == 0)
buf->f_flag |= ST_NODIRATIME;
/* We can stop looking for more entries. */
diff --git a/libc/misc/statfs/statfs64.c b/libc/misc/statfs/statfs64.c
index 0b954c675..7144cce71 100644
--- a/libc/misc/statfs/statfs64.c
+++ b/libc/misc/statfs/statfs64.c
@@ -55,7 +55,7 @@ int statfs64 (const char *file, struct statfs64 *buf)
buf->f_ffree = buf32.f_ffree;
buf->f_fsid = buf32.f_fsid;
buf->f_namelen = buf32.f_namelen;
- memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+ __memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
return 0;
}
diff --git a/libc/misc/statfs/statvfs.c b/libc/misc/statfs/statvfs.c
index 02a95fcde..0fe239573 100644
--- a/libc/misc/statfs/statvfs.c
+++ b/libc/misc/statfs/statvfs.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define strsep __strsep
+
#include <features.h>
#define __USE_GNU
diff --git a/libc/misc/statfs/statvfs64.c b/libc/misc/statfs/statvfs64.c
index 78d1a4c3f..8bacbba70 100644
--- a/libc/misc/statfs/statvfs64.c
+++ b/libc/misc/statfs/statvfs64.c
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define strsep __strsep
+
#include <features.h>
#ifdef __UCLIBC_HAS_LFS__
diff --git a/libc/misc/syslog/Makefile b/libc/misc/syslog/Makefile
index 26239ab7b..4a8f4a072 100644
--- a/libc/misc/syslog/Makefile
+++ b/libc/misc/syslog/Makefile
@@ -1,47 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=syslog.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-ifeq ($(UCLIBC_HAS_THREADS),y)
-CFLAGS += $(PTINC)
-endif
-
-OBJ_LIST=../../obj.misc.syslog
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/syslog/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c
index 704336006..69ff0b38b 100644
--- a/libc/misc/syslog/syslog.c
+++ b/libc/misc/syslog/syslog.c
@@ -112,7 +112,7 @@ closelog_intern(int to_default)
{
LOCK;
if (LogFile != -1) {
- (void) close(LogFile);
+ (void) __close(LogFile);
}
LogFile = -1;
connected = 0;
@@ -158,7 +158,7 @@ vsyslog( int pri, const char *fmt, va_list ap )
struct sigaction action, oldaction;
int sigpipe;
- memset (&action, 0, sizeof (action));
+ __memset (&action, 0, sizeof (action));
action.sa_handler = sigpipe_handler;
sigemptyset (&action.sa_mask);
sigpipe = sigaction (SIGPIPE, &action, &oldaction);
@@ -184,7 +184,7 @@ vsyslog( int pri, const char *fmt, va_list ap )
(void)time(&now);
stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4);
if (LogTag) {
- if (strlen(LogTag) < sizeof(tbuf) - 64)
+ if (__strlen(LogTag) < sizeof(tbuf) - 64)
p += sprintf(p, "%s", LogTag);
else
p += sprintf(p, "<BUFFER OVERRUN ATTEMPT>");
@@ -207,9 +207,9 @@ vsyslog( int pri, const char *fmt, va_list ap )
p += vsnprintf(p, end - p, fmt, ap);
if (p >= end || p < head_end) { /* Returned -1 in case of error... */
static const char truncate_msg[12] = "[truncated] ";
- memmove(head_end + sizeof(truncate_msg), head_end,
+ __memmove(head_end + sizeof(truncate_msg), head_end,
end - head_end - sizeof(truncate_msg));
- memcpy(head_end, truncate_msg, sizeof(truncate_msg));
+ __memcpy(head_end, truncate_msg, sizeof(truncate_msg));
if (p < head_end) {
while (p < end && *p) {
p++;
@@ -225,14 +225,14 @@ vsyslog( int pri, const char *fmt, va_list ap )
/* Output to stderr if requested. */
if (LogStat & LOG_PERROR) {
*last_chr = '\n';
- (void)write(STDERR_FILENO, stdp, last_chr - stdp + 1);
+ (void)__write(STDERR_FILENO, stdp, last_chr - stdp + 1);
}
/* Output the message to the local logger using NUL as a message delimiter. */
p = tbuf;
*last_chr = 0;
do {
- rc = write(LogFile, p, last_chr + 1 - p);
+ rc = __write(LogFile, p, last_chr + 1 - p);
if (rc < 0) {
if ((errno==EAGAIN) || (errno==EINTR))
rc=0;
@@ -253,12 +253,12 @@ vsyslog( int pri, const char *fmt, va_list ap )
*/
/* should mode be `O_WRONLY | O_NOCTTY' ? -- Uli */
if (LogStat & LOG_CONS &&
- (fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) {
- p = strchr(tbuf, '>') + 1;
+ (fd = __open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) {
+ p = __strchr(tbuf, '>') + 1;
last_chr[0] = '\r';
last_chr[1] = '\n';
- (void)write(fd, p, last_chr - p + 2);
- (void)close(fd);
+ (void)__write(fd, p, last_chr - p + 2);
+ (void)__close(fd);
}
getout:
@@ -285,7 +285,7 @@ openlog( const char *ident, int logstat, int logfac )
LogFacility = logfac;
if (LogFile == -1) {
SyslogAddr.sa_family = AF_UNIX;
- (void)strncpy(SyslogAddr.sa_data, _PATH_LOG,
+ (void)__strncpy(SyslogAddr.sa_data, _PATH_LOG,
sizeof(SyslogAddr.sa_data));
retry:
if (LogStat & LOG_NDELAY) {
@@ -299,19 +299,19 @@ retry:
if (LogFile != -1 && !connected) {
if (connect(LogFile, &SyslogAddr, sizeof(SyslogAddr) -
- sizeof(SyslogAddr.sa_data) + strlen(SyslogAddr.sa_data)) != -1)
+ sizeof(SyslogAddr.sa_data) + __strlen(SyslogAddr.sa_data)) != -1)
{
connected = 1;
} else if (logType == SOCK_DGRAM) {
logType = SOCK_STREAM;
if (LogFile != -1) {
- close(LogFile);
+ __close(LogFile);
LogFile = -1;
}
goto retry;
} else {
if (LogFile != -1) {
- close(LogFile);
+ __close(LogFile);
LogFile = -1;
}
}
diff --git a/libc/misc/sysvipc/Makefile b/libc/misc/sysvipc/Makefile
index 11aba5758..4a8f4a072 100644
--- a/libc/misc/sysvipc/Makefile
+++ b/libc/misc/sysvipc/Makefile
@@ -1,78 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-DIRS=
-
-MSRC=sem.c
-MOBJ=semget.o semctl.o semop.o
-
-MSRC2=shm.c
-MOBJ2=shmat.o shmctl.o shmdt.o shmget.o
-
-MSRC3=msgq.c
-MOBJ3=msgctl.o msgget.o msgrcv.o msgsnd.o
-
-CSRC = ftok.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-
-OBJS=$(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS)
-
-OBJ_LIST=../../obj.misc.sysvipc
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/sysvipc/%, $(OBJS)) > $(OBJ_LIST)
-
-$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(MOBJ2): $(MSRC2)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(MOBJ3): $(MSRC3)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-clean: subdirs_clean
- $(RM) *.[oa] *~ core
-
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
-
-$(patsubst %, _dir_%, $(DIRS)) : dummy
- $(MAKE) -C $(patsubst _dir_%, %, $@)
-
-$(patsubst %, _dirclean_%, $(DIRS)) : dummy
- $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-.PHONY: dummy
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c
index 29f3178d6..9c6f019bf 100644
--- a/libc/misc/sysvipc/shm.c
+++ b/libc/misc/sysvipc/shm.c
@@ -17,6 +17,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+/* SHMLBA is using it */
+#define __getpagesize __libc_getpagesize
+
#include <stdlib.h>
#include <errno.h>
#include <sys/shm.h>
diff --git a/libc/misc/time/Makefile b/libc/misc/time/Makefile
index ebeea09e6..4a8f4a072 100644
--- a/libc/misc/time/Makefile
+++ b/libc/misc/time/Makefile
@@ -1,73 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-MSRC= time.c
-MOBJ= asctime.o asctime_r.o clock.o ctime.o ctime_r.o gmtime.o gmtime_r.o \
- localtime.o localtime_r.o mktime.o strftime.o strptime.o tzset.o \
- _time_t2tm.o __time_tm.o _time_mktime.o dysize.o timegm.o \
- _time_mktime_tzi.o _time_localtime_tzi.o
-MOBJx=
-
-ifeq ($(UCLIBC_HAS_FLOATS),y)
- MOBJ += difftime.o
-endif
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
- MOBJx += strftime_l.o strptime_l.o
-endif
-
-ifeq ($(UCLIBC_HAS_WCHAR),y)
- MOBJ += wcsftime.o
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
- MOBJx += wcsftime_l.o
-endif
-endif
-
-CSRC= adjtime.c ftime.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-
-OBJS=$(COBJS) $(MOBJ) $(MOBJx)
-
-OBJ_LIST=../../obj.misc.time
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/time/%, $(OBJS)) > $(OBJ_LIST)
-
-$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(MOBJx): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* -D__UCLIBC_DO_XLOCALE $< -c -o $*.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index 21c4bb96b..4d3c43492 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -129,6 +129,9 @@
* differs (intentionally) from glibc's behavior.
*/
+#define _uintmaxtostr __libc__uintmaxtostr
+#define strnlen __strnlen
+
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
@@ -210,26 +213,32 @@ extern pthread_mutex_t _time_tzlock;
extern rule_struct _time_tzinfo[2];
extern struct tm *_time_t2tm(const time_t *__restrict timer,
- int offset, struct tm *__restrict result);
+ int offset, struct tm *__restrict result) attribute_hidden;
-extern time_t _time_mktime(struct tm *timeptr, int store_on_success);
+extern time_t _time_mktime(struct tm *timeptr, int store_on_success) attribute_hidden;
extern struct tm *__time_localtime_tzi(const time_t *__restrict timer,
- struct tm *__restrict result,
- rule_struct *tzi);
+ struct tm *__restrict result,
+ rule_struct *tzi) attribute_hidden;
extern time_t _time_mktime_tzi(struct tm *timeptr, int store_on_success,
- rule_struct *tzi);
+ rule_struct *tzi) attribute_hidden;
+
+extern char *__asctime (__const struct tm *__tp) attribute_hidden;
+
+extern char *__asctime_r (__const struct tm *__restrict __tp,
+ char *__restrict __buf) attribute_hidden;
/**********************************************************************/
#ifdef L_asctime
static char __time_str[26];
-char *asctime(const struct tm *__restrict ptm)
+char attribute_hidden *__asctime(const struct tm *ptm)
{
- return asctime_r(ptm, __time_str);
+ return __asctime_r(ptm, __time_str);
}
+strong_alias(__asctime,asctime)
#endif
/**********************************************************************/
@@ -297,7 +306,7 @@ static const unsigned char at_data[] = {
' ', '?', '?', '?', '?', '\n', 0
};
-char *asctime_r(register const struct tm *__restrict ptm,
+char attribute_hidden *__asctime_r(register const struct tm *__restrict ptm,
register char *__restrict buffer)
{
int tmp;
@@ -306,23 +315,23 @@ char *asctime_r(register const struct tm *__restrict ptm,
assert(buffer);
#ifdef SAFE_ASCTIME_R
- memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12));
+ __memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12));
if (((unsigned int)(ptm->tm_wday)) <= 6) {
- memcpy(buffer, at_data + 3 * ptm->tm_wday, 3);
+ __memcpy(buffer, at_data + 3 * ptm->tm_wday, 3);
}
if (((unsigned int)(ptm->tm_mon)) <= 11) {
- memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3);
+ __memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3);
}
#else
assert(((unsigned int)(ptm->tm_wday)) <= 6);
assert(((unsigned int)(ptm->tm_mon)) <= 11);
- memcpy(buffer, at_data + 3*(7 + 12) - 3, sizeof(at_data) + 3 - 3*(7 + 12));
+ __memcpy(buffer, at_data + 3*(7 + 12) - 3, sizeof(at_data) + 3 - 3*(7 + 12));
- memcpy(buffer, at_data + 3 * ptm->tm_wday, 3);
- memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3);
+ __memcpy(buffer, at_data + 3 * ptm->tm_wday, 3);
+ __memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3);
#endif
#ifdef SAFE_ASCTIME_R
@@ -371,6 +380,7 @@ char *asctime_r(register const struct tm *__restrict ptm,
return buffer - 8;
}
+strong_alias(__asctime_r,asctime_r)
#endif
/**********************************************************************/
@@ -445,7 +455,7 @@ clock_t clock(void)
char *ctime(const time_t *clock)
{
/* ANSI/ISO/SUSv3 say that ctime is equivalent to the following. */
- return asctime(localtime(clock));
+ return __asctime(localtime(clock));
}
#endif
@@ -456,7 +466,7 @@ char *ctime_r(const time_t *clock, char *buf)
{
struct tm xtm;
- return asctime_r(localtime_r(clock, &xtm), buf);
+ return __asctime_r(localtime_r(clock, &xtm), buf);
}
#endif
@@ -576,7 +586,7 @@ static const char *lookup_tzname(const char *key)
ll_tzname_item_t *p;
for (p=ll_tzname ; p ; p=p->next) {
- if (!strcmp(p->tzname, key)) {
+ if (!__strcmp(p->tzname, key)) {
return p->tzname;
}
}
@@ -587,7 +597,7 @@ static const char *lookup_tzname(const char *key)
/* Insert as 3rd item in the list. */
p->next = ll_tzname[1].next;
ll_tzname[1].next = p;
- strcpy(p->tzname, key);
+ __strcpy(p->tzname, key);
return p->tzname;
}
}
@@ -679,7 +689,7 @@ static int tm_isdst(register const struct tm *__restrict ptm,
return (isdst & 1);
}
-struct tm *__time_localtime_tzi(register const time_t *__restrict timer,
+struct tm attribute_hidden *__time_localtime_tzi(register const time_t *__restrict timer,
register struct tm *__restrict result,
rule_struct *tzi)
{
@@ -731,8 +741,8 @@ time_t timegm(struct tm *timeptr)
{
rule_struct gmt_tzinfo[2];
- memset(gmt_tzinfo, 0, sizeof(gmt_tzinfo));
- strcpy(gmt_tzinfo[0].tzname, "GMT"); /* Match glibc behavior here. */
+ __memset(gmt_tzinfo, 0, sizeof(gmt_tzinfo));
+ __strcpy(gmt_tzinfo[0].tzname, "GMT"); /* Match glibc behavior here. */
return _time_mktime_tzi(timeptr, 1, gmt_tzinfo);
}
@@ -1492,7 +1502,7 @@ char *__XL(strptime)(const char *__restrict buf, const char *__restrict format,
do {
--j;
o = __XL(nl_langinfo)(i+j __LOCALE_ARG);
- if (!__XL(strncasecmp)(buf,o,strlen(o) __LOCALE_ARG) && *o) {
+ if (!__XL(strncasecmp)(buf,o,__strlen(o) __LOCALE_ARG) && *o) {
do { /* Found a match. */
++buf;
} while (*++o);
@@ -1747,11 +1757,11 @@ static char *read_TZ_file(char *buf)
size_t todo;
char *p = NULL;
- if ((fd = open(__UCLIBC_TZ_FILE_PATH__, O_RDONLY)) >= 0) {
+ if ((fd = __open(__UCLIBC_TZ_FILE_PATH__, O_RDONLY)) >= 0) {
todo = TZ_BUFLEN;
p = buf;
do {
- if ((r = read(fd, p, todo)) < 0) {
+ if ((r = __read(fd, p, todo)) < 0) {
goto ERROR;
}
if (r == 0) {
@@ -1771,7 +1781,7 @@ static char *read_TZ_file(char *buf)
ERROR:
p = NULL;
}
- close(fd);
+ __close(fd);
}
return p;
}
@@ -1823,8 +1833,8 @@ void tzset(void)
#ifdef __UCLIBC_HAS_TZ_CACHING__
*oldval = 0; /* Set oldval to an empty string. */
#endif /* __UCLIBC_HAS_TZ_CACHING__ */
- memset(_time_tzinfo, 0, 2*sizeof(rule_struct));
- strcpy(_time_tzinfo[0].tzname, UTC);
+ __memset(_time_tzinfo, 0, 2*sizeof(rule_struct));
+ __strcpy(_time_tzinfo[0].tzname, UTC);
goto DONE;
}
@@ -1833,13 +1843,13 @@ void tzset(void)
}
#ifdef __UCLIBC_HAS_TZ_CACHING__
- if (strcmp(e, oldval) == 0) { /* Same string as last time... */
+ if (__strcmp(e, oldval) == 0) { /* Same string as last time... */
goto FAST_DONE; /* So nothing to do. */
}
/* Make a copy of the TZ env string. It won't be nul-terminated if
* it is too long, but it that case it will be illegal and will be reset
* to the empty string anyway. */
- strncpy(oldval, e, TZ_BUFLEN);
+ __strncpy(oldval, e, TZ_BUFLEN);
#endif /* __UCLIBC_HAS_TZ_CACHING__ */
count = 0;
@@ -1953,7 +1963,7 @@ void tzset(void)
}
}
- memcpy(_time_tzinfo, new_rules, sizeof(new_rules));
+ __memcpy(_time_tzinfo, new_rules, sizeof(new_rules));
DONE:
tzname[0] = _time_tzinfo[0].tzname;
tzname[1] = _time_tzinfo[1].tzname;
@@ -2023,7 +2033,7 @@ static const char utc_string[] = "UTC";
/* Note: offset is the correction in _days_ to *timer! */
-struct tm *_time_t2tm(const time_t *__restrict timer,
+struct tm attribute_hidden *_time_t2tm(const time_t *__restrict timer,
int offset, struct tm *__restrict result)
{
register int *p;
@@ -2161,7 +2171,7 @@ struct tm __time_tm; /* Global shared by gmtime() and localtime(). */
/**********************************************************************/
#ifdef L__time_mktime
-time_t _time_mktime(struct tm *timeptr, int store_on_success)
+time_t attribute_hidden _time_mktime(struct tm *timeptr, int store_on_success)
{
time_t t;
@@ -2185,7 +2195,7 @@ static const unsigned char __vals[] = {
29,
};
-time_t _time_mktime_tzi(struct tm *timeptr, int store_on_success,
+time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_success,
rule_struct *tzi)
{
#ifdef __BCC__
@@ -2200,7 +2210,7 @@ time_t _time_mktime_tzi(struct tm *timeptr, int store_on_success,
register const unsigned char *s;
int d, default_dst;
- memcpy(p, timeptr, sizeof(struct tm));
+ __memcpy(p, timeptr, sizeof(struct tm));
if (!tzi[1].tzname[0]) { /* No dst in this timezone, */
p[8] = 0; /* so set tm_isdst to 0. */
@@ -2290,7 +2300,7 @@ time_t _time_mktime_tzi(struct tm *timeptr, int store_on_success,
if (store_on_success) {
- memcpy(timeptr, p, sizeof(struct tm));
+ __memcpy(timeptr, p, sizeof(struct tm));
}
diff --git a/libc/misc/ttyent/Makefile b/libc/misc/ttyent/Makefile
index 8aaf8e8e8..4a8f4a072 100644
--- a/libc/misc/ttyent/Makefile
+++ b/libc/misc/ttyent/Makefile
@@ -1,38 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=getttyent.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.ttyent
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/ttyent/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c
index d7d77c1ba..c15228a24 100644
--- a/libc/misc/ttyent/getttyent.c
+++ b/libc/misc/ttyent/getttyent.c
@@ -27,6 +27,8 @@
* SUCH DAMAGE.
*/
+#define __fsetlocking __libc_fsetlocking
+
#define _GNU_SOURCE
#include <features.h>
#include <ttyent.h>
@@ -50,7 +52,7 @@ struct ttyent * getttynam(const char *tty)
setttyent();
while ((t = getttyent()))
- if (!strcmp(tty, t->ty_name))
+ if (!__strcmp(tty, t->ty_name))
break;
endttyent();
return (t);
@@ -96,7 +98,7 @@ static char * skip(register char *p)
static char * value(register char *p)
{
- return ((p = strchr(p, '=')) ? ++p : NULL);
+ return ((p = __strchr(p, '=')) ? ++p : NULL);
}
struct ttyent * getttyent(void)
@@ -122,7 +124,7 @@ struct ttyent * getttyent(void)
return (NULL);
}
/* skip lines that are too big */
- if (!strchr(p, '\n')) {
+ if (!__strchr(p, '\n')) {
while ((c = getc_unlocked(tf)) != '\n' && c != EOF)
;
continue;
@@ -148,8 +150,8 @@ struct ttyent * getttyent(void)
tty.ty_status = 0;
tty.ty_window = NULL;
-#define scmp(e) !strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1])
-#define vcmp(e) !strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '='
+#define scmp(e) !__strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1])
+#define vcmp(e) !__strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '='
for (; *p; p = skip(p)) {
if (scmp(_TTYS_OFF))
tty.ty_status &= ~TTY_ON;
@@ -171,7 +173,7 @@ struct ttyent * getttyent(void)
tty.ty_comment = p;
if (*p == 0)
tty.ty_comment = 0;
- if ((p = strchr(p, '\n')))
+ if ((p = __strchr(p, '\n')))
*p = '\0';
return (&tty);
}
diff --git a/libc/misc/utmp/Makefile b/libc/misc/utmp/Makefile
index c4cab9e9b..4a8f4a072 100644
--- a/libc/misc/utmp/Makefile
+++ b/libc/misc/utmp/Makefile
@@ -1,43 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=utent.c wtent.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.utmp
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/utmp/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index aa74cb544..c3d9ab620 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -53,7 +53,7 @@ static struct utmp *__getutent(int utmp_fd)
}
LOCK;
- if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp))
+ if (__read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp))
{
return NULL;
}
@@ -68,8 +68,8 @@ void setutent(void)
LOCK;
if (static_fd == -1) {
- if ((static_fd = open(static_ut_name, O_RDWR)) < 0) {
- if ((static_fd = open(static_ut_name, O_RDONLY)) < 0) {
+ if ((static_fd = __open(static_ut_name, O_RDWR)) < 0) {
+ if ((static_fd = __open(static_ut_name, O_RDONLY)) < 0) {
goto bummer;
}
}
@@ -82,7 +82,7 @@ void setutent(void)
bummer:
UNLOCK;
static_fd = -1;
- close(static_fd);
+ __close(static_fd);
return;
}
}
@@ -95,7 +95,7 @@ void endutent(void)
{
LOCK;
if (static_fd != -1) {
- close(static_fd);
+ __close(static_fd);
}
static_fd = -1;
UNLOCK;
@@ -125,7 +125,7 @@ struct utmp attribute_hidden *__getutid (const struct utmp *utmp_entry)
utmp_entry->ut_type == DEAD_PROCESS ||
utmp_entry->ut_type == LOGIN_PROCESS ||
utmp_entry->ut_type == USER_PROCESS) &&
- !strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id)))
+ !__strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id)))
{
return lutmp;
}
@@ -142,7 +142,7 @@ struct utmp *getutline(const struct utmp *utmp_entry)
while ((lutmp = __getutent(static_fd)) != NULL) {
if ((lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) &&
- !strcmp(lutmp->ut_line, utmp_entry->ut_line))
+ !__strcmp(lutmp->ut_line, utmp_entry->ut_line))
{
return lutmp;
}
@@ -162,11 +162,11 @@ struct utmp *pututline (const struct utmp *utmp_entry)
if (__getutid(utmp_entry) != NULL) {
lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
- if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
+ if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
return NULL;
} else {
lseek(static_fd, (off_t) 0, SEEK_END);
- if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
+ if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
return NULL;
}
@@ -180,7 +180,7 @@ int utmpname (const char *new_ut_name)
if (new_ut_name != NULL) {
if (static_ut_name != default_file_name)
free((char *)static_ut_name);
- static_ut_name = strdup(new_ut_name);
+ static_ut_name = __strdup(new_ut_name);
if (static_ut_name == NULL) {
/* We should probably whine about out-of-memory
* errors here... Instead just reset to the default */
@@ -189,7 +189,7 @@ int utmpname (const char *new_ut_name)
}
if (static_fd != -1)
- close(static_fd);
+ __close(static_fd);
UNLOCK;
return 0;
}
diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c
index ef5663feb..bb5244878 100644
--- a/libc/misc/utmp/wtent.c
+++ b/libc/misc/utmp/wtent.c
@@ -31,13 +31,13 @@
void logwtmp (const char *line, const char *name, const char *host)
{
struct utmp lutmp;
- memset (&(lutmp), 0, sizeof (struct utmp));
+ __memset (&(lutmp), 0, sizeof (struct utmp));
lutmp.ut_type = (name && *name)? USER_PROCESS : DEAD_PROCESS;
lutmp.ut_pid = getpid();
- strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
- strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
- strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
+ __strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
+ __strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
+ __strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
gettimeofday(&(lutmp.ut_tv), NULL);
updwtmp(_PATH_WTMP, &(lutmp));
@@ -48,12 +48,12 @@ extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
{
int fd;
- fd = open(wtmp_file, O_APPEND | O_WRONLY, 0);
+ fd = __open(wtmp_file, O_APPEND | O_WRONLY, 0);
if (fd >= 0) {
if (lockf(fd, F_LOCK, 0)==0) {
- write(fd, (const char *) lutmp, sizeof(struct utmp));
+ __write(fd, (const char *) lutmp, sizeof(struct utmp));
lockf(fd, F_ULOCK, 0);
- close(fd);
+ __close(fd);
}
}
}
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index 055900827..1691e00e0 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -98,8 +98,6 @@
* Manuel
*/
-#define memmove __memmove
-
#define _GNU_SOURCE
#define _ISOC99_SOURCE
#include <errno.h>
@@ -1620,7 +1618,7 @@ int main(int argc, char **argv)
break;
}
do {
- if ((s = strchr(opt_chars,*p)) == NULL) {
+ if ((s = __strchr(opt_chars,*p)) == NULL) {
USAGE:
s = basename(progname);
fprintf(stderr,
@@ -1697,7 +1695,7 @@ int main(int argc, char **argv)
}
}
if (ni) { /* still bytes in buffer! */
- memmove(ibuf, pi, ni);
+ __memmove(ibuf, pi, ni);
}
}
diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c
index ba902ba74..aa2b97d60 100644
--- a/libc/misc/wctype/wctype.c
+++ b/libc/misc/wctype/wctype.c
@@ -490,7 +490,7 @@ wctype_t attribute_hidden __wctype(const char *property)
p = typestring;
i = 1;
do {
- if (!strcmp(property, ++p)) {
+ if (!__strcmp(property, ++p)) {
return i;
}
++i;
@@ -886,7 +886,7 @@ wctrans_t wctrans(const char *property)
p = transstring;
i = 1;
do {
- if (!strcmp(property, ++p)) {
+ if (!__strcmp(property, ++p)) {
return i;
}
++i;
diff --git a/libc/misc/wordexp/Makefile b/libc/misc/wordexp/Makefile
index 6126be8bf..4a8f4a072 100644
--- a/libc/misc/wordexp/Makefile
+++ b/libc/misc/wordexp/Makefile
@@ -1,38 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2003 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-TOPDIR=../../../
-include $(TOPDIR)Rules.mak
-
-CSRC=wordexp.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
-
-OBJ_LIST=../../obj.misc.wordexp
-
-all: $(OBJ_LIST)
-
-$(OBJ_LIST): $(OBJS)
- echo $(patsubst %, misc/wordexp/%, $(OBJS)) > $(OBJ_LIST)
-
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-clean:
- $(RM) *.[oa] *~ core
+top_srcdir=../../../
+top_builddir=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c
index 628b8f3fe..5e9133c83 100644
--- a/libc/misc/wordexp/wordexp.c
+++ b/libc/misc/wordexp/wordexp.c
@@ -19,6 +19,11 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#define mempcpy __mempcpy
+#define strndup __strndup
+#define strspn __strspn
+#define unsetenv __unsetenv
+
#define _GNU_SOURCE
#include <sys/cdefs.h>
#include <sys/types.h>
@@ -130,7 +135,7 @@ static char *w_addstr(char *buffer, size_t * actlen, size_t * maxlen,
{
size_t len;
assert(str != NULL); /* w_addstr only called from this file */
- len = strlen(str);
+ len = __strlen(str);
return w_addmem(buffer, actlen, maxlen, str, len);
}
@@ -145,7 +150,7 @@ static int w_addword(wordexp_t * pwordexp, char *word)
* the caller sees them.
*/
if (word == NULL) {
- word = strdup("");
+ word = __strdup("");
if (word == NULL)
goto no_space;
}
@@ -247,7 +252,7 @@ parse_tilde(char **word, size_t * word_length, size_t * max_length,
if (*word_length != 0) {
if (!((*word)[*word_length - 1] == '=' && wordc == 0)) {
if (!((*word)[*word_length - 1] == ':'
- && strchr(*word, '=') && wordc == 0)) {
+ && __strchr(*word, '=') && wordc == 0)) {
*word = w_addchar(*word, word_length, max_length, '~');
return *word ? 0 : WRDE_NOSPACE;
}
@@ -372,7 +377,7 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length,
}
for (match = 0; match < globbuf.gl_pathc; ++match) {
- char *matching_word = strdup(globbuf.gl_pathv[match]);
+ char *matching_word = __strdup(globbuf.gl_pathv[match]);
if (matching_word == NULL || w_addword(pwordexp, matching_word)) {
globfree(&globbuf);
@@ -399,8 +404,8 @@ parse_glob(char **word, size_t * word_length, size_t * max_length,
glob_list.we_wordv = NULL;
glob_list.we_offs = 0;
for (; words[*offset] != '\0'; ++*offset) {
- if ((ifs && strchr(ifs, words[*offset])) ||
- (!ifs && strchr(" \t\n", words[*offset])))
+ if ((ifs && __strchr(ifs, words[*offset])) ||
+ (!ifs && __strchr(" \t\n", words[*offset])))
/* Reached IFS */
break;
@@ -757,24 +762,24 @@ exec_comm_child(char *comm, int *fildes, int showerr, int noexec)
/* Redirect output. */
dup2(fildes[1], 1);
- close(fildes[1]);
+ __close(fildes[1]);
/* Redirect stderr to /dev/null if we have to. */
if (showerr == 0) {
int fd;
- close(2);
- fd = open(_PATH_DEVNULL, O_WRONLY);
+ __close(2);
+ fd = __open(_PATH_DEVNULL, O_WRONLY);
if (fd >= 0 && fd != 2) {
dup2(fd, 2);
- close(fd);
+ __close(fd);
}
}
/* Make sure the subshell doesn't field-split on our behalf. */
unsetenv("IFS");
- close(fildes[0]);
+ __close(fildes[0]);
execve(_PATH_BSHELL, (char *const *) args, __environ);
/* Bad. What now? */
@@ -807,8 +812,8 @@ exec_comm(char *comm, char **word, size_t * word_length,
if ((pid = fork()) < 0) {
/* Bad */
- close(fildes[0]);
- close(fildes[1]);
+ __close(fildes[0]);
+ __close(fildes[1]);
return WRDE_NOSPACE;
}
@@ -817,17 +822,17 @@ exec_comm(char *comm, char **word, size_t * word_length,
/* Parent */
- close(fildes[1]);
+ __close(fildes[1]);
buffer = alloca(bufsize);
if (!pwordexp)
/* Quoted - no field splitting */
{
while (1) {
- if ((buflen = read(fildes[0], buffer, bufsize)) < 1) {
+ if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) {
if (waitpid(pid, &status, WNOHANG) == 0)
continue;
- if ((buflen = read(fildes[0], buffer, bufsize)) < 1)
+ if ((buflen = __read(fildes[0], buffer, bufsize)) < 1)
break;
}
@@ -850,17 +855,17 @@ exec_comm(char *comm, char **word, size_t * word_length,
*/
while (1) {
- if ((buflen = read(fildes[0], buffer, bufsize)) < 1) {
+ if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) {
if (waitpid(pid, &status, WNOHANG) == 0)
continue;
- if ((buflen = read(fildes[0], buffer, bufsize)) < 1)
+ if ((buflen = __read(fildes[0], buffer, bufsize)) < 1)
break;
}
for (i = 0; i < buflen; ++i) {
- if (strchr(ifs, buffer[i]) != NULL) {
+ if (__strchr(ifs, buffer[i]) != NULL) {
/* Current character is IFS */
- if (strchr(ifs_white, buffer[i]) == NULL) {
+ if (__strchr(ifs_white, buffer[i]) == NULL) {
/* Current character is IFS but not whitespace */
if (copying == 2) {
/* current character
@@ -954,7 +959,7 @@ exec_comm(char *comm, char **word, size_t * word_length,
}
}
- close(fildes[0]);
+ __close(fildes[0]);
/* Check for syntax error (re-execute but with "-n" flag) */
if (buflen < 1 && status != 0) {
@@ -977,7 +982,7 @@ exec_comm(char *comm, char **word, size_t * word_length,
no_space:
kill(pid, SIGKILL);
waitpid(pid, NULL, 0);
- close(fildes[0]);
+ __close(fildes[0]);
return WRDE_NOSPACE;
}
@@ -1176,7 +1181,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
goto envsubst;
}
while (isdigit(words[++*offset]));
- } else if (strchr("*@$", words[*offset]) != NULL) {
+ } else if (__strchr("*@$", words[*offset]) != NULL) {
/* Special parameter. */
special = 1;
env = w_addchar(env, &env_length, &env_maxlen, words[*offset]);
@@ -1212,7 +1217,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
break;
case ':':
- if (strchr("-=?+", words[1 + *offset]) == NULL)
+ if (__strchr("-=?+", words[1 + *offset]) == NULL)
goto syntax;
colon_seen = 1;
@@ -1344,7 +1349,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
/* Build up value parameter by parameter (copy them) */
for (p = 1; __libc_argv[p]; ++p)
- plist_len += strlen(__libc_argv[p]) + 1; /* for space */
+ plist_len += __strlen(__libc_argv[p]) + 1; /* for space */
value = malloc(plist_len);
if (value == NULL)
goto no_space;
@@ -1374,7 +1379,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
goto no_space;
for (p = 2; __libc_argv[p + 1]; p++) {
- char *newword = strdup(__libc_argv[p]);
+ char *newword = __strdup(__libc_argv[p]);
if (newword == NULL || w_addword(pwordexp, newword))
goto no_space;
@@ -1554,7 +1559,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
if (value == NULL || pattern == NULL || *pattern == '\0')
break;
- end = value + strlen(value);
+ end = value + __strlen(value);
switch (action) {
case ACT_RP_SHORT_LEFT:
@@ -1564,7 +1569,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
if (fnmatch(pattern, value, 0) != FNM_NOMATCH) {
*p = c;
if (free_value) {
- char *newval = strdup(p);
+ char *newval = __strdup(p);
if (newval == NULL) {
free(value);
@@ -1588,7 +1593,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
if (fnmatch(pattern, value, 0) != FNM_NOMATCH) {
*p = c;
if (free_value) {
- char *newval = strdup(p);
+ char *newval = __strdup(p);
if (newval == NULL) {
free(value);
@@ -1692,7 +1697,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
/* Substitute NULL */
goto success;
- value = pattern ? strdup(pattern) : pattern;
+ value = pattern ? __strdup(pattern) : pattern;
free_value = 1;
if (pattern && !value)
@@ -1705,7 +1710,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
if (free_value && value)
free(value);
- value = pattern ? strdup(pattern) : pattern;
+ value = pattern ? __strdup(pattern) : pattern;
free_value = 1;
if (pattern && !value)
@@ -1734,7 +1739,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
if (free_value && value)
free(value);
- value = pattern ? strdup(pattern) : pattern;
+ value = pattern ? __strdup(pattern) : pattern;
free_value = 1;
if (pattern && !value)
@@ -1758,7 +1763,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
param_length[20] = '\0';
*word = w_addstr(*word, word_length, max_length,
- _itoa(value ? strlen(value) : 0,
+ _itoa(value ? __strlen(value) : 0,
&param_length[20]));
if (free_value) {
assert(value != NULL);
@@ -1780,7 +1785,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
return *word ? 0 : WRDE_NOSPACE;
} else {
/* Need to field-split */
- char *value_copy = strdup(value); /* Don't modify value */
+ char *value_copy = __strdup(value); /* Don't modify value */
char *field_begin = value_copy;
int seen_nonws_ifs = 0;
@@ -1820,7 +1825,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
/* Skip at most one non-whitespace IFS character after the field */
seen_nonws_ifs = 0;
- if (*next_field && strchr(ifs, *next_field)) {
+ if (*next_field && __strchr(ifs, *next_field)) {
seen_nonws_ifs = 1;
next_field++;
}
@@ -2066,7 +2071,7 @@ int wordexp(const char *words, wordexp_t * we, int flags)
if (!ifs)
/* IFS unset - use <space><tab><newline>. */
- ifs = strcpy(ifs_white, " \t\n");
+ ifs = __strcpy(ifs_white, " \t\n");
else {
char *ifsch = ifs;
char *whch = ifs_white;
@@ -2185,11 +2190,11 @@ int wordexp(const char *words, wordexp_t * we, int flags)
default:
/* Is it a word separator? */
- if (strchr(" \t", words[words_offset]) == NULL) {
+ if (__strchr(" \t", words[words_offset]) == NULL) {
char ch = words[words_offset];
/* Not a word separator -- but is it a valid word char? */
- if (strchr("\n|&;<>(){}", ch)) {
+ if (__strchr("\n|&;<>(){}", ch)) {
/* Fail */
error = WRDE_BADCHAR;
goto do_error;