diff options
Diffstat (limited to 'libc/misc')
60 files changed, 1144 insertions, 923 deletions
diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c index c55f0b6ae..130bb044f 100644 --- a/libc/misc/assert/__assert.c +++ b/libc/misc/assert/__assert.c @@ -33,6 +33,9 @@  #include <unistd.h>  #include <bits/uClibc_uintmaxtostr.h> +libc_hidden_proto(fprintf) +libc_hidden_proto(abort) +  /* Get the prototype from assert.h as a double-check. */  #undef NDEBUG  #include <assert.h> diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index 69b4c1a6d..3f7bfd859 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -156,6 +156,9 @@ int CTYPE_NAME(NAME) (int c) \  #ifdef L___ctype_assert  #ifdef __UCLIBC_HAS_CTYPE_ENFORCED__ +libc_hidden_proto(fprintf) +libc_hidden_proto(abort) +  void __isctype_assert(int c, int mask)  {  	fprintf(stderr,	"%s: __is*{_l}(%d,%#x {locale})\n", __uclibc_progname, c, mask); @@ -266,9 +269,10 @@ IS_FUNC_BODY(xdigit);  /**********************************************************************/  #ifdef L_tolower +#undef tolower  #ifdef __UCLIBC_HAS_CTYPE_TABLES__ -int attribute_hidden __tolower(int c) +int tolower(int c)  {  #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)  	assert(CTYPE_DOMAIN_CHECK(c)); @@ -278,38 +282,38 @@ int attribute_hidden __tolower(int c)  #else  /* __UCLIBC_HAS_CTYPE_TABLES__ */ -int attribute_hidden __tolower(int c) +int tolower(int c)  {  	return __C_tolower(c);  }  #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */ -strong_alias(__tolower,tolower) +libc_hidden_proto(tolower) +libc_hidden_def(tolower)  #endif  /**********************************************************************/  #ifdef L_tolower_l  #undef tolower_l -#undef __tolower_l - -int __tolower_l(int c, __locale_t l) +int tolower_l(int c, __locale_t l)  {  #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)  	assert(CTYPE_DOMAIN_CHECK(c));  #endif  	return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_tolower[c] : c;  } - -weak_alias(__tolower_l, tolower_l) +libc_hidden_proto(tolower_l) +libc_hidden_def(tolower_l)  #endif  /**********************************************************************/  #ifdef L_toupper +#undef toupper  #ifdef __UCLIBC_HAS_CTYPE_TABLES__ -int attribute_hidden __toupper(int c) +int toupper(int c)  {  #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)  	assert(CTYPE_DOMAIN_CHECK(c)); @@ -319,22 +323,21 @@ int attribute_hidden __toupper(int c)  #else  /* __UCLIBC_HAS_CTYPE_TABLES__ */ -int attribute_hidden __toupper(int c) +int toupper(int c)  {  	return __C_toupper(c);  }  #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */ -strong_alias(__toupper,toupper) +libc_hidden_proto(toupper) +libc_hidden_def(toupper)  #endif  /**********************************************************************/  #ifdef L_toupper_l  #undef toupper_l -#undef __toupper_l - -int __toupper_l(int c, __locale_t l) +int toupper_l(int c, __locale_t l)  {  #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)  	assert(CTYPE_DOMAIN_CHECK(c)); @@ -342,7 +345,8 @@ int __toupper_l(int c, __locale_t l)  	return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c;  } -weak_alias(__toupper_l, toupper_l) +libc_hidden_proto(toupper_l) +libc_hidden_def(toupper_l)  #endif  /**********************************************************************/ diff --git a/libc/misc/dirent/alphasort.c b/libc/misc/dirent/alphasort.c index feae021e6..ea45829d3 100644 --- a/libc/misc/dirent/alphasort.c +++ b/libc/misc/dirent/alphasort.c @@ -2,9 +2,11 @@  #include <string.h>  #include "dirstream.h" +libc_hidden_proto(strcmp) +  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 c6cfcdacf..2bba1fcc9 100644 --- a/libc/misc/dirent/alphasort64.c +++ b/libc/misc/dirent/alphasort64.c @@ -16,9 +16,10 @@  #include <string.h>  #include "dirstream.h" +libc_hidden_proto(strcmp)  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);  } diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c index 8066b5861..870414a87 100644 --- a/libc/misc/dirent/closedir.c +++ b/libc/misc/dirent/closedir.c @@ -4,7 +4,10 @@  #include <unistd.h>  #include "dirstream.h" -int attribute_hidden __closedir(DIR * dir) +libc_hidden_proto(closedir) +libc_hidden_proto(close) + +int closedir(DIR * dir)  {  	int fd; @@ -24,6 +27,6 @@ int attribute_hidden __closedir(DIR * dir)  	__pthread_mutex_unlock(&(dir->dd_lock));  	free(dir->dd_buf);  	free(dir); -	return __close(fd); +	return close(fd);  } -strong_alias(__closedir,closedir) +libc_hidden_def(closedir) diff --git a/libc/misc/dirent/dirfd.c b/libc/misc/dirent/dirfd.c index 48e955450..236614642 100644 --- a/libc/misc/dirent/dirfd.c +++ b/libc/misc/dirent/dirfd.c @@ -1,8 +1,14 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +  #include <dirent.h>  #include <errno.h>  #include "dirstream.h" -int attribute_hidden __dirfd(DIR * dir) +int dirfd(DIR * dir)  {  	if (!dir || dir->dd_fd == -1) {  		__set_errno(EBADF); @@ -11,4 +17,5 @@ int attribute_hidden __dirfd(DIR * dir)  	return dir->dd_fd;  } -strong_alias(__dirfd,dirfd) +libc_hidden_proto(dirfd) +libc_hidden_def(dirfd) diff --git a/libc/misc/dirent/dirstream.h b/libc/misc/dirent/dirstream.h index 15c70858f..713204c03 100644 --- a/libc/misc/dirent/dirstream.h +++ b/libc/misc/dirent/dirstream.h @@ -72,10 +72,10 @@ struct __dirstream {  extern ssize_t __getdents(int fd, char *buf, size_t count) attribute_hidden; -extern struct dirent *__readdir (DIR *__dirp) __nonnull ((1)) attribute_hidden; +libc_hidden_proto(readdir)  #ifdef __UCLIBC_HAS_LFS__  extern ssize_t __getdents64 (int fd, char *buf, size_t count) attribute_hidden; -extern struct dirent64 *__readdir64 (DIR *__dirp) __nonnull ((1)) attribute_hidden; +libc_hidden_proto(readdir64)  #endif  #endif /* dirent.h  */ diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index 82e7f364f..707bf45dc 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -7,32 +7,37 @@  #include <sys/stat.h>  #include "dirstream.h" +libc_hidden_proto(opendir) +libc_hidden_proto(open) +libc_hidden_proto(fcntl) +libc_hidden_proto(close) +libc_hidden_proto(stat)  /* opendir just makes an open() call - it return NULL if it fails   * (open sets errno), otherwise it returns a DIR * pointer.   */ -DIR attribute_hidden *__opendir(const char *name) +DIR *opendir(const char *name)  {  	int fd;  	struct stat statbuf;  	char *buf;  	DIR *ptr; -	if (__stat(name, &statbuf)) +	if (stat(name, &statbuf))  		return NULL;  	if (!S_ISDIR(statbuf.st_mode)) {  		__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>.  	 */ -	if (__fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) +	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 +50,7 @@ DIR attribute_hidden *__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; @@ -54,4 +59,4 @@ DIR attribute_hidden *__opendir(const char *name)  	__pthread_mutex_init(&(ptr->dd_lock), NULL);  	return ptr;  } -strong_alias(__opendir,opendir) +libc_hidden_def(opendir) diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c index 2d4ad4aeb..e26479c13 100644 --- a/libc/misc/dirent/readdir.c +++ b/libc/misc/dirent/readdir.c @@ -7,7 +7,9 @@  #include <dirent.h>  #include "dirstream.h" -struct dirent attribute_hidden *__readdir(DIR * dir) +libc_hidden_proto(readdir) + +struct dirent *readdir(DIR * dir)  {  	ssize_t bytes;  	struct dirent *de; @@ -46,4 +48,4 @@ all_done:  	__pthread_mutex_unlock(&(dir->dd_lock));  	return de;  } -strong_alias(__readdir,readdir) +libc_hidden_def(readdir) diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c index 177af3fc9..2134d19fe 100644 --- a/libc/misc/dirent/readdir64.c +++ b/libc/misc/dirent/readdir64.c @@ -20,7 +20,9 @@  #include <dirent.h>  #include "dirstream.h" -struct dirent64 attribute_hidden *__readdir64(DIR * dir) +libc_hidden_proto(readdir64) + +struct dirent64 *readdir64(DIR * dir)  {  	ssize_t bytes;  	struct dirent64 *de; @@ -60,4 +62,4 @@ all_done:  	return de;  } -strong_alias(__readdir64,readdir64) +libc_hidden_def(readdir64) diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c index 1cbaf3156..b8de4fa6f 100644 --- a/libc/misc/dirent/readdir64_r.c +++ b/libc/misc/dirent/readdir64_r.c @@ -19,6 +19,8 @@  #include <dirent.h>  #include "dirstream.h" +libc_hidden_proto(memcpy) +  int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)  {  	int ret; @@ -59,7 +61,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 25cb80b63..769352f0a 100644 --- a/libc/misc/dirent/readdir_r.c +++ b/libc/misc/dirent/readdir_r.c @@ -5,6 +5,8 @@  #include <dirent.h>  #include "dirstream.h" +libc_hidden_proto(memcpy) +  int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)  {  	int ret; @@ -45,7 +47,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/rewinddir.c b/libc/misc/dirent/rewinddir.c index 18d6547a8..ec89f17a7 100644 --- a/libc/misc/dirent/rewinddir.c +++ b/libc/misc/dirent/rewinddir.c @@ -3,6 +3,7 @@  #include <unistd.h>  #include "dirstream.h" +libc_hidden_proto(lseek)  /* rewinddir() just does an lseek(fd,0,0) - see close for comments */  void rewinddir(DIR * dir) @@ -12,7 +13,7 @@ void rewinddir(DIR * dir)  		return;  	}  	__pthread_mutex_lock(&(dir->dd_lock)); -	__lseek(dir->dd_fd, 0, SEEK_SET); +	lseek(dir->dd_fd, 0, SEEK_SET);  	dir->dd_nextoff = dir->dd_nextloc = dir->dd_size = 0;  	__pthread_mutex_unlock(&(dir->dd_lock));  } diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c index 72929fb57..41491baee 100644 --- a/libc/misc/dirent/scandir.c +++ b/libc/misc/dirent/scandir.c @@ -1,28 +1,8 @@ -/* Copyright (C) 1992-1998, 2000 Free Software Foundation, Inc. -   This file is part of the GNU C Library. - -   The GNU C Library is free software; you can redistribute it and/or -   modify it under the terms of the GNU Lesser General Public -   License as published by the Free Software Foundation; either -   version 2.1 of the License, or (at your option) any later version. - -   The GNU C Library 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 -   Lesser General Public License for more details. - -   You should have received a copy of the GNU Lesser General Public -   License along with the GNU C Library; if not, write to the Free -   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -   02111-1307 USA.   -   */ - -/* Modified for uClibc by Erik Andersen -   */ - -#define qsort __qsort -#define opendir __opendir -#define closedir __closedir +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */  #include <dirent.h>  #include <stdio.h> @@ -32,6 +12,12 @@  #include <sys/types.h>  #include "dirstream.h" +libc_hidden_proto(memcpy) +libc_hidden_proto(readdir) +libc_hidden_proto(opendir) +libc_hidden_proto(closedir) +libc_hidden_proto(qsort) +  int scandir(const char *dir, struct dirent ***namelist,   	int (*selector) (const struct dirent *),  	int (*compar) (const void *, const void *)) @@ -49,7 +35,7 @@ int scandir(const char *dir, struct dirent ***namelist,      __set_errno (0);      pos = 0; -    while ((current = __readdir (dp)) != NULL) +    while ((current = readdir (dp)) != NULL)  	if (selector == NULL || (*selector) (current))  	{  	    struct dirent *vnew; @@ -76,7 +62,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 e77b88d3c..44252b6f0 100644 --- a/libc/misc/dirent/scandir64.c +++ b/libc/misc/dirent/scandir64.c @@ -20,10 +20,6 @@  /* Modified for uClibc by Erik Andersen     */ -#define qsort __qsort -#define opendir __opendir -#define closedir __closedir -  #include <features.h>  #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64  @@ -47,6 +43,11 @@  #include <sys/types.h>  #include "dirstream.h" +libc_hidden_proto(memcpy) +libc_hidden_proto(opendir) +libc_hidden_proto(closedir) +libc_hidden_proto(qsort) +  int scandir64(const char *dir, struct dirent64 ***namelist,   	int (*selector) (const struct dirent64 *),  	int (*compar) (const void *, const void *)) @@ -64,7 +65,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist,      __set_errno (0);      pos = 0; -    while ((current = __readdir64 (dp)) != NULL) +    while ((current = readdir64 (dp)) != NULL)  	if (selector == NULL || (*selector) (current))  	{  	    struct dirent64 *vnew; @@ -91,7 +92,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/dirent/seekdir.c b/libc/misc/dirent/seekdir.c index 6e841291a..5aa848b2a 100644 --- a/libc/misc/dirent/seekdir.c +++ b/libc/misc/dirent/seekdir.c @@ -3,6 +3,8 @@  #include <unistd.h>  #include "dirstream.h" +libc_hidden_proto(lseek) +  void seekdir(DIR * dir, long int offset)  {  	if (!dir) { @@ -10,7 +12,7 @@ void seekdir(DIR * dir, long int offset)  		return;  	}  	__pthread_mutex_lock(&(dir->dd_lock)); -	dir->dd_nextoff = __lseek(dir->dd_fd, offset, SEEK_SET); +	dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);  	dir->dd_size = dir->dd_nextloc = 0;  	__pthread_mutex_unlock(&(dir->dd_lock));  } diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c index 43fe60cc6..f27a5e7e8 100644 --- a/libc/misc/error/err.c +++ b/libc/misc/error/err.c @@ -5,8 +5,6 @@   * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.   */ -#define vfprintf __vfprintf -  #define _GNU_SOURCE  #include <stdio.h>  #include <stdlib.h> @@ -22,6 +20,18 @@  #warning REMINDER: Deal with wide oriented stderr case.  #endif +libc_hidden_proto(vwarn) +libc_hidden_proto(vwarnx) +libc_hidden_proto(err) +libc_hidden_proto(verr) +libc_hidden_proto(verrx) + +libc_hidden_proto(fprintf) +libc_hidden_proto(vfprintf) +libc_hidden_proto(__xpg_strerror_r) +libc_hidden_proto(exit) +libc_hidden_proto(vfprintf) +  static void vwarn_work(const char *format, va_list args, int showerr)  {  	/*                         0123 45678 9 a b*/ @@ -34,7 +44,7 @@ static void vwarn_work(const char *format, va_list args, int showerr)  	f = fmt + 11;				/* At 11. */  	if (showerr) {  		f -= 4;					/* At 7. */ -		__xpg_strerror_r_internal(errno, buf, sizeof(buf)); +		__xpg_strerror_r(errno, buf, sizeof(buf));  	}  	__STDIO_AUTO_THREADLOCK(stderr); @@ -49,68 +59,68 @@ static void vwarn_work(const char *format, va_list args, int showerr)  	__STDIO_AUTO_THREADUNLOCK(stderr);  } -void attribute_hidden __vwarn(const char *format, va_list args) +void vwarn(const char *format, va_list args)  {  	vwarn_work(format, args, 1);  } -strong_alias(__vwarn,vwarn) +libc_hidden_def(vwarn)  void warn(const char *format, ...)  {  	va_list args;  	va_start(args, format); -	__vwarn(format, args); +	vwarn(format, args);  	va_end(args);  } -void attribute_hidden __vwarnx(const char *format, va_list args) +void vwarnx(const char *format, va_list args)  {  	vwarn_work(format, args, 0);  } -strong_alias(__vwarnx,vwarnx) +libc_hidden_def(vwarnx)  void warnx(const char *format, ...)  {  	va_list args;  	va_start(args, format); -	__vwarnx(format, args); +	vwarnx(format, args);  	va_end(args);  } -void attribute_hidden __verr(int status, const char *format, va_list args) +void verr(int status, const char *format, va_list args)  { -	__vwarn(format, args); -	__exit(status); +	vwarn(format, args); +	exit(status);  } -strong_alias(__verr,verr) +libc_hidden_def(verr)  void attribute_noreturn err(int status, const char *format, ...)  {  	va_list args;  	va_start(args, format); -	__verr(status, format, args); +	verr(status, format, args);  	/* This should get optimized away.  We'll leave it now for safety. */  	/* The loop is added only to keep gcc happy. */  	while(1)  		va_end(args);  } -void attribute_hidden __verrx(int status, const char *format, va_list args) +void verrx(int status, const char *format, va_list args)  { -	__vwarnx(format, args); -	__exit(status); +	vwarnx(format, args); +	exit(status);  } -strong_alias(__verrx,verrx) +libc_hidden_def(verrx)  void attribute_noreturn errx(int status, const char *format, ...)  {  	va_list args;  	va_start(args, format); -	__verrx(status, format, args); +	verrx(status, format, args);  	/* This should get optimized away.  We'll leave it now for safety. */  	/* The loop is added only to keep gcc happy. */  	while(1) diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index 60605c212..1c2585345 100644 --- a/libc/misc/error/error.c +++ b/libc/misc/error/error.c @@ -22,17 +22,21 @@  /* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */  /* Adjusted slightly by Erik Andersen <andersen@uclibc.org> */ -#define strerror __strerror -#define vfprintf __vfprintf -#define fflush __fflush -  #include <stdio.h>  #include <stdarg.h>  #include <stdlib.h>  #include <string.h>  #include "error.h" -extern int __putc(int c, FILE *stream) attribute_hidden; +libc_hidden_proto(strcmp) +libc_hidden_proto(strerror) +libc_hidden_proto(fprintf) +libc_hidden_proto(exit) +libc_hidden_proto(putc) +libc_hidden_proto(vfprintf) +libc_hidden_proto(fflush) +libc_hidden_proto(fputc) +libc_hidden_proto(__fputc_unlocked)  /* This variable is incremented each time `error' is called.  */  unsigned int error_message_count = 0; @@ -59,9 +63,9 @@ void __error (int status, int errnum, const char *message, ...)      if (errnum) {  	fprintf (stderr, ": %s", strerror (errnum));      } -    __putc ('\n', stderr); +    putc ('\n', stderr);      if (status) -	__exit (status); +	exit (status);  }  void __error_at_line (int status, int errnum, const char *file_name, @@ -74,7 +78,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; @@ -95,9 +99,9 @@ void __error_at_line (int status, int errnum, const char *file_name,      if (errnum) {  	fprintf (stderr, ": %s", strerror (errnum));      } -    __putc ('\n', stderr); +    putc ('\n', stderr);      if (status) -	__exit (status); +	exit (status);  }  /* Use the weaks here in an effort at controlling namespace pollution */ diff --git a/libc/misc/file/lockf.c b/libc/misc/file/lockf.c index 2ba81de9a..6c1184be2 100644 --- a/libc/misc/file/lockf.c +++ b/libc/misc/file/lockf.c @@ -17,7 +17,6 @@     Boston, MA 02111-1307, USA.  */  #include <features.h> -#undef __lockf  #include <sys/types.h>  #include <unistd.h> @@ -25,14 +24,19 @@  #include <errno.h>  #include <string.h> +libc_hidden_proto(lockf) + +libc_hidden_proto(memset) +libc_hidden_proto(fcntl) +libc_hidden_proto(getpid) +  /* lockf is a simplified interface to fcntl's locking facilities.  */ -#undef lockf -int attribute_hidden __lockf (int fd, int cmd, off_t len) +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; @@ -45,9 +49,9 @@ int attribute_hidden __lockf (int fd, int cmd, off_t len)  	    /* Test the lock: return 0 if FD is unlocked or locked by this process;  	       return -1, set errno to EACCES, if another process holds the lock.  */  	    fl.l_type = F_RDLCK; -	    if (__fcntl (fd, F_GETLK, &fl) < 0) +	    if (fcntl (fd, F_GETLK, &fl) < 0)  		return -1; -	    if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) +	    if (fl.l_type == F_UNLCK || fl.l_pid == getpid ())  		return 0;  	    __set_errno(EACCES);  	    return -1; @@ -70,6 +74,6 @@ int attribute_hidden __lockf (int fd, int cmd, off_t len)  	    return -1;      } -    return __fcntl(fd, cmd, &fl); +    return fcntl(fd, cmd, &fl);  } -strong_alias(__lockf,lockf) +libc_hidden_def(lockf) diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c index 1e294d9a6..be5fc6c07 100644 --- a/libc/misc/file/lockf64.c +++ b/libc/misc/file/lockf64.c @@ -17,7 +17,6 @@     Boston, MA 02111-1307, USA.  */  #include <features.h> -#undef __lockf64  #ifdef __UCLIBC_HAS_LFS__  #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64  @@ -43,17 +42,20 @@  #ifdef __NR_fcntl64  #define flock flock64 -#define fcntl __fcntl64 +#define fcntl fcntl64  #define F_GETLK F_GETLK64  #define F_SETLK F_SETLK64 -#else -#define fcntl __fcntl  #endif +libc_hidden_proto(lockf64) + +libc_hidden_proto(memset) +libc_hidden_proto(fcntl) +libc_hidden_proto(getpid) +  /* lockf is a simplified interface to fcntl's locking facilities.  */ -#undef lockf64 -int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) +int lockf64 (int fd, int cmd, off64_t len64)  {      struct flock fl;      off_t len = (off_t) len64; @@ -65,7 +67,7 @@ int attribute_hidden __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; @@ -80,7 +82,7 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64)  	    fl.l_type = F_RDLCK;  	    if (fcntl (fd, F_GETLK, &fl) < 0)  		return -1; -	    if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) +	    if (fl.l_type == F_UNLCK || fl.l_pid == getpid ())  		return 0;  	    __set_errno(EACCES);  	    return -1; @@ -105,5 +107,4 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64)      return fcntl(fd, cmd, &fl);  } - -strong_alias(__lockf64,lockf64) +libc_hidden_def(lockf64) diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c index d5d3e753b..dc18c2f59 100644 --- a/libc/misc/fnmatch/fnmatch.c +++ b/libc/misc/fnmatch/fnmatch.c @@ -17,8 +17,6 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ -#define strcmp __strcmp -  #if HAVE_CONFIG_H  # include <config.h>  #endif @@ -34,11 +32,6 @@  # define HAVE_STRING_H 1  # define STDC_HEADERS  # define HAVE___STRCHRNUL 1 -extern void *__mempcpy (void *__restrict __dest, -			__const void *__restrict __src, size_t __n) -     __THROW __nonnull ((1, 2)) attribute_hidden; -extern void *__memchr (__const void *__s, int __c, size_t __n) -      __THROW __attribute_pure__ __nonnull ((1)) attribute_hidden;  # ifdef __UCLIBC_HAS_WCHAR__  #  define HAVE_WCHAR_H 1  #  define HAVE_WCTYPE_H 1 @@ -64,6 +57,22 @@ extern void *__memchr (__const void *__s, int __c, size_t __n)  # include <stdlib.h>  #endif +#ifdef __UCLIBC__ +#define __memset memset +libc_hidden_proto(memchr) +libc_hidden_proto(memset) +libc_hidden_proto(mempcpy) +libc_hidden_proto(strcat) +libc_hidden_proto(strcmp) +/*libc_hidden_proto(strchr)*/ +/*libc_hidden_proto(strchrnul)*/ +libc_hidden_proto(strlen) +libc_hidden_proto(strcoll) +libc_hidden_proto(tolower) +libc_hidden_proto(fnmatch) +libc_hidden_proto(getenv) +#endif +  /* For platform which support the ISO C amendement 1 functionality we     support user defined character classes.  */  #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) @@ -71,24 +80,20 @@ extern void *__memchr (__const void *__s, int __c, size_t __n)  # include <wchar.h>  # include <wctype.h>  # ifdef __UCLIBC__ -extern wctype_t __wctype (__const char *__property) __THROW attribute_hidden; -extern int __iswctype (wint_t __wc, wctype_t __desc) __THROW attribute_hidden; -extern wint_t __btowc (int __c) __THROW attribute_hidden; +libc_hidden_proto(wctype) +libc_hidden_proto(iswctype) +libc_hidden_proto(btowc)  #  ifdef __UCLIBC_HAS_LOCALE__ -extern size_t __mbsrtowcs (wchar_t *__restrict __dst, -			 __const char **__restrict __src, size_t __len, -			 mbstate_t *__restrict __ps) __THROW attribute_hidden; -extern size_t __wcslen (__const wchar_t *__s) __THROW __attribute_pure__ attribute_hidden; -extern wchar_t *__wmempcpy (wchar_t *__restrict __s1, -			  __const wchar_t *__restrict __s2, size_t __n) -     __THROW attribute_hidden; -extern wchar_t *__wcscat (wchar_t *__restrict __dest, -			__const wchar_t *__restrict __src) __THROW attribute_hidden; -extern size_t __strnlen (__const char *__string, size_t __maxlen) -     __THROW __attribute_pure__ __nonnull ((1)) attribute_hidden; -extern wchar_t *__wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n) -     __THROW __attribute_pure__ attribute_hidden; -extern wint_t __towlower (wint_t __wc) __THROW attribute_hidden; +libc_hidden_proto(wmemchr) +libc_hidden_proto(wmempcpy) +libc_hidden_proto(wcscat) +/*libc_hidden_proto(wcschr)*/ +/*libc_hidden_proto(wcschrnul)*/ +libc_hidden_proto(wcslen) +libc_hidden_proto(wcscoll) +libc_hidden_proto(towlower) +libc_hidden_proto(mbsrtowcs) +libc_hidden_proto(strnlen)  #  endif  # endif  #endif @@ -96,21 +101,22 @@ extern wint_t __towlower (wint_t __wc) __THROW attribute_hidden;  /* We need some of the locale data (the collation sequence information)     but there is no interface to get this information in general.  Therefore     we support a correct implementation only in glibc.  */ -#if defined _LIBC || defined __UCLIBC__ -# ifndef __UCLIBC__ +#if defined _LIBC  # include "../locale/localeinfo.h"  # include "../locale/elem-hash.h"  # include "../locale/coll-lookup.h"  # include <shlib-compat.h> -# endif  # define CONCAT(a,b) __CONCAT(a,b) -# if defined _LIBC || defined __UCLIBC_HAS_LOCALE__ +# if defined _LIBC  # define mbsrtowcs __mbsrtowcs  # endif  # define fnmatch __fnmatch  extern int fnmatch (const char *pattern, const char *string, int flags) attribute_hidden;  #endif +#ifdef __UCLIBC__ +# define CONCAT(a,b) __CONCAT(a,b) +#endif  /* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set.  */  #define NO_LEADING_PERIOD(flags) \ @@ -168,13 +174,13 @@ extern int fnmatch (const char *pattern, const char *string, int flags) attribut  #   define CHAR_CLASS_MAX_LENGTH 256  #  endif -#  if defined _LIBC || defined __UCLIBC__ +#  if defined _LIBC  #   define IS_CHAR_CLASS(string) __wctype (string)  #  else  #   define IS_CHAR_CLASS(string) wctype (string)  #  endif -#  if defined _LIBC || defined __UCLIBC__ +#  if defined _LIBC  #   define ISWCTYPE(WC, WT)	__iswctype (WC, WT)  #  else  #   define ISWCTYPE(WC, WT)	iswctype (WC, WT) @@ -246,7 +252,7 @@ __wcschrnul (s, c)  # endif  /* Note that this evaluates C many times.  */ -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC  #  define FOLD(c) ((flags & FNM_CASEFOLD) ? __tolower (c) : (c))  # else  #  define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) @@ -258,22 +264,22 @@ __wcschrnul (s, c)  # define EXT	ext_match  # define END	end_pattern  # define L(CS)	CS -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC  #  define BTOWC(C)	__btowc (C)  # else  #  define BTOWC(C)	btowc (C)  # endif -# define STRLEN(S) __strlen (S) -# define STRCAT(D, S) __strcat (D, S) -# define MEMPCPY(D, S, N) __mempcpy (D, S, N) -# define MEMCHR(S, C, N) __memchr (S, C, N) -# define STRCOLL(S1, S2) __strcoll (S1, S2) +# define STRLEN(S) strlen (S) +# define STRCAT(D, S) strcat (D, S) +# define MEMPCPY(D, S, N) mempcpy (D, S, N) +# define MEMCHR(S, C, N) memchr (S, C, N) +# define STRCOLL(S1, S2) strcoll (S1, S2)  # include "fnmatch_loop.c"  # if HANDLE_MULTIBYTE  /* Note that this evaluates C many times.  */ -#  if defined _LIBC || defined __UCLIBC__ +#  if defined _LIBC  #   define FOLD(c) ((flags & FNM_CASEFOLD) ? __towlower (c) : (c))  #  else  #   define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? towlower (c) : (c)) @@ -286,11 +292,11 @@ __wcschrnul (s, c)  # define END	end_wpattern  #  define L(CS)	L##CS  #  define BTOWC(C)	(C) -#  define STRLEN(S) __wcslen (S) -#  define STRCAT(D, S) __wcscat (D, S) -#  define MEMPCPY(D, S, N) __wmempcpy (D, S, N) -#  define MEMCHR(S, C, N) __wmemchr (S, C, N) -#  define STRCOLL(S1, S2) __wcscoll (S1, S2) +#  define STRLEN(S) wcslen (S) +#  define STRCAT(D, S) wcscat (D, S) +#  define MEMPCPY(D, S, N) wmempcpy (D, S, N) +#  define MEMCHR(S, C, N) wmemchr (S, C, N) +#  define STRCOLL(S1, S2) wcscoll (S1, S2)  #  ifndef __UCLIBC__  #  define WIDE_CHAR_VERSION 1  #  endif @@ -354,7 +360,7 @@ is_char_class (const wchar_t *wcs)    *cp = '\0'; -#  if defined _LIBC || defined __UCLIBC__ +#  if defined _LIBC    return __wctype (s);  #  else    return wctype (s); @@ -365,15 +371,16 @@ is_char_class (const wchar_t *wcs)  #  include "fnmatch_loop.c"  # endif +extern size_t _stdlib_mb_cur_max (void) __THROW __wur; +libc_hidden_proto(_stdlib_mb_cur_max) -int attribute_hidden +int  fnmatch (const char *pattern, const char *string, int flags)  {  # if HANDLE_MULTIBYTE  #  ifdef __UCLIBC_HAS_WCHAR__  #   undef MB_CUR_MAX -#   define	MB_CUR_MAX	(_stdlib_mb_cur_max_internal ()) -extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden; +#   define	MB_CUR_MAX	(_stdlib_mb_cur_max ())  #  endif    if (__builtin_expect (MB_CUR_MAX, 1) != 1)      { @@ -387,9 +394,9 @@ extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden;        __memset (&ps, '\0', sizeof (ps));        p = pattern;  #if defined _LIBC || defined __UCLIBC__ -      n = __strnlen (pattern, 1024); +      n = strnlen (pattern, 1024);  #else -      n = __strlen (pattern); +      n = strlen (pattern);  #endif        if (__builtin_expect (n < 1024, 1))  	{ @@ -418,9 +425,9 @@ extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden;        assert (mbsinit (&ps));  #if defined _LIBC || defined __UCLIBC__ -      n = __strnlen (string, 1024); +      n = strnlen (string, 1024);  #else -      n = __strlen (string); +      n = strlen (string);  #endif        p = string;        if (__builtin_expect (n < 1024, 1)) @@ -453,11 +460,11 @@ extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden;      }  # endif  /* mbstate_t and mbsrtowcs or _LIBC.  */ -  return internal_fnmatch (pattern, string, string + __strlen (string), +  return internal_fnmatch (pattern, string, string + strlen (string),  			   flags & FNM_PERIOD, flags);  } -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC  #  undef fnmatch  #  ifndef __UCLIBC__  versioned_symbol (libc, __fnmatch, fnmatch, GLIBC_2_2_3); @@ -466,9 +473,10 @@ strong_alias (__fnmatch, __fnmatch_old)  compat_symbol (libc, __fnmatch_old, fnmatch, GLIBC_2_0);  #  endif  libc_hidden_ver (__fnmatch, fnmatch) -#  else -strong_alias(__fnmatch,fnmatch)  #  endif +# else +libc_hidden_proto(fnmatch) +libc_hidden_def(fnmatch)  # endif  #endif	/* _LIBC or not __GNU_LIBRARY__.  */ diff --git a/libc/misc/fnmatch/fnmatch_loop.c b/libc/misc/fnmatch/fnmatch_loop.c index 663af1222..191cef50c 100644 --- a/libc/misc/fnmatch/fnmatch_loop.c +++ b/libc/misc/fnmatch/fnmatch_loop.c @@ -214,7 +214,7 @@ FCT (pattern, string, string_end, no_leading_period, flags)  	    UCHAR fn;  	    if (posixly_correct == 0) -	      posixly_correct = __getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; +	      posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;  	    if (n == string_end)  	      return FNM_NOMATCH; @@ -993,7 +993,7 @@ END (const CHAR *pattern)        {  	/* Handle brackets special.  */  	if (posixly_correct == 0) -	  posixly_correct = __getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; +	  posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;  	/* Skip the not sign.  We have to recognize it because of a possibly  	   following ']'.  */ @@ -1045,7 +1045,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,        {  	/* Handle brackets special.  */  	if (posixly_correct == 0) -	  posixly_correct = __getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; +	  posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;  	/* Skip the not sign.  We have to recognize it because of a possibly  	   following ']'.  */ diff --git a/libc/misc/fnmatch/fnmatch_old.c b/libc/misc/fnmatch/fnmatch_old.c index 2762b3930..47075e914 100644 --- a/libc/misc/fnmatch/fnmatch_old.c +++ b/libc/misc/fnmatch/fnmatch_old.c @@ -28,6 +28,9 @@ Cambridge, MA 02139, USA.  */  #include <fnmatch.h>  #include <ctype.h> +libc_hidden_proto(fnmatch) + +libc_hidden_proto(tolower)  /* Comment out all this code if we are using the GNU C Library, and are not     actually compiling the library itself.  This code is part of the GNU C     Library, but also included in many other GNU distributions.  Compiling @@ -50,13 +53,13 @@ Cambridge, MA 02139, USA.  */  /* Match STRING against the filename pattern PATTERN, returning zero if     it matches, nonzero if not.  */ -int attribute_hidden __fnmatch(const char *pattern, const char *string, int flags) +int fnmatch(const char *pattern, const char *string, int flags)  {  	register const char *p = pattern, *n = string;  	register char c;  /* Note that this evaluates C many times.  */ -# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? __tolower (c) : (c)) +# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))  	while ((c = *p++) != '\0') {  		c = FOLD(c); @@ -116,7 +119,7 @@ int attribute_hidden __fnmatch(const char *pattern, const char *string, int flag  				c1 = FOLD(c1);  				for (--p; *n != '\0'; ++n)  					if ((c == '[' || FOLD(*n) == c1) && -						__fnmatch(p, n, flags & ~FNM_PERIOD) == 0) +						fnmatch(p, n, flags & ~FNM_PERIOD) == 0)  						return 0;  				return FNM_NOMATCH;  			} @@ -220,5 +223,5 @@ int attribute_hidden __fnmatch(const char *pattern, const char *string, int flag  # undef FOLD  } -strong_alias(__fnmatch,fnmatch) +libc_hidden_def(fnmatch)  #endif							/* _LIBC or not __GNU_LIBRARY__.  */ diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index fdea1c208..b2c0c4ee4 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -31,17 +31,6 @@  #define HAVE_SYS_PARAM_H 1  #define HAVE_DECL_STPCPY 1  #define HAVE_MEMPCPY 1 -#define dirfd __dirfd -#define tsearch __tsearch -#define tfind __tfind -#define tdestroy __tdestroy -#define getcwd __getcwd -#define chdir __chdir -#define fchdir __fchdir -#define mempcpy __mempcpy -#define opendir __opendir -#define closedir __closedir -#define stpcpy __stpcpy  #endif  #if __GNUC__ @@ -64,7 +53,7 @@ char *alloca ();  #else  # if HAVE_DIRENT_H  #  include <dirent.h> -#  define NAMLEN(dirent) __strlen ((dirent)->d_name) +#  define NAMLEN(dirent) strlen ((dirent)->d_name)  # else  #  define dirent direct  #  define NAMLEN(dirent) (dirent)->d_namlen @@ -96,6 +85,28 @@ char *alloca ();  # include <sys/stat.h>  #endif +libc_hidden_proto(memset) +libc_hidden_proto(strchr) +libc_hidden_proto(strlen) +libc_hidden_proto(dirfd) +libc_hidden_proto(tsearch) +libc_hidden_proto(tfind) +libc_hidden_proto(tdestroy) +libc_hidden_proto(getcwd) +libc_hidden_proto(chdir) +libc_hidden_proto(fchdir) +libc_hidden_proto(mempcpy) +libc_hidden_proto(opendir) +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(readdir64) +libc_hidden_proto(lstat64) +libc_hidden_proto(stat64) +#endif +libc_hidden_proto(closedir) +libc_hidden_proto(stpcpy) +libc_hidden_proto(lstat) +libc_hidden_proto(stat) +  #if ! _LIBC && !HAVE_DECL_STPCPY && !defined stpcpy  char *stpcpy ();  #endif @@ -108,24 +119,30 @@ char *stpcpy ();  /* #define NDEBUG 1 */  #include <assert.h> -#if !defined _LIBC && !defined __UCLIBC__ +#if !defined _LIBC  # undef __chdir  # define __chdir chdir  # undef __closedir  # define __closedir closedir  # undef __fchdir  # define __fchdir fchdir -# ifndef __UCLIBC__  # undef __getcwd +# ifndef __UCLIBC__  # define __getcwd(P, N) xgetcwd ()  extern char *xgetcwd (void); +# else +# define __getcwd getcwd  # endif  # undef __mempcpy  # define __mempcpy mempcpy  # undef __opendir  # define __opendir opendir  # undef __readdir64 +# ifndef __UCLIBC_HAS_LFS__  # define __readdir64 readdir +# else +# define __readdir64 readdir64 +# endif  # undef __stpcpy  # define __stpcpy stpcpy  # undef __tdestroy @@ -136,8 +153,10 @@ extern char *xgetcwd (void);  # define __tsearch tsearch  # undef internal_function  # define internal_function /* empty */ +# ifndef __UCLIBC_HAS_LFS__  # undef dirent64  # define dirent64 dirent +# endif  # undef MAX  # define MAX(a, b) ((a) > (b) ? (a) : (b))  #endif @@ -167,21 +186,11 @@ int rpl_lstat (const char *, struct stat *);  #  define LXSTAT __lxstat  #  define XSTAT __xstat  # else -#  ifdef __UCLIBC__ -#    define LXSTAT(V,f,sb) __lstat(f,sb) -#    define XSTAT(V,f,sb) __stat(f,sb) -#    define __readdir64 __readdir -#    define dirent64 dirent -#  else  #  define LXSTAT(V,f,sb) lstat (f,sb)  #  define XSTAT(V,f,sb) stat (f,sb) -#  endif  # endif  # define FTW_FUNC_T __ftw_func_t  # define NFTW_FUNC_T __nftw_func_t -extern struct dirent *__readdir (DIR *__dirp) __nonnull ((1)) attribute_hidden; -# else -extern struct dirent64 *__readdir64 (DIR *__dirp) __nonnull ((1)) attribute_hidden;  #endif  /* We define PATH_MAX if the system does not provide a definition. @@ -520,7 +529,7 @@ fail:    /* 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] != '/') @@ -556,7 +565,7 @@ fail:        while (result == 0 && *runp != '\0')  	{ -	  char *endp = __strchr (runp, '\0'); +	  char *endp = strchr (runp, '\0');  	  result = process_entry (data, &dir, runp, endp - runp); @@ -633,10 +642,10 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,    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/ftw/ftw64.c b/libc/misc/ftw/ftw64.c index c4edd4d0a..de2fe22d1 100644 --- a/libc/misc/ftw/ftw64.c +++ b/libc/misc/ftw/ftw64.c @@ -24,8 +24,8 @@  #define NFTW_NEW_NAME __new_nftw64  #define INO_T ino64_t  #define STAT stat64 -#define LXSTAT(V,f,sb) __lstat64(f,sb) -#define XSTAT(V,f,sb) __stat64(f,sb) +#define LXSTAT(V,f,sb) lstat64(f,sb) +#define XSTAT(V,f,sb) stat64(f,sb)  #define FTW_FUNC_T __ftw64_func_t  #define NFTW_FUNC_T __nftw64_func_t diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index ea87d371c..d55a649ab 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -15,11 +15,6 @@ 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 -#define qsort __qsort -#define fnmatch __fnmatch -  #include <features.h>  #include <stdlib.h>  #include <string.h> @@ -33,8 +28,17 @@ Cambridge, MA 02139, USA.  */  #define _GNU_SOURCE  #include <glob.h> -extern DIR *__opendir (__const char *__name) __nonnull ((1)) attribute_hidden; -extern int __closedir (DIR *__dirp) __nonnull ((1)) attribute_hidden; +libc_hidden_proto(memcpy) +libc_hidden_proto(strcat) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(strrchr) +libc_hidden_proto(strcoll) +libc_hidden_proto(opendir) +libc_hidden_proto(closedir) +libc_hidden_proto(fnmatch) +libc_hidden_proto(qsort) +libc_hidden_proto(lstat)  extern __ptr_t (*__glob_opendir_hook) __P ((const char *directory));  extern void (*__glob_closedir_hook) __P ((__ptr_t stream)); @@ -51,12 +55,15 @@ static int collated_compare __P ((const __ptr_t, const __ptr_t));  #ifdef __GLOB64  extern int __glob_pattern_p(const char *pattern, int quote) attribute_hidden; +libc_hidden_proto(readdir64) +#define __readdir readdir64  #else -extern struct dirent *__readdir (DIR *__dirp) __nonnull ((1)) attribute_hidden;  extern int __glob (__const char *__restrict __pattern, int __flags,  		 int (*__errfunc) (__const char *, int),  		 glob_t *__restrict __pglob) __THROW attribute_hidden;  extern void __globfree (glob_t *__pglob) __THROW attribute_hidden; +#define __readdir readdir +libc_hidden_proto(readdir)  /* Return nonzero if PATTERN contains any metacharacters.     Metacharacters can be quoted with backslashes if QUOTE is nonzero.  */  int attribute_hidden __glob_pattern_p(const char *pattern, int quote) @@ -138,7 +145,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;      } @@ -230,11 +237,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, @@ -290,9 +297,9 @@ __glob (pattern, flags, errfunc, pglob)        int i;        struct stat st;        for (i = oldcount; i < pglob->gl_pathc; ++i) -	if (__lstat (pglob->gl_pathv[i], &st) == 0 && +	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)) @@ -364,7 +371,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". @@ -373,7 +380,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)  	{ @@ -382,9 +389,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;      } @@ -417,7 +424,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)    int meta;    stream = (__glob_opendir_hook ? (*__glob_opendir_hook) (directory) -	   : (__ptr_t) __opendir (directory)); +	   : (__ptr_t) opendir (directory));    if (stream == NULL)      {        if ((errfunc != NULL && (*errfunc) (directory, errno)) || @@ -457,7 +464,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) @@ -465,12 +472,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; @@ -482,14 +489,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';      } @@ -517,7 +524,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)      if (__glob_closedir_hook)        (*__glob_closedir_hook) (stream);      else -      (void) __closedir ((DIR *) stream); +      (void) closedir ((DIR *) stream);      errno = save;    }    return nfound == 0 ? GLOB_NOMATCH : 0; @@ -528,7 +535,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)      if (__glob_closedir_hook)        (*__glob_closedir_hook) (stream);      else -      (void) __closedir ((DIR *) stream); +      (void) closedir ((DIR *) stream);      errno = save;    }    while (names != NULL) diff --git a/libc/misc/glob/glob64.c b/libc/misc/glob/glob64.c index f0c65abe0..5baf86810 100644 --- a/libc/misc/glob/glob64.c +++ b/libc/misc/glob/glob64.c @@ -18,15 +18,13 @@  #include <glob.h>  #include <sys/stat.h> -extern struct dirent64 *__readdir64 (DIR *__dirp) __nonnull ((1)) attribute_hidden; +  extern int __glob64 (__const char *__restrict __pattern, int __flags,  		   int (*__errfunc) (__const char *, int),  		   glob64_t *__restrict __pglob) __THROW attribute_hidden;  extern void __globfree (glob_t *__pglob) __THROW attribute_hidden;  extern void __globfree64 (glob64_t *__pglob) __THROW attribute_hidden; -  #define dirent dirent64 -#define __readdir(dirp) __readdir64(dirp)  #define glob_t glob64_t  #define __glob(pattern, flags, errfunc, pglob) \ @@ -38,7 +36,7 @@ extern void __globfree64 (glob64_t *__pglob) __THROW attribute_hidden;  #undef stat  #define stat stat64 -#define __lstat __lstat64 +#define lstat lstat64  #define __GLOB64    1 diff --git a/libc/misc/gnu/obstack.c b/libc/misc/gnu/obstack.c index 6521bd1d4..5fc031555 100644 --- a/libc/misc/gnu/obstack.c +++ b/libc/misc/gnu/obstack.c @@ -51,7 +51,7 @@  # endif  #endif -#if defined _LIBC && defined USE_IN_LIBIO +#if (defined _LIBC && defined USE_IN_LIBIO) || defined __UCLIBC_HAS_WCHAR__  # include <wchar.h>  #endif @@ -105,6 +105,14 @@ void (*obstack_alloc_failed_handler) () = print_and_abort;  # ifndef EXIT_FAILURE  #  define EXIT_FAILURE 1  # endif + +libc_hidden_proto(fprintf) +libc_hidden_proto(abort) +libc_hidden_proto(exit) +#ifdef __UCLIBC_HAS_WCHAR__ +libc_hidden_proto(fwprintf) +#endif +  int obstack_exit_failure = EXIT_FAILURE;  /* The non-GNU-C macros copy the obstack into this global variable @@ -480,15 +488,8 @@ _obstack_memory_used (h)  #  define fputs(s, f) _IO_fputs (s, f)  # endif -# ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later.  */ -#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -#   define __attribute__(Spec) /* empty */ -#  endif -# endif -  static void -__attribute__ ((noreturn)) +attribute_noreturn  print_and_abort ()  {    /* Don't change any of these strings.  Yes, it would be possible to add @@ -498,11 +499,11 @@ print_and_abort ()       a very similar string which requires a separate translation.  */  # if defined _LIBC && defined USE_IN_LIBIO    if (_IO_fwide (stderr, 0) > 0) -    __fwprintf (stderr, L"%s\n", _("memory exhausted")); +    fwprintf (stderr, L"%s\n", _("memory exhausted"));    else  # endif      fprintf (stderr, "%s\n", _("memory exhausted")); -  __exit (obstack_exit_failure); +  exit (obstack_exit_failure);  }  # if 0 diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 414342c79..9987324b2 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -13,11 +13,6 @@   * avoided in the static library case.   */ -#define getgid __getgid -#define getuid __getuid -#define getegid __getegid -#define geteuid __geteuid -  #define	_ERRNO_H  #include <features.h>  #include <unistd.h> @@ -33,6 +28,21 @@  #include <sys/stat.h>  #include <sys/sysmacros.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(strrchr) +libc_hidden_proto(getgid) +libc_hidden_proto(getuid) +libc_hidden_proto(getegid) +libc_hidden_proto(geteuid) +libc_hidden_proto(fstat) +libc_hidden_proto(abort) +libc_hidden_proto(exit) + +extern int __libc_open (__const char *__file, int __oflag, ...) __nonnull ((1)); +libc_hidden_proto(__libc_open) +extern int __libc_fcntl (int __fd, int __cmd, ...); +libc_hidden_proto(__libc_fcntl) +  #ifndef SHARED  void *__libc_stack_end=NULL; @@ -84,7 +94,8 @@ weak_alias(__environ, environ)  /* TODO: don't export __pagesize; we cant now because libpthread uses it */  size_t __pagesize = 0; -hidden_strong_alias(__pagesize,__pagesize_internal) +libc_hidden_proto(__pagesize) +libc_hidden_def(__pagesize)  #ifndef O_NOFOLLOW  # define O_NOFOLLOW	0 @@ -95,18 +106,17 @@ hidden_strong_alias(__pagesize,__pagesize_internal)  static void __check_one_fd(int fd, int mode)  {      /* Check if the specified fd is already open */ -    if (unlikely(__fcntl(fd, F_GETFD)==-1 && *(__errno_location())==EBADF)) +    if (unlikely(__libc_fcntl(fd, F_GETFD)==-1 && *(__errno_location())==EBADF))      {  	/* The descriptor is probably not open, so try to use /dev/null */  	struct stat st; -	int nullfd = __open(_PATH_DEVNULL, mode); +	int nullfd = __libc_open(_PATH_DEVNULL, mode);  	/* /dev/null is major=1 minor=3.  Make absolutely certain  	 * that is in fact the device that we have opened and not  	 * some other wierd file... */ -	if ( (nullfd!=fd) || __fstat(fd, &st) || !S_ISCHR(st.st_mode) || +	if ( (nullfd!=fd) || fstat(fd, &st) || !S_ISCHR(st.st_mode) ||  		(st.st_rdev != makedev(1, 3)))  	{ -	    /* Somebody is trying some trickery here... */  		abort();  	}      } @@ -152,7 +162,7 @@ void __uClibc_init(void)      /* Setup an initial value.  This may not be perfect, but is       * better than  malloc using __pagesize=0 for atexit, ctors, etc.  */ -    __pagesize_internal = PAGE_SIZE; +    __pagesize = PAGE_SIZE;  #ifdef __UCLIBC_HAS_THREADS__      /* Before we start initializing uClibc we have to call @@ -189,7 +199,8 @@ void __uClibc_init(void)  	_stdio_init();  } -hidden_strong_alias(__uClibc_init,__uClibc_init_internal) +libc_hidden_proto(__uClibc_init) +libc_hidden_def(__uClibc_init)  #ifdef __UCLIBC_CTOR_DTOR__  void attribute_hidden (*__app_fini)(void) = NULL; @@ -237,7 +248,7 @@ __uClibc_main(int (*main)(int, char **, char **), int argc,      while (*aux_dat) {  	ElfW(auxv_t) *auxv_entry = (ElfW(auxv_t) *) aux_dat;  	if (auxv_entry->a_type <= AT_EGID) { -	    __memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t))); +	    memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t)));  	}  	aux_dat += 2;      } @@ -246,11 +257,11 @@ __uClibc_main(int (*main)(int, char **, char **), int argc,      /* We need to initialize uClibc.  If we are dynamically linked this       * may have already been completed by the shared lib loader.  We call       * __uClibc_init() regardless, to be sure the right thing happens. */ -    __uClibc_init_internal(); +    __uClibc_init();  #ifdef __ARCH_HAS_MMU__      /* Make certain getpagesize() gives the correct answer */ -    __pagesize_internal = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; +    __pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;      /* Prevent starting SUID binaries where the stdin. stdout, and       * stderr file descriptors are not already opened. */ @@ -267,7 +278,7 @@ __uClibc_main(int (*main)(int, char **, char **), int argc,  #ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__      __progname_full = *argv; -    __progname = __strrchr(*argv, '/'); +    __progname = strrchr(*argv, '/');      if (__progname != NULL)  	++__progname;      else @@ -300,5 +311,5 @@ __uClibc_main(int (*main)(int, char **, char **), int argc,      /*       * Finally, invoke application's main and then exit.       */ -    __exit(main(argc, argv, __environ)); +    exit(main(argc, argv, __environ));  } diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 64fa1e14b..b8b421f13 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -31,10 +31,6 @@   * Use brain damaged getpid() if real random fails.   */ -#define open64 __open64 -#define mkdir __mkdir -#define gettimeofday __gettimeofday -  #include <stddef.h>  #include <stdint.h>  #include <stdio.h> @@ -49,12 +45,23 @@  #include <sys/time.h>  #include "tempname.h" +libc_hidden_proto(strlen) +libc_hidden_proto(strcmp) +libc_hidden_proto(sprintf) +libc_hidden_proto(mkdir) +libc_hidden_proto(open) +libc_hidden_proto(open64) +libc_hidden_proto(read) +libc_hidden_proto(close) +libc_hidden_proto(getpid) +libc_hidden_proto(stat) +libc_hidden_proto(gettimeofday)  /* Return nonzero if DIR is an existent directory.  */  static int direxists (const char *dir)  {      struct stat buf; -    return __stat(dir, &buf) == 0 && S_ISDIR (buf.st_mode); +    return stat(dir, &buf) == 0 && S_ISDIR (buf.st_mode);  }  /* Path search algorithm, for tmpnam, tmpfile, etc.  If DIR is @@ -76,7 +83,7 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di      }      else      { -	plen = __strlen (pfx); +	plen = strlen (pfx);  	if (plen > 5)  	    plen = 5;      } @@ -98,7 +105,7 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di      {  	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  	{ @@ -107,7 +114,7 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di  	}      } -    dlen = __strlen (dir); +    dlen = strlen (dir);      while (dlen > 1 && dir[dlen - 1] == '/')  	dlen--;			/* remove trailing slashes */ @@ -118,7 +125,7 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di  	return -1;      } -    __sprintf (tmpl, "%.*s/%.*sXXXXXX", dlen, dir, plen, pfx); +    sprintf (tmpl, "%.*s/%.*sXXXXXX", dlen, dir, plen, pfx);      return 0;  } @@ -131,13 +138,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;  } @@ -149,7 +156,7 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len)  	uint32_t high, low, rh;  	static uint64_t value;  	gettimeofday(&tv, NULL); -	value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ __getpid(); +	value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid();  	low = value & UINT32_MAX;  	high = value >> 32;  	for (i = 0; i < len; ++i) { @@ -188,10 +195,10 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind)      unsigned char randomness[6];      size_t len; -    len = __strlen (tmpl); +    len = strlen (tmpl);      /* This is where the Xs start.  */      XXXXXX = tmpl + len - 6; -    if (len < 6 || __strcmp (XXXXXX, "XXXXXX")) +    if (len < 6 || strcmp (XXXXXX, "XXXXXX"))      {  	__set_errno (EINVAL);  	return -1; @@ -212,7 +219,7 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind)  	    case __GT_NOCREATE:  		{  		    struct stat st; -		    if (__stat (tmpl, &st) < 0) { +		    if (stat (tmpl, &st) < 0) {  			if (errno == ENOENT) {  			    fd = 0;  			    goto restore_and_ret; @@ -223,7 +230,7 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind)  			fd = 0;  		}  	    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/locale/locale.c b/libc/misc/locale/locale.c index 1a20300db..28ebb3fb2 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -46,15 +46,10 @@   *    locale support had (8-bit codesets only).   */ -#define stpcpy __stpcpy -#define strtok_r __strtok_r -/* #define fflush __fflush */ -  #define _GNU_SOURCE  #define __CTYPE_HAS_8_BIT_LOCALES 1 -  #include <string.h>  #include <stdlib.h>  #include <stddef.h> @@ -65,6 +60,18 @@  #include <ctype.h>  #include <stdio.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(stpcpy) +libc_hidden_proto(strtok_r) +libc_hidden_proto(strlen) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(strncmp) +libc_hidden_proto(strchr) +libc_hidden_proto(getenv) +/*libc_hidden_proto(fflush)*/ +  #ifdef __UCLIBC_MJN3_ONLY__  #ifdef L_setlocale  #warning TODO: Make the link_warning()s a config option? @@ -157,7 +164,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;  } @@ -186,6 +193,8 @@ static const char utf8[] = "UTF-8";   */  static char hr_locale[(MAX_LOCALE_CATEGORY_STR * LC_ALL) + MAX_LOCALE_STR]; +libc_hidden_proto(newlocale) +  static void update_hr_locale(const unsigned char *spec)  {  	const unsigned char *loc; @@ -228,7 +237,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] = '_'; @@ -263,9 +272,6 @@ static void update_hr_locale(const unsigned char *spec)  	} while (!done);  } -extern __locale_t __newlocale (int __category_mask, __const char *__locale, -			     __locale_t __base) __THROW attribute_hidden; -  char *setlocale(int category, const char *locale)  {  	if (((unsigned int)(category)) > LC_ALL) { @@ -276,7 +282,7 @@ char *setlocale(int category, const char *locale)  	}  	if (locale != NULL) {		/* Not just a query... */ -		if (!__newlocale((1 << category), locale, __global_locale)) { +		if (!newlocale((1 << category), locale, __global_locale)) {  			return NULL;		/* Failed! */  		}  		update_hr_locale(__global_locale->cur_locale); @@ -460,7 +466,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; @@ -512,9 +518,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 */ @@ -599,7 +605,7 @@ int attribute_hidden _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 { @@ -669,15 +675,15 @@ int attribute_hidden _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)); @@ -787,7 +793,7 @@ int attribute_hidden _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) { @@ -852,10 +858,10 @@ static const uint16_t __code2flag[16] = {  void attribute_hidden _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); @@ -1006,7 +1012,7 @@ static const unsigned char nl_data[C_LC_ALL + 1 + 90 + 320] = {  	   ']', '\x00',    '^',    '[',    'n',    'N',    ']', '\x00',   }; -char attribute_hidden *__nl_langinfo(nl_item item) +char *nl_langinfo(nl_item item)  {  	unsigned int c;  	unsigned int i; @@ -1019,25 +1025,27 @@ char attribute_hidden *__nl_langinfo(nl_item item)  	}  	return (char *) cat_start;	/* Conveniently, this is the empty string. */  } -strong_alias(__nl_langinfo,nl_langinfo) +libc_hidden_proto(nl_langinfo) +libc_hidden_def(nl_langinfo)  #else  /* __LOCALE_C_ONLY */  #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden; +libc_hidden_proto(nl_langinfo_l) -char attribute_hidden *__nl_langinfo(nl_item item) +char *nl_langinfo(nl_item item)  { -	return __nl_langinfo_l(item, __UCLIBC_CURLOCALE); +	return nl_langinfo_l(item, __UCLIBC_CURLOCALE);  } -strong_alias(__nl_langinfo,nl_langinfo) +libc_hidden_proto(nl_langinfo) +libc_hidden_def(nl_langinfo)  #else  /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */  static const char empty[] = ""; -char attribute_hidden *__UCXL(nl_langinfo)(nl_item item   __LOCALE_PARAM ) +char *__XL_NPP(nl_langinfo)(nl_item item   __LOCALE_PARAM )  {  	unsigned int c = _NL_ITEM_CATEGORY(item);  	unsigned int i = _NL_ITEM_INDEX(item); @@ -1049,7 +1057,8 @@ char attribute_hidden *__UCXL(nl_langinfo)(nl_item item   __LOCALE_PARAM )  	return (char *) empty;  } -__UCXL_ALIAS(nl_langinfo) +libc_hidden_proto(__XL_NPP(nl_langinfo)) +libc_hidden_def(__XL_NPP(nl_langinfo))  #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1082,14 +1091,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 */ @@ -1098,7 +1107,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; @@ -1106,19 +1115,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); @@ -1131,7 +1140,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; @@ -1173,14 +1182,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); @@ -1189,7 +1198,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;  			} @@ -1212,7 +1221,7 @@ static unsigned char *composite_locale(int category_mask, const char *locale,  	return new_locale;  } -__locale_t attribute_hidden __newlocale(int category_mask, const char *locale, __locale_t base) +__locale_t newlocale(int category_mask, const char *locale, __locale_t base)  {  	const unsigned char *p;  	int i, j, k; @@ -1231,7 +1240,7 @@ __locale_t attribute_hidden __newlocale(int category_mask, const char *locale, _  #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. */ @@ -1251,7 +1260,7 @@ __locale_t attribute_hidden __newlocale(int category_mask, const char *locale, _  				j = 0;  				do {  					p = envstr[j]; -				} while ((++j < 4) && (!(p = __getenv(p)) || !*p)); +				} while ((++j < 4) && (!(p = getenv(p)) || !*p));  				/* The user set something... is it valid? */ @@ -1296,8 +1305,8 @@ __locale_t attribute_hidden __newlocale(int category_mask, const char *locale, _  	return base;  } - -weak_alias(__newlocale, newlocale) +libc_hidden_proto(newlocale) +libc_hidden_def(newlocale)  #endif  /**********************************************************************/ @@ -1307,7 +1316,7 @@ weak_alias(__newlocale, newlocale)  #warning REMINDER: When we allocate ctype tables, remember to dup them.  #endif -__locale_t attribute_hidden __duplocale(__locale_t dataset) +__locale_t duplocale(__locale_t dataset)  {  	__locale_t r;  	uint16_t * i2w; @@ -1320,9 +1329,9 @@ __locale_t attribute_hidden __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; @@ -1330,8 +1339,8 @@ __locale_t attribute_hidden __duplocale(__locale_t dataset)  	}  	return r;  } - -weak_alias(__duplocale, duplocale) +libc_hidden_proto(duplocale) +libc_hidden_def(duplocale)  #endif  /**********************************************************************/ @@ -1341,7 +1350,7 @@ weak_alias(__duplocale, duplocale)  #warning REMINDER: When we allocate ctype tables, remember to free them.  #endif -void __freelocale(__locale_t dataset) +void freelocale(__locale_t dataset)  {  	assert(dataset != __global_locale);  	assert(dataset != LC_GLOBAL_LOCALE); @@ -1350,13 +1359,11 @@ void __freelocale(__locale_t dataset)  	free(dataset);				/* Free locale */  } -weak_alias(__freelocale, freelocale) -  #endif  /**********************************************************************/  #ifdef L_uselocale -__locale_t attribute_hidden __uselocale(__locale_t dataset) +__locale_t uselocale(__locale_t dataset)  {  	__locale_t old; @@ -1379,8 +1386,8 @@ __locale_t attribute_hidden __uselocale(__locale_t dataset)  	}  	return old;  } - -weak_alias(__uselocale, uselocale) +libc_hidden_proto(uselocale) +libc_hidden_def(uselocale)  #endif  /**********************************************************************/ diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index 01970148f..f9734fce5 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -1,14 +1,24 @@ -#define strtok_r __strtok_r -#define strstr __strstr -#define atoi __atoi -#define fseek __fseek -#define fgets __fgets +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */  #include <stdio.h>  #include <stdlib.h>  #include <string.h>  #include <mntent.h> +libc_hidden_proto(strstr) +libc_hidden_proto(strtok_r) +libc_hidden_proto(atoi) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(fseek) +libc_hidden_proto(fgets) +libc_hidden_proto(abort) +libc_hidden_proto(fprintf) +  #ifdef __UCLIBC_HAS_THREADS__  # include <pthread.h>  static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; @@ -17,7 +27,7 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;  #define UNLOCK	__pthread_mutex_unlock(&mylock)  /* Reentrant version of getmntent.  */ -struct mntent attribute_hidden *__getmntent_r (FILE *filep,  +struct mntent *getmntent_r (FILE *filep,   	struct mntent *mnt, char *buff, int bufsize)  {  	char *cp, *ptrptr; @@ -64,7 +74,8 @@ struct mntent attribute_hidden *__getmntent_r (FILE *filep,  	return mnt;  } -strong_alias(__getmntent_r,getmntent_r) +libc_hidden_proto(getmntent_r) +libc_hidden_def(getmntent_r)  struct mntent *getmntent(FILE * filep)  { @@ -79,7 +90,7 @@ struct mntent *getmntent(FILE * filep)  		    abort();      } -    tmp = __getmntent_r(filep, &mnt, buff, BUFSIZ); +    tmp = getmntent_r(filep, &mnt, buff, BUFSIZ);      UNLOCK;      return(tmp);  } @@ -101,16 +112,18 @@ char *hasmntopt(const struct mntent *mnt, const char *opt)  	return strstr(mnt->mnt_opts, opt);  } -FILE attribute_hidden *__setmntent(const char *name, const char *mode) +FILE *setmntent(const char *name, const char *mode)  {  	return fopen(name, mode);  } -strong_alias(__setmntent,setmntent) +libc_hidden_proto(setmntent) +libc_hidden_def(setmntent) -int attribute_hidden __endmntent(FILE * filep) +int endmntent(FILE * filep)  {  	if (filep != NULL)  		fclose(filep);  	return 1;  } -strong_alias(__endmntent,endmntent) +libc_hidden_proto(endmntent) +libc_hidden_def(endmntent) diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c index 419d879be..848097c26 100644 --- a/libc/misc/regex/regcomp.c +++ b/libc/misc/regex/regcomp.c @@ -835,8 +835,9 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)  #ifdef __UCLIBC_HAS_WCHAR__  # undef MB_CUR_MAX -# define	MB_CUR_MAX	(_stdlib_mb_cur_max_internal ()) -extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden; +# define	MB_CUR_MAX	(_stdlib_mb_cur_max ()) +extern size_t _stdlib_mb_cur_max (void) __THROW __wur; +libc_hidden_proto(_stdlib_mb_cur_max)    dfa->mb_cur_max = MB_CUR_MAX;  #else    dfa->mb_cur_max = 1; diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 99de9fd6c..8bac9c775 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -23,6 +23,7 @@  #endif  /* uClibc addons */ +#define _GNU_SOURCE  #include <features.h>  #ifdef __UCLIBC__ @@ -30,46 +31,50 @@  #define _REGEX_RE_COMP  #include <stdbool.h>  #include <stdint.h> +#include <string.h> +#include <stdlib.h>  #ifdef __UCLIBC_HAS_WCHAR__  #define RE_ENABLE_I18N -#define wcscoll __wcscoll -#define wcrtomb __wcrtomb -#define mbrtowc __mbrtowc -#define iswctype __iswctype -#define iswlower __iswlower -#define iswalnum __iswalnum -#define towlower __towlower -#define towupper __towupper -#define mbsinit __mbsinit  #include <wchar.h>  #include <wctype.h> -/* attribute_hidden produces text relocation */ -//extern int __wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW /*attribute_hidden*/; +#define __iswctype iswctype +#define __wcrtomb wcrtomb +#define __btowc btowc +#define __wctype wctype +libc_hidden_proto(wcscoll) +libc_hidden_proto(wcrtomb) +libc_hidden_proto(mbrtowc) +libc_hidden_proto(iswctype) +libc_hidden_proto(iswlower) +libc_hidden_proto(iswalnum) +libc_hidden_proto(towlower) +libc_hidden_proto(towupper) +libc_hidden_proto(mbsinit) +libc_hidden_proto(btowc) +libc_hidden_proto(wctype) -extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, -		       mbstate_t *__restrict __ps) attribute_hidden; - -extern wint_t __btowc (int __c) attribute_hidden; - -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 -#define getenv __getenv -#define strcasecmp __strcasecmp - -extern void *__mempcpy (void *__restrict __dest, -			__const void *__restrict __src, size_t __n) attribute_hidden; +#include <ctype.h> +#define __toupper toupper +#define __tolower tolower +#define __mempcpy mempcpy +libc_hidden_proto(toupper) +libc_hidden_proto(tolower) +libc_hidden_proto(memcmp) +libc_hidden_proto(memcpy) +libc_hidden_proto(memmove) +libc_hidden_proto(memset) +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(strncpy) +libc_hidden_proto(getenv) +libc_hidden_proto(strcasecmp) +libc_hidden_proto(mempcpy) +libc_hidden_proto(abort) +  #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 9031cebff..b64014e98 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -20,37 +20,29 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ -#define HAVE_MEMPCPY -#define memset __memset -#define memcmp __memcmp -#define strcmp __strcmp -#define strlen __strlen -#define wcslen __wcslen -/* for some reason this does not work */ -#define memcpy __memcpy -#define mbrtowc __mbrtowc -#define wcrtomb __wcrtomb -#define wcscoll __wcscoll -#define wctype __wctype -#define iswctype __iswctype -#define iswalnum __iswalnum -#define printf __printf -#define btowc __btowc -  /* To exclude some unwanted junk.... */  #undef emacs -#define _REGEX_RE_COMP +#define _GNU_SOURCE  #include <features.h>  #ifdef __UCLIBC__  # undef _LIBC +# define _REGEX_RE_COMP +# define HAVE_MEMPCPY +# define STDC_HEADERS +# define RE_TRANSLATE_TYPE char *  #endif  #include <stdlib.h>  #include <string.h> -#define STDC_HEADERS -#define RE_TRANSLATE_TYPE char * +#include <stdio.h> -extern void *__mempcpy (void *__restrict __dest, -			__const void *__restrict __src, size_t __n) /*attribute_hidden*/; +libc_hidden_proto(memset) +libc_hidden_proto(memcmp) +libc_hidden_proto(memcpy) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(printf) +libc_hidden_proto(mempcpy) +libc_hidden_proto(abort)  /* AIX requires this to be the first thing in the file. */  #if defined _AIX && !defined REGEX_MALLOC @@ -89,6 +81,15 @@ extern void *__mempcpy (void *__restrict __dest,  /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */  #  include <wchar.h>  #  include <wctype.h> +libc_hidden_proto(wcslen) +libc_hidden_proto(mbrtowc) +libc_hidden_proto(wcrtomb) +libc_hidden_proto(wcscoll) +libc_hidden_proto(wctype) +libc_hidden_proto(iswctype) +libc_hidden_proto(iswalnum) +libc_hidden_proto(btowc) +  # endif  # if defined _LIBC || defined __UCLIBC__ @@ -113,10 +114,10 @@ extern void *__mempcpy (void *__restrict __dest,  	__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)  #  define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) +# ifndef __UCLIBC__  #  define btowc __btowc  /* We are also using some library internals.  */ -# ifndef __UCLIBC__  #  include <locale/localeinfo.h>  #  include <locale/elem-hash.h>  #  include <langinfo.h> @@ -8280,7 +8281,7 @@ regerror (errcode, preg, errbuf, errbuf_size)        if (msg_size > errbuf_size)          {  #if defined HAVE_MEMPCPY || defined _LIBC -	  *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; +	  *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';  #else            memcpy (errbuf, msg, errbuf_size - 1);            errbuf[errbuf_size - 1] = 0; diff --git a/libc/misc/search/hsearch.c b/libc/misc/search/hsearch.c index a9400f3ca..b369408cb 100644 --- a/libc/misc/search/hsearch.c +++ b/libc/misc/search/hsearch.c @@ -17,16 +17,16 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ -#define hdestroy_r __hdestroy_r -#define hsearch_r __hsearch_r -#define hcreate_r __hcreate_r -  #ifndef _GNU_SOURCE  #define _GNU_SOURCE  #endif  #include <search.h> +libc_hidden_proto(hdestroy_r) +libc_hidden_proto(hsearch_r) +libc_hidden_proto(hcreate_r) +  /* The non-reentrant version use a global space for storing the table.  */  static struct hsearch_data htab; diff --git a/libc/misc/search/hsearch_r.c b/libc/misc/search/hsearch_r.c index d297b3280..47ff185d4 100644 --- a/libc/misc/search/hsearch_r.c +++ b/libc/misc/search/hsearch_r.c @@ -67,7 +67,7 @@ static int isprime (unsigned int number)     indexing as explained in the comment for the hsearch function.     The contents of the table is zeroed, especially the field used     becomes zero.  */ -int attribute_hidden __hcreate_r (size_t nel, struct hsearch_data *htab) +int hcreate_r (size_t nel, struct hsearch_data *htab)  {    /* Test for correct arguments.  */    if (htab == NULL) @@ -96,13 +96,14 @@ int attribute_hidden __hcreate_r (size_t nel, struct hsearch_data *htab)    /* everything went alright */    return 1;  } -strong_alias(__hcreate_r,hcreate_r) +libc_hidden_proto(hcreate_r) +libc_hidden_def(hcreate_r)  #endif  #ifdef L_hdestroy_r  /* After using the hash table it has to be destroyed. The used memory can     be freed and the local static variable can be marked as not used.  */ -void attribute_hidden __hdestroy_r (struct hsearch_data *htab) +void hdestroy_r (struct hsearch_data *htab)  {    /* Test for correct arguments.  */    if (htab == NULL) @@ -118,7 +119,8 @@ void attribute_hidden __hdestroy_r (struct hsearch_data *htab)    /* the sign for an existing table is an value != NULL in htable */    htab->table = NULL;  } -strong_alias(__hdestroy_r,hdestroy_r) +libc_hidden_proto(hdestroy_r) +libc_hidden_def(hdestroy_r)  #endif  #ifdef L_hsearch_r @@ -135,12 +137,16 @@ strong_alias(__hdestroy_r,hdestroy_r)     means used. The used field can be used as a first fast comparison for     equality of the stored and the parameter value. This helps to prevent     unnecessary expensive calls of strcmp.  */ -int attribute_hidden __hsearch_r (ENTRY item, ACTION action, ENTRY **retval, + +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) + +int hsearch_r (ENTRY item, ACTION action, ENTRY **retval,  	       struct hsearch_data *htab)  {    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 +172,7 @@ int attribute_hidden __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 +196,7 @@ int attribute_hidden __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; @@ -224,5 +230,6 @@ int attribute_hidden __hsearch_r (ENTRY item, ACTION action, ENTRY **retval,    *retval = NULL;    return 0;  } -strong_alias(__hsearch_r,hsearch_r) +libc_hidden_proto(hsearch_r) +libc_hidden_def(hsearch_r)  #endif diff --git a/libc/misc/search/lsearch.c b/libc/misc/search/lsearch.c index 4071cf1ab..eefef2121 100644 --- a/libc/misc/search/lsearch.c +++ b/libc/misc/search/lsearch.c @@ -12,9 +12,11 @@  #include <stdio.h>  #include <search.h> +libc_hidden_proto(lfind) +  #ifdef L_lfind -void attribute_hidden *__lfind(const void *key, const void *base, size_t *nmemb, +void *lfind(const void *key, const void *base, size_t *nmemb,  	size_t size, int (*compar)(const void *, const void *))  {  	register int n = *nmemb; @@ -26,22 +28,21 @@ void attribute_hidden *__lfind(const void *key, const void *base, size_t *nmemb,  	}  	return (NULL);  } -strong_alias(__lfind,lfind) +libc_hidden_def(lfind)  #endif  #ifdef L_lsearch -extern void *__lfind (__const void *__key, __const void *__base, -		    size_t *__nmemb, size_t __size, __compar_fn_t __compar) attribute_hidden; +libc_hidden_proto(memcpy)  void *lsearch(const void *key, void *base, size_t *nmemb,   	size_t size, int (*compar)(const void *, const void *))  {  	register char *p; -	if ((p = __lfind(key, base, nmemb, size, compar)) == NULL) { -		p = __memcpy((base + (size * (*nmemb))), key, size); +	if ((p = lfind(key, base, nmemb, size, compar)) == NULL) { +		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 58f16ab79..47d409468 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 attribute_hidden *__tsearch(__const void *key, void **vrootp, __compar_fn_t compar) +void *tsearch(__const void *key, void **vrootp, __compar_fn_t compar)  {      register node *q;      register node **rootp = (node **) vrootp; @@ -77,11 +77,12 @@ void attribute_hidden *__tsearch(__const void *key, void **vrootp, __compar_fn_t      }      return (q);  } -strong_alias(__tsearch,tsearch) +libc_hidden_proto(tsearch) +libc_hidden_def(tsearch)  #endif  #ifdef L_tfind -void attribute_hidden *__tfind(__const void *key, void * __const *vrootp, __compar_fn_t compar) +void *tfind(__const void *key, void * __const *vrootp, __compar_fn_t compar)  {      register node **rootp = (node **) vrootp; @@ -99,7 +100,8 @@ void attribute_hidden *__tfind(__const void *key, void * __const *vrootp, __comp      }      return NULL;  } -strong_alias(__tfind,tfind) +libc_hidden_proto(tfind) +libc_hidden_def(tfind)  #endif  #ifdef L_tdelete @@ -206,15 +208,15 @@ tdestroy_recurse (node *root, __free_fn_t freefct)      free (root);  } -void attribute_hidden __tdestroy (void *vroot, __free_fn_t freefct) +void tdestroy (void *vroot, __free_fn_t freefct)  {      node *root = (node *) vroot;      if (root != NULL) {  	tdestroy_recurse (root, freefct);      }  } -strong_alias(__tdestroy,tdestroy) +libc_hidden_proto(tdestroy) +libc_hidden_def(tdestroy)  #endif  /* tsearch.c ends here */ - diff --git a/libc/misc/statfs/fstatfs64.c b/libc/misc/statfs/fstatfs64.c index 63bd640b7..89ab5107d 100644 --- a/libc/misc/statfs/fstatfs64.c +++ b/libc/misc/statfs/fstatfs64.c @@ -18,10 +18,6 @@     02111-1307 USA.  */  #include <features.h> -#undef __fstatfs64 -#undef __fstatfs - -#ifdef __UCLIBC_HAS_LFS__  #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64   #undef _FILE_OFFSET_BITS @@ -42,13 +38,15 @@  #include <sys/statvfs.h>  #include <stddef.h> -#undef fstatfs64 +libc_hidden_proto(memcpy) +libc_hidden_proto(fstatfs) +  /* Return information about the filesystem on which FD resides.  */ -int attribute_hidden __fstatfs64 (int fd, struct statfs64 *buf) +int fstatfs64 (int fd, struct statfs64 *buf)  {      struct statfs buf32; -    if (__fstatfs (fd, &buf32) < 0) +    if (fstatfs (fd, &buf32) < 0)  	return -1;      buf->f_type = buf32.f_type; @@ -60,10 +58,9 @@ int attribute_hidden __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;  } -strong_alias(__fstatfs64,fstatfs64) - -#endif /* __UCLIBC_HAS_LFS__ */ +libc_hidden_proto(fstatfs64) +libc_hidden_def(fstatfs64) diff --git a/libc/misc/statfs/fstatvfs.c b/libc/misc/statfs/fstatvfs.c index 14ef6ecce..a3d0ef97c 100644 --- a/libc/misc/statfs/fstatvfs.c +++ b/libc/misc/statfs/fstatvfs.c @@ -29,16 +29,20 @@  #include <sys/statfs.h>  #include <sys/statvfs.h> +libc_hidden_proto(fstatfs) +libc_hidden_proto(fstat) +libc_hidden_proto(stat) +  int fstatvfs (int fd, struct statvfs *buf)  {      struct statfs fsbuf;      struct stat st;      /* Get as much information as possible from the system.  */ -    if (__fstatfs (fd, &fsbuf) < 0) +    if (fstatfs (fd, &fsbuf) < 0)  	return -1; -#define STAT(st) __fstat (fd, st) +#define STAT(st) fstat (fd, st)  #include "internal_statvfs.c"      /* We signal success if the statfs call succeeded.  */ diff --git a/libc/misc/statfs/fstatvfs64.c b/libc/misc/statfs/fstatvfs64.c index 993caf955..d97895a10 100644 --- a/libc/misc/statfs/fstatvfs64.c +++ b/libc/misc/statfs/fstatvfs64.c @@ -19,7 +19,6 @@  #include <features.h> -#ifdef __UCLIBC_HAS_LFS__  #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64   #undef _FILE_OFFSET_BITS  #define	_FILE_OFFSET_BITS   64 @@ -30,7 +29,6 @@  #ifndef __USE_LARGEFILE64  # define __USE_LARGEFILE64	1  #endif -#endif  #define __USE_GNU  #include <errno.h> @@ -42,16 +40,19 @@  #include <sys/statfs.h>  #include <sys/statvfs.h> +//libc_hidden_proto(fstatfs) +//libc_hidden_proto(fstat) +  int fstatvfs (int fd, struct statvfs *buf)  {      struct statfs fsbuf;      struct stat st;      /* Get as much information as possible from the system.  */ -    if (__fstatfs (fd, &fsbuf) < 0) +    if (fstatfs (fd, &fsbuf) < 0)  	return -1; -#define STAT(st) __fstat (fd, st) +#define STAT(st) fstat (fd, st)  #include "internal_statvfs.c"      /* We signal success if the statfs call succeeded.  */ diff --git a/libc/misc/statfs/internal_statvfs.c b/libc/misc/statfs/internal_statvfs.c index d41c3052d..2d561976e 100644 --- a/libc/misc/statfs/internal_statvfs.c +++ b/libc/misc/statfs/internal_statvfs.c @@ -17,18 +17,12 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ -extern FILE *__setmntent (__const char *__file, __const char *__mode) __THROW attribute_hidden; - -extern struct mntent *__getmntent_r (FILE *__restrict __stream, -				   struct mntent *__restrict __result, -				   char *__restrict __buffer, -				   int __bufsize) __THROW attribute_hidden; - -extern int __endmntent (FILE *__stream) __THROW attribute_hidden; - -extern char *__strsep (char **__restrict __stringp, -		     __const char *__restrict __delim) -     __THROW __nonnull ((1, 2)) attribute_hidden; +libc_hidden_proto(memset) +libc_hidden_proto(strcmp) +libc_hidden_proto(strsep) +libc_hidden_proto(setmntent) +libc_hidden_proto(getmntent_r) +libc_hidden_proto(endmntent)    /* Now fill in the fields we have information for.  */    buf->f_bsize = fsbuf.f_bsize; @@ -52,7 +46,7 @@ extern char *__strsep (char **__restrict __stringp,    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.  */ @@ -70,20 +64,20 @@ extern char *__strsep (char **__restrict __stringp,        struct mntent mntbuf;        FILE *mtab; -      mtab = __setmntent ("/proc/mounts", "r"); +      mtab = setmntent ("/proc/mounts", "r");        if (mtab == NULL) -	mtab = __setmntent (_PATH_MOUNTED, "r"); +	mtab = setmntent (_PATH_MOUNTED, "r");        if (mtab != NULL)  	{  	  char tmpbuf[1024]; -	  while (__getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf))) +	  while (getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf)))  	    {  	      struct stat fsst;  	      /* Find out about the device the current entry is for.  */ -	      if (__stat (mntbuf.mnt_dir, &fsst) >= 0 +	      if (stat (mntbuf.mnt_dir, &fsst) >= 0  		  && st.st_dev == fsst.st_dev)  		{  		  /* Bingo, we found the entry for the device FD is on. @@ -91,22 +85,22 @@ extern char *__strsep (char **__restrict __stringp,  		  char *cp = mntbuf.mnt_opts;  		  char *opt; -		  while ((opt = __strsep (&cp, ",")) != NULL) -		    if (__strcmp (opt, "ro") == 0) +		  while ((opt = strsep (&cp, ",")) != NULL) +		    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.  */ @@ -115,7 +109,7 @@ extern char *__strsep (char **__restrict __stringp,  	    }  	  /* Close the file.  */ -	  __endmntent (mtab); +	  endmntent (mtab);  	}        __set_errno (save_errno); diff --git a/libc/misc/statfs/statfs64.c b/libc/misc/statfs/statfs64.c index 9d326f1f8..230b89b9c 100644 --- a/libc/misc/statfs/statfs64.c +++ b/libc/misc/statfs/statfs64.c @@ -18,8 +18,6 @@     02111-1307 USA.  */  #include <features.h> -#undef __statfs64 -#undef __statfs  #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64   #undef _FILE_OFFSET_BITS @@ -38,14 +36,15 @@  #include <stddef.h>  #include <sys/statfs.h> -#if defined __UCLIBC_HAS_LFS__ -#undef statfs64 +libc_hidden_proto(memcpy) +libc_hidden_proto(statfs) +  /* Return information about the filesystem on which FILE resides.  */ -int attribute_hidden __statfs64 (const char *file, struct statfs64 *buf) +int statfs64 (const char *file, struct statfs64 *buf)  {      struct statfs buf32; -    if (__statfs (file, &buf32) < 0) +    if (statfs (file, &buf32) < 0)  	return -1;      buf->f_type = buf32.f_type; @@ -57,10 +56,9 @@ int attribute_hidden __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;  } -strong_alias(__statfs64,statfs64) - -#endif +libc_hidden_proto(statfs64) +libc_hidden_def(statfs64) diff --git a/libc/misc/statfs/statvfs.c b/libc/misc/statfs/statvfs.c index a7c553fb6..795126a7b 100644 --- a/libc/misc/statfs/statvfs.c +++ b/libc/misc/statfs/statvfs.c @@ -29,16 +29,19 @@  #include <sys/statfs.h>  #include <sys/statvfs.h> +libc_hidden_proto(statfs) +libc_hidden_proto(stat) +  int statvfs (const char *file, struct statvfs *buf)  {      struct statfs fsbuf;      struct stat st;      /* Get as much information as possible from the system.  */ -    if (__statfs (file, &fsbuf) < 0) +    if (statfs (file, &fsbuf) < 0)  	return -1; -#define STAT(st) __stat (file, st) +#define STAT(st) stat (file, st)  #include "internal_statvfs.c"      /* We signal success if the statfs call succeeded.  */ diff --git a/libc/misc/statfs/statvfs64.c b/libc/misc/statfs/statvfs64.c index dc2458f5f..ccde33757 100644 --- a/libc/misc/statfs/statvfs64.c +++ b/libc/misc/statfs/statvfs64.c @@ -42,6 +42,8 @@  #include <sys/statfs.h>  #include <sys/statvfs.h> +//libc_hidden_proto(statfs) +//libc_hidden_proto(stat)  int statvfs (const char *file, struct statvfs *buf)  { @@ -49,10 +51,10 @@ int statvfs (const char *file, struct statvfs *buf)      struct stat st;      /* Get as much information as possible from the system.  */ -    if (__statfs (file, &fsbuf) < 0) +    if (statfs (file, &fsbuf) < 0)  	return -1; -#define STAT(st) __stat (file, st) +#define STAT(st) stat (file, st)  #include "internal_statvfs.c"      /* We signal success if the statfs call succeeded.  */ diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index a4bb56bfc..698d1971d 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -31,14 +31,6 @@   * SUCH DAMAGE.   */ -#define ctime __ctime -#define sigaction __sigaction -#define connect __connect -#define vsnprintf __vsnprintf - -#define __FORCE_GLIBC -#define _GNU_SOURCE -#include <features.h>  /*   * SYSLOG -- print message on log file   * @@ -66,6 +58,9 @@   *  - Major code cleanup.   */ +#define __FORCE_GLIBC +#define _GNU_SOURCE +#include <features.h>  #include <sys/types.h>  #include <sys/socket.h>  #include <sys/file.h> @@ -85,7 +80,30 @@  #include <ctype.h>  #include <signal.h> -extern time_t __time (time_t *__timer) attribute_hidden; +libc_hidden_proto(openlog) +libc_hidden_proto(syslog) +libc_hidden_proto(vsyslog) +libc_hidden_proto(closelog) + +libc_hidden_proto(memset) +libc_hidden_proto(memcpy) +libc_hidden_proto(memmove) +libc_hidden_proto(strchr) +libc_hidden_proto(strlen) +libc_hidden_proto(strncpy) +libc_hidden_proto(open) +/*libc_hidden_proto(fcntl)*/ +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(write) +libc_hidden_proto(getpid) +libc_hidden_proto(ctime) +libc_hidden_proto(sigaction) +libc_hidden_proto(sigemptyset) +libc_hidden_proto(connect) +libc_hidden_proto(sprintf) +libc_hidden_proto(vsnprintf) +libc_hidden_proto(time)  #ifdef __UCLIBC_HAS_THREADS__  # include <pthread.h> @@ -108,7 +126,7 @@ closelog_intern(int to_default)  {  	LOCK;  	if (LogFile != -1) { -	    (void) __close(LogFile); +	    (void) close(LogFile);  	}  	LogFile = -1;  	connected = 0; @@ -131,8 +149,8 @@ sigpipe_handler (attribute_unused int sig)  /*   * OPENLOG -- open system log   */ -void attribute_hidden -__openlog( const char *ident, int logstat, int logfac ) +void +openlog( const char *ident, int logstat, int logfac )  {      int logType = SOCK_DGRAM; @@ -145,33 +163,33 @@ __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) { -	    if ((LogFile = __socket(AF_UNIX, logType, 0)) == -1){ +	    if ((LogFile = socket(AF_UNIX, logType, 0)) == -1){  		UNLOCK;  		return;  	    } -	    /*			__fcntl(LogFile, F_SETFD, 1); */ +	    /*			fcntl(LogFile, F_SETFD, 1); */  	}      }      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;  	    }  	} @@ -179,14 +197,14 @@ retry:      UNLOCK;  } -strong_alias(__openlog,openlog) +libc_hidden_def(openlog)  /*   * syslog, vsyslog --   *     print message on log file; output is intended for syslogd(8).   */ -void attribute_hidden -__vsyslog( int pri, const char *fmt, va_list ap ) +void +vsyslog( int pri, const char *fmt, va_list ap )  {  	register char *p;  	char *last_chr, *head_end, *end, *stdp; @@ -197,7 +215,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); @@ -210,7 +228,7 @@ __vsyslog( int pri, const char *fmt, va_list ap )  	if (!(LogMask & LOG_MASK(LOG_PRI(pri))) || (pri &~ (LOG_PRIMASK|LOG_FACMASK)))  		goto getout;  	if (LogFile < 0 || !connected) -		__openlog(LogTag, LogStat | LOG_NDELAY, 0); +		openlog(LogTag, LogStat | LOG_NDELAY, 0);  	/* Set default facility if none specified. */  	if ((pri & LOG_FACMASK) == 0) @@ -220,16 +238,16 @@ __vsyslog( int pri, const char *fmt, va_list ap )  	 * no longer than 64 characters plus length of the LogTag. So it's  	 * safe to test only LogTag and use normal sprintf everywhere else.  	 */ -	(void)__time(&now); -	stdp = p = tbuf + __sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4); +	(void)time(&now); +	stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4);  	if (LogTag) { -		if (__strlen(LogTag) < sizeof(tbuf) - 64) -			p += __sprintf(p, "%s", LogTag); +		if (strlen(LogTag) < sizeof(tbuf) - 64) +			p += sprintf(p, "%s", LogTag);  		else -			p += __sprintf(p, "<BUFFER OVERRUN ATTEMPT>"); +			p += sprintf(p, "<BUFFER OVERRUN ATTEMPT>");  	}  	if (LogStat & LOG_PID) -		p += __sprintf(p, "[%d]", __getpid()); +		p += sprintf(p, "[%d]", getpid());  	if (LogTag) {  		*p++ = ':';  		*p++ = ' '; @@ -246,9 +264,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++; @@ -264,14 +282,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; @@ -292,12 +310,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: @@ -306,28 +324,28 @@ getout:  		sigaction (SIGPIPE, &oldaction,  			(struct sigaction *) NULL);  } -strong_alias(__vsyslog,vsyslog) +libc_hidden_def(vsyslog) -void attribute_hidden -__syslog(int pri, const char *fmt, ...) +void +syslog(int pri, const char *fmt, ...)  {  	va_list ap;  	va_start(ap, fmt); -	__vsyslog(pri, fmt, ap); +	vsyslog(pri, fmt, ap);  	va_end(ap);  } -strong_alias(__syslog,syslog) +libc_hidden_def(syslog)  /*   * CLOSELOG -- close the system log   */ -void attribute_hidden -__closelog( void ) +void +closelog( void )  {  	closelog_intern(1);  } -strong_alias(__closelog,closelog) +libc_hidden_def(closelog)  /* setlogmask -- set the log mask level */  int setlogmask(int pmask) diff --git a/libc/misc/sysvipc/ftok.c b/libc/misc/sysvipc/ftok.c index fd4021d3e..12627cad1 100644 --- a/libc/misc/sysvipc/ftok.c +++ b/libc/misc/sysvipc/ftok.c @@ -20,12 +20,14 @@  #include <sys/ipc.h>  #include <sys/stat.h> +libc_hidden_proto(stat) +  key_t ftok (const char *pathname, int proj_id)  {    struct stat st;    key_t key; -  if (__stat(pathname, &st) < 0) +  if (stat(pathname, &st) < 0)      return (key_t) -1;    key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index 33fd16153..14a1ee32b 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -18,7 +18,7 @@     Boston, MA 02111-1307, USA.  */  /* SHMLBA uses it */ -#define __getpagesize __getpagesize_internal +#define __getpagesize getpagesize  #include <stdlib.h>  #include <errno.h> @@ -26,6 +26,8 @@  #include <syscall.h>  #include "ipc.h" +libc_hidden_proto(getpagesize) +  #ifdef L_shmat  /* Attach the shared memory segment associated with SHMID to the data     segment of the calling process.  SHMADDR and SHMFLG determine how diff --git a/libc/misc/time/adjtime.c b/libc/misc/time/adjtime.c index fd33ff60d..cfa94339a 100644 --- a/libc/misc/time/adjtime.c +++ b/libc/misc/time/adjtime.c @@ -1,10 +1,16 @@ -#define adjtimex __adjtimex +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */  #include <limits.h>  #include <sys/time.h>  #include <sys/timex.h>  #include <errno.h> +libc_hidden_proto(adjtimex) +  #define MAX_SEC	(LONG_MAX / 1000000L - 2)  #define MIN_SEC	(LONG_MIN / 1000000L + 2) diff --git a/libc/misc/time/ftime.c b/libc/misc/time/ftime.c index 904763241..233d6f70d 100644 --- a/libc/misc/time/ftime.c +++ b/libc/misc/time/ftime.c @@ -16,11 +16,11 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ -#define gettimeofday __gettimeofday -  #include <sys/timeb.h>  #include <sys/time.h> +libc_hidden_proto(gettimeofday) +  int ftime(timebuf)  struct timeb *timebuf;  { diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 889e7933f..39aacddd2 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -129,49 +129,54 @@   *            differs (intentionally) from glibc's behavior.   */ -#define strnlen __strnlen -#define gettimeofday __gettimeofday -  #define _GNU_SOURCE  #include <stdio.h>  #include <stdlib.h>  #include <stddef.h>  #include <string.h>  #include <time.h> +#include <sys/time.h>  #include <limits.h>  #include <assert.h>  #include <errno.h>  #include <ctype.h>  #include <langinfo.h>  #include <locale.h> +#include <fcntl.h> +#include <unistd.h>  #include <bits/uClibc_uintmaxtostr.h> -extern void __tzset (void) __THROW attribute_hidden; - -extern long int __strtol (__const char *__restrict __nptr, -			char **__restrict __endptr, int __base) -     __THROW __nonnull ((1)) __wur attribute_hidden; - -extern char *__nl_langinfo (nl_item __item) __THROW attribute_hidden; - +#ifdef __UCLIBC_HAS_WCHAR__ +#include <wchar.h> +#endif  #ifdef __UCLIBC_HAS_XLOCALE__  #include <xlocale.h> -extern long int __strtol_l (__const char *__restrict __nptr, -			  char **__restrict __endptr, int __base, -			  __locale_t __loc) __THROW __nonnull ((1, 4)) __wur attribute_hidden; -extern int __strncasecmp_l (__const char *__s1, __const char *__s2, -			  size_t __n, __locale_t __loc) -     __THROW __attribute_pure__ __nonnull ((1, 2, 4)) attribute_hidden; -extern size_t __strftime_l (char *__restrict __s, size_t __maxsize, -			  __const char *__restrict __format, -			  __const struct tm *__restrict __tp, -			  __locale_t __loc) __THROW attribute_hidden; +#endif -extern char *__strptime_l (__const char *__restrict __s, -			 __const char *__restrict __fmt, struct tm *__tp, -			 __locale_t __loc) __THROW attribute_hidden; +libc_hidden_proto(memset) +libc_hidden_proto(memcpy) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(strncpy) +libc_hidden_proto(strnlen) +/* libc_hidden_proto(sprintf) */ +libc_hidden_proto(open) +libc_hidden_proto(read) +libc_hidden_proto(close) +libc_hidden_proto(getenv) +libc_hidden_proto(tzset) +libc_hidden_proto(gettimeofday) +libc_hidden_proto(strncasecmp) +libc_hidden_proto(strtol) +libc_hidden_proto(strtoul) +libc_hidden_proto(nl_langinfo) -extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden; +#ifdef __UCLIBC_HAS_XLOCALE__ +libc_hidden_proto(strncasecmp_l) +libc_hidden_proto(strtol_l) +libc_hidden_proto(strtoul_l) +libc_hidden_proto(nl_langinfo_l)  #endif  #ifndef __isleap @@ -191,8 +196,6 @@ extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden;  #ifdef __UCLIBC_HAS_TZ_FILE__  #include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h>  #include "paths.h"  /* ":<tzname>+hh:mm:ss<tzname>+hh:mm:ss,Mmm.w.d/hh:mm:ss,Mmm.w.d/hh:mm:ss" + nul */  /* 1 + 2*(1+TZNAME_MAX+1 + 9 + 7 + 9) + 1 = 2*TZNAME_MAX + 56 */ @@ -208,11 +211,6 @@ extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden;  extern struct tm __time_tm attribute_hidden; -extern struct tm *__localtime_r (__const time_t *__restrict __timer, -			       struct tm *__restrict __tp) attribute_hidden; - -extern struct tm *__localtime (__const time_t *__timer) attribute_hidden; -  typedef struct {  	long gmt_offset;  	long dst_offset; @@ -244,21 +242,19 @@ extern struct tm *__time_localtime_tzi(const time_t *__restrict timer,  extern time_t _time_mktime_tzi(struct tm *timeptr, int store_on_success,  					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 +libc_hidden_proto(asctime_r) +  static char __time_str[26]; -char attribute_hidden *__asctime(const struct tm *ptm) +char *asctime(const struct tm *ptm)  { -	return __asctime_r(ptm, __time_str); +	return asctime_r(ptm, __time_str);  } -strong_alias(__asctime,asctime) +libc_hidden_proto(asctime) +libc_hidden_def(asctime)  #endif  /**********************************************************************/ @@ -278,7 +274,7 @@ strong_alias(__asctime,asctime)   *       };   *       static char result[26];   *    - *       __sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n", + *       sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",   *           wday_name[timeptr->tm_wday],                      *           mon_name[timeptr->tm_mon],   *           timeptr->tm_mday, timeptr->tm_hour, @@ -326,7 +322,7 @@ static const unsigned char at_data[] = {  	' ', '?', '?', '?', '?', '\n', 0  }; -char attribute_hidden *__asctime_r(register const struct tm *__restrict ptm, +char *asctime_r(register const struct tm *__restrict ptm,  				register char *__restrict buffer)  {  	int tmp; @@ -335,23 +331,23 @@ char attribute_hidden *__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 @@ -400,16 +396,17 @@ char attribute_hidden *__asctime_r(register const struct tm *__restrict ptm,  	return buffer - 8;  } -strong_alias(__asctime_r,asctime_r) +libc_hidden_proto(asctime_r) +libc_hidden_def(asctime_r)  #endif  /**********************************************************************/  #ifdef L_clock -#define times __times -  #include <sys/times.h> +libc_hidden_proto(times) +  #ifndef __BCC__  #if CLOCKS_PER_SEC != 1000000L  #error unexpected value for CLOCKS_PER_SEC! @@ -474,21 +471,28 @@ clock_t clock(void)  /**********************************************************************/  #ifdef L_ctime -char attribute_hidden *__ctime(const time_t *clock) +libc_hidden_proto(asctime) +libc_hidden_proto(localtime) + +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));  } -strong_alias(__ctime,ctime) +libc_hidden_proto(ctime) +libc_hidden_def(ctime)  #endif  /**********************************************************************/  #ifdef L_ctime_r +libc_hidden_proto(asctime_r) +libc_hidden_proto(localtime_r) +  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 @@ -556,28 +560,31 @@ struct tm *gmtime_r(const time_t *__restrict timer,  /**********************************************************************/  #ifdef L_localtime -struct tm attribute_hidden *__localtime(const time_t *timer) +libc_hidden_proto(localtime_r) + +struct tm *localtime(const time_t *timer)  {  	register struct tm *ptm = &__time_tm;  	/* In this implementation, tzset() is called by localtime_r().  */ -	__localtime_r(timer, ptm);	/* Can return NULL... */ +	localtime_r(timer, ptm);	/* Can return NULL... */  	return ptm;  } -strong_alias(__localtime,localtime) +libc_hidden_proto(localtime) +libc_hidden_def(localtime)  #endif  /**********************************************************************/  #ifdef L_localtime_r -struct tm attribute_hidden *__localtime_r(register const time_t *__restrict timer, +struct tm *localtime_r(register const time_t *__restrict timer,  					   register struct tm *__restrict result)  {  	TZLOCK; -	__tzset(); +	tzset();  	__time_localtime_tzi(timer, result, _time_tzinfo); @@ -585,7 +592,8 @@ struct tm attribute_hidden *__localtime_r(register const time_t *__restrict time  	return result;  } -strong_alias(__localtime_r,localtime_r) +libc_hidden_proto(localtime_r) +libc_hidden_def(localtime_r)  #endif  /**********************************************************************/ @@ -610,7 +618,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;  		}  	} @@ -621,7 +629,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;  		}  	} @@ -765,8 +773,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);  } @@ -777,13 +785,16 @@ time_t timegm(struct tm *timeptr)  #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -size_t attribute_hidden __strftime(char *__restrict s, size_t maxsize, +libc_hidden_proto(strftime_l) + +size_t strftime(char *__restrict s, size_t maxsize,  				const char *__restrict format,  				const struct tm *__restrict timeptr)  { -	return __strftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); +	return strftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE);  } -strong_alias(__strftime,strftime) +libc_hidden_proto(strftime) +libc_hidden_def(strftime)  #else  /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -983,7 +994,7 @@ static int load_field(int k, const struct tm *__restrict timeptr)  #warning TODO: Check multibyte format string validity.  #endif -size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, +size_t __XL_NPP(strftime)(char *__restrict s, size_t maxsize,  					  const char *__restrict format,  					  const struct tm *__restrict timeptr   __LOCALE_PARAM )  { @@ -1003,7 +1014,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize,  	unsigned char mod;  	unsigned char code; -	__tzset();					/* We'll, let's get this out of the way. */ +	tzset();					/* We'll, let's get this out of the way. */  	lvl = 0;  	p = format; @@ -1056,7 +1067,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize,  				+ (code & 7);  #ifdef ENABLE_ERA_CODE  			if ((mod & NO_E_MOD) /* Actually, this means E modifier present. */ -				&& (*(o = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, +				&& (*(o = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME,  											 (int)(((unsigned char *)p)[4]))  											__LOCALE_ARG  									  ))) @@ -1065,7 +1076,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize,  				goto LOOP;  			}  #endif -			p = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, +			p = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME,  									 (int)(*((unsigned char *)p)))  								  __LOCALE_ARG  								  ); @@ -1242,7 +1253,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize,  		if ((code & MASK_SPEC) == STRING_SPEC) {  			o_count = SIZE_MAX;  			field_val += spec[STRINGS_NL_ITEM_START + (code & 0xf)]; -			o = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, field_val)  __LOCALE_ARG ); +			o = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME, field_val)  __LOCALE_ARG );  		} else {  			o_count = ((i >> 1) & 3) + 1;  			o = buf + o_count; @@ -1265,8 +1276,8 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize,  	}  	goto LOOP;  } - -__UCXL_ALIAS(strftime) +libc_hidden_proto(__XL_NPP(strftime)) +libc_hidden_def(__XL_NPP(strftime))  #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1284,12 +1295,15 @@ __UCXL_ALIAS(strftime)  #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -char attribute_hidden *__strptime(const char *__restrict buf, const char *__restrict format, +libc_hidden_proto(strptime_l) + +char *strptime(const char *__restrict buf, const char *__restrict format,  			   struct tm *__restrict tm)  { -	return __strptime_l(buf, format, tm, __UCLIBC_CURLOCALE); +	return strptime_l(buf, format, tm, __UCLIBC_CURLOCALE);  } -strong_alias(__strptime,strptime) +libc_hidden_proto(strptime) +libc_hidden_def(strptime)  #else  /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1435,7 +1449,9 @@ static const unsigned char spec[] = {  #define MAX_PUSH 4 -char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *__restrict format, +libc_hidden_proto(localtime_r) + +char *__XL_NPP(strptime)(const char *__restrict buf, const char *__restrict format,  					 struct tm *__restrict tm   __LOCALE_PARAM)  {  	register const char *p; @@ -1503,7 +1519,7 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *  				+ (code & 7);  #ifdef ENABLE_ERA_CODE  			if ((mod & NO_E_MOD) /* Actually, this means E modifier present. */ -				&& (*(o = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, +				&& (*(o = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME,  											  (int)(((unsigned char *)p)[4]))  											__LOCALE_ARG  											))) @@ -1512,7 +1528,7 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *  				goto LOOP;  			}  #endif -			p = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, +			p = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME,  										   (int)(*((unsigned char *)p)))  								  __LOCALE_ARG );  			goto LOOP; @@ -1527,8 +1543,8 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *  			/* Go backwards to check full names before abreviations. */  			do {  				--j; -				o = __UCXL(nl_langinfo)(i+j   __LOCALE_ARG); -				if (!__UCXL(strncasecmp)(buf,o,__strlen(o)   __LOCALE_ARG) && *o) { +				o = __XL_NPP(nl_langinfo)(i+j   __LOCALE_ARG); +				if (!__XL_NPP(strncasecmp)(buf,o,strlen(o)   __LOCALE_ARG) && *o) {  					do {		/* Found a match. */  						++buf;  					} while (*++o); @@ -1556,9 +1572,9 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *  				__set_errno(0);  				if (!ISSPACE(*buf)) { /* Signal an error if whitespace. */  #ifdef TIME_T_IS_UNSIGNED -					t = __UCXL(strtoul)(buf, &o, 10   __LOCALE_ARG); +					t = __XL_NPP(strtoul)(buf, &o, 10   __LOCALE_ARG);  #else -					t = __UCXL(strtol)(buf, &o, 10   __LOCALE_ARG); +					t = __XL_NPP(strtol)(buf, &o, 10   __LOCALE_ARG);  #endif  				}  				if ((o == buf) || errno) { /* Not a number or overflow. */ @@ -1568,7 +1584,7 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *  				buf = o;  				if (!code) {	/* s */ -					__localtime_r(&t, tm); /* TODO: check for failure? */ +					localtime_r(&t, tm); /* TODO: check for failure? */  					i = 0;  					do {		/* Now copy values from tm to fields. */  						 fields[i] = ((int *) tm)[i]; @@ -1644,8 +1660,8 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *  	}  	return NULL;  } - -__UCXL_ALIAS(strptime) +libc_hidden_proto(__XL_NPP(strptime)) +libc_hidden_def(__XL_NPP(strptime))  #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1783,11 +1799,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) { @@ -1807,14 +1823,14 @@ static char *read_TZ_file(char *buf)  		ERROR:  			p = NULL;  		} -		__close(fd); +		close(fd);  	}  	return p;  }  #endif /* __UCLIBC_HAS_TZ_FILE__ */ -void attribute_hidden __tzset(void) +void tzset(void)  {  	register const char *e;  	register char *s; @@ -1832,7 +1848,7 @@ void attribute_hidden __tzset(void)  	TZLOCK; -	e = __getenv(TZ);				/* TZ env var always takes precedence. */ +	e = getenv(TZ);				/* TZ env var always takes precedence. */  #if defined(__UCLIBC_HAS_TZ_FILE__) && !defined(__UCLIBC_HAS_TZ_FILE_READ_MANY__)  	/* Put this inside the lock to prevent the possiblity of two different @@ -1859,8 +1875,8 @@ void attribute_hidden __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;  	} @@ -1869,13 +1885,13 @@ void attribute_hidden __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; @@ -1989,7 +2005,7 @@ void attribute_hidden __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; @@ -2001,7 +2017,7 @@ void attribute_hidden __tzset(void)  #endif  	TZUNLOCK;  } -strong_alias(__tzset,tzset) +libc_hidden_def(tzset)  #endif  /**********************************************************************/  /*  #ifdef L_utime */ @@ -2203,7 +2219,7 @@ time_t attribute_hidden _time_mktime(struct tm *timeptr, int store_on_success)  	TZLOCK; -	__tzset(); +	tzset();  	t = _time_mktime_tzi(timeptr, store_on_success, _time_tzinfo); @@ -2236,7 +2252,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes  	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. */ @@ -2326,7 +2342,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes  	if (store_on_success) { -		__memcpy(timeptr, p, sizeof(struct tm)); +		memcpy(timeptr, p, sizeof(struct tm));  	} @@ -2340,29 +2356,28 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes  #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, -			  __const wchar_t *__restrict __format, -			  __const struct tm *__restrict __timeptr, -			  __locale_t __loc) __THROW attribute_hidden; +libc_hidden_proto(wcsftime_l)  size_t wcsftime(wchar_t *__restrict s, size_t maxsize,  				const wchar_t *__restrict format,  				const struct tm *__restrict timeptr)  { -	return __wcsftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); +	return wcsftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE);  } +libc_hidden_proto(wcsftime) +libc_hidden_def(wcsftime)  #else  /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -size_t attribute_hidden __UCXL(wcsftime)(wchar_t *__restrict s, size_t maxsize, +size_t __XL_NPP(wcsftime)(wchar_t *__restrict s, size_t maxsize,  					  const wchar_t *__restrict format,  					  const struct tm *__restrict timeptr   __LOCALE_PARAM )  {  #warning wcsftime always fails  	return 0;					/* always fail */  } - -__UCXL_ALIAS(wcsftime) +libc_hidden_proto(__XL_NPP(wcsftime)) +libc_hidden_def(__XL_NPP(wcsftime))  #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index 9b83b6ede..9754e9b49 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/libc/misc/ttyent/getttyent.c @@ -27,10 +27,6 @@   * SUCH DAMAGE.   */ -#define __fsetlocking __fsetlocking_internal -#define rewind __rewind -#define fgets_unlocked __fgets_unlocked -  #define _GNU_SOURCE  #include <features.h>  #include <ttyent.h> @@ -43,7 +39,17 @@  #include <pthread.h>  #endif -extern int __getc_unlocked (FILE *__stream) attribute_hidden; +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strncmp) +libc_hidden_proto(__fsetlocking) +libc_hidden_proto(rewind) +libc_hidden_proto(fgets_unlocked) +libc_hidden_proto(getc_unlocked) +libc_hidden_proto(__fgetc_unlocked) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(abort)  static char zapchar;  static FILE *tf; @@ -89,7 +95,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);  }  int attribute_hidden __setttyent(void) @@ -132,8 +138,8 @@ struct ttyent attribute_hidden * __getttyent(void)  	    return (NULL);  	}  	/* skip lines that are too big */ -	if (!__strchr(p, '\n')) { -	    while ((c = __getc_unlocked(tf)) != '\n' && c != EOF) +	if (!strchr(p, '\n')) { +	    while ((c = getc_unlocked(tf)) != '\n' && c != EOF)  		;  	    continue;  	} @@ -158,8 +164,8 @@ struct ttyent attribute_hidden * __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; @@ -181,7 +187,7 @@ struct ttyent attribute_hidden * __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);  } @@ -206,7 +212,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); diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index 3ad5bc828..c1932d7d7 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -20,7 +20,16 @@  #include <string.h>  #include <utmp.h> - +libc_hidden_proto(strcmp) +libc_hidden_proto(strdup) +libc_hidden_proto(strncmp) +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(open) +libc_hidden_proto(fcntl) +libc_hidden_proto(close) +libc_hidden_proto(lseek) +libc_hidden_proto(setutent)  #ifdef __UCLIBC_HAS_THREADS__  # include <pthread.h> @@ -37,47 +46,47 @@ static struct utmp static_utmp;  static const char default_file_name[] = _PATH_UTMP;  static const char *static_ut_name = (const char *) default_file_name; -void attribute_hidden __setutent(void) +void setutent(void)  {      int ret;      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;  	    }  	}  	/* Make sure the file will be closed on exec()  */ -	ret = __fcntl(static_fd, F_GETFD, 0); +	ret = fcntl(static_fd, F_GETFD, 0);  	if (ret >= 0) { -	    ret = __fcntl(static_fd, F_GETFD, 0); +	    ret = fcntl(static_fd, F_GETFD, 0);  	}  	if (ret < 0) {  bummer:  	    UNLOCK;  	    static_fd = -1; -	    __close(static_fd); +	    close(static_fd);  	    return;  	}      } -    __lseek(static_fd, 0, SEEK_SET); +    lseek(static_fd, 0, SEEK_SET);      UNLOCK;      return;  } -strong_alias(__setutent,setutent) +libc_hidden_def(setutent)  static struct utmp *__getutent(int utmp_fd)  {      if (utmp_fd == -1) { -	__setutent(); +	setutent();      }      if (utmp_fd == -1) {  	return NULL;      }      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;      } @@ -90,7 +99,7 @@ void endutent(void)  {      LOCK;      if (static_fd != -1) { -	__close(static_fd); +	close(static_fd);      }      static_fd = -1;      UNLOCK; @@ -120,7 +129,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;  	} @@ -137,7 +146,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;  	} @@ -151,15 +160,15 @@ struct utmp *pututline (const struct utmp *utmp_entry)      LOCK;      /* Ignore the return value.  That way, if they've already positioned         the file pointer where they want it, everything will work out. */ -    __lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); +    lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);      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)) +	lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); +	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)) +	lseek(static_fd, (off_t) 0, SEEK_END); +	if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))  	    return NULL;      } @@ -173,7 +182,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 */ @@ -182,7 +191,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 35947f19e..0378070e7 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -1,23 +1,10 @@ -/* wtmp support rubbish (i.e. complete crap) +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>   * - * Written by Erik Andersen <andersee@debian.org>  - * - * This library 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.   - * - * This library 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 library; see the file COPYING.LIB.  If not,  - * write to the Free Software Foundation, Inc., 675 Mass Ave,  - * Cambridge, MA 02139, USA.  */ + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ -#define gettimeofday __gettimeofday +/* wtmp support rubbish (i.e. complete crap) */  #include <string.h>  #include <sys/time.h> @@ -27,36 +14,45 @@  #include <fcntl.h>  #include <sys/file.h> +#if 0 +libc_hidden_proto(memset) +libc_hidden_proto(strncpy) +libc_hidden_proto(updwtmp) +#endif +libc_hidden_proto(open) +libc_hidden_proto(write) +libc_hidden_proto(close) +libc_hidden_proto(lockf) +libc_hidden_proto(gettimeofday)  #if 0  /* This is enabled in uClibc/libutil/logwtmp.c */  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));  }  #endif -extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp) +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)); -	    __lockf(fd, F_ULOCK, 0); -	    __close(fd); +	if (lockf(fd, F_LOCK, 0)==0) { +	    write(fd, (const char *) lutmp, sizeof(struct utmp)); +	    lockf(fd, F_ULOCK, 0); +	    close(fd);  	}      }  } - diff --git a/libc/misc/wchar/Makefile.in b/libc/misc/wchar/Makefile.in index 9059d71d8..f1d5f3876 100644 --- a/libc/misc/wchar/Makefile.in +++ b/libc/misc/wchar/Makefile.in @@ -20,7 +20,7 @@  MSRC:=wchar.c  MOBJ:=	btowc.o wctob.o mbsinit.o mbrlen.o mbrtowc.o wcrtomb.o mbsrtowcs.o \  	wcsrtombs.o _wchar_utf8sntowcs.o _wchar_wcsntoutf8s.o \ -	__mbsnrtowcs.o __wcsnrtombs.o wcwidth.o wcswidth.o +	mbsnrtowcs.o wcsnrtombs.o wcwidth.o wcswidth.o  ifeq ($(UCLIBC_HAS_LOCALE),y)  MOBJ+=iconv.o diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 2535b5fff..28efbba22 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -164,13 +164,6 @@  #define KUHN 1 -extern size_t __mbrtowc (wchar_t *__restrict __pwc, -		       __const char *__restrict __s, size_t __n, -		       mbstate_t *__p) attribute_hidden; - -extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, -		       mbstate_t *__restrict __ps) attribute_hidden; -  /* Implementation-specific work functions. */  extern size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn, @@ -180,20 +173,12 @@ extern size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn,  extern size_t _wchar_wcsntoutf8s(char *__restrict s, size_t n,  					const wchar_t **__restrict src, size_t wn) attribute_hidden; -/* glibc extensions. */ - -extern size_t __mbsnrtowcs(wchar_t *__restrict dst, -				   const char **__restrict src, -				   size_t NMC, size_t len, mbstate_t *__restrict ps) attribute_hidden; - -extern size_t __wcsnrtombs(char *__restrict dst, -				   const wchar_t **__restrict src, -				   size_t NWC, size_t len, mbstate_t *__restrict ps) attribute_hidden; -  /**********************************************************************/  #ifdef L_btowc -wint_t attribute_hidden __btowc(int c) +libc_hidden_proto(mbrtowc) + +wint_t btowc(int c)  {  #ifdef __CTYPE_HAS_8_BIT_LOCALES @@ -204,7 +189,7 @@ wint_t attribute_hidden __btowc(int c)  	if (c != EOF) {  		*buf = (unsigned char) c;  		mbstate.__mask = 0;		/* Initialize the mbstate. */ -		if (__mbrtowc(&wc, buf, 1, &mbstate) <= 1) { +		if (mbrtowc(&wc, buf, 1, &mbstate) <= 1) {  			return wc;  		}  	} @@ -223,7 +208,8 @@ wint_t attribute_hidden __btowc(int c)  #endif /*  __CTYPE_HAS_8_BIT_LOCALES */  } -strong_alias(__btowc,btowc) +libc_hidden_proto(btowc) +libc_hidden_def(btowc)  #endif  /**********************************************************************/ @@ -231,13 +217,15 @@ strong_alias(__btowc,btowc)  /* Note: We completely ignore ps in all currently supported conversions. */ +libc_hidden_proto(wcrtomb) +  int wctob(wint_t c)  {  #ifdef __CTYPE_HAS_8_BIT_LOCALES  	unsigned char buf[MB_LEN_MAX]; -	return (__wcrtomb(buf, c, NULL) == 1) ? *buf : EOF; +	return (wcrtomb(buf, c, NULL) == 1) ? *buf : EOF;  #else  /*  __CTYPE_HAS_8_BIT_LOCALES */ @@ -260,29 +248,35 @@ int wctob(wint_t c)  /**********************************************************************/  #ifdef L_mbsinit -int attribute_hidden __mbsinit(const mbstate_t *ps) +int mbsinit(const mbstate_t *ps)  {  	return !ps || !ps->__mask;  } -strong_alias(__mbsinit,mbsinit) +libc_hidden_proto(mbsinit) +libc_hidden_def(mbsinit)  #endif  /**********************************************************************/  #ifdef L_mbrlen -size_t attribute_hidden __mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps) +libc_hidden_proto(mbrtowc) + +size_t mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps)  {  	static mbstate_t mbstate;	/* Rely on bss 0-init. */ -	return __mbrtowc(NULL, s, n, (ps != NULL) ? ps : &mbstate); +	return mbrtowc(NULL, s, n, (ps != NULL) ? ps : &mbstate);  } -strong_alias(__mbrlen,mbrlen) +libc_hidden_proto(mbrlen) +libc_hidden_def(mbrlen)  #endif  /**********************************************************************/  #ifdef L_mbrtowc -size_t attribute_hidden __mbrtowc(wchar_t *__restrict pwc, const char *__restrict s, +libc_hidden_proto(mbsnrtowcs) + +size_t mbrtowc(wchar_t *__restrict pwc, const char *__restrict s,  			   size_t n, mbstate_t *__restrict ps)  {  	static mbstate_t mbstate;	/* Rely on bss 0-init. */ @@ -323,7 +317,7 @@ size_t attribute_hidden __mbrtowc(wchar_t *__restrict pwc, const char *__restric  #warning TODO: This adds a trailing nul!  #endif /* __UCLIBC_MJN3_ONLY__ */ -	r = __mbsnrtowcs(wcbuf, &p, SIZE_MAX, 1, ps); +	r = mbsnrtowcs(wcbuf, &p, SIZE_MAX, 1, ps);  	if (((ssize_t) r) >= 0) {  		if (pwc) { @@ -332,16 +326,19 @@ size_t attribute_hidden __mbrtowc(wchar_t *__restrict pwc, const char *__restric  	}  	return (size_t) r;  } -strong_alias(__mbrtowc,mbrtowc) +libc_hidden_proto(mbrtowc) +libc_hidden_def(mbrtowc)  #endif  /**********************************************************************/  #ifdef L_wcrtomb +libc_hidden_proto(wcsnrtombs) +  /* Note: We completely ignore ps in all currently supported conversions. */  /* TODO: Check for valid state anyway? */ -size_t attribute_hidden __wcrtomb(register char *__restrict s, wchar_t wc, +size_t wcrtomb(register char *__restrict s, wchar_t wc,  			   mbstate_t *__restrict ps)  {  #ifdef __UCLIBC_MJN3_ONLY__ @@ -360,24 +357,28 @@ size_t attribute_hidden __wcrtomb(register char *__restrict s, wchar_t wc,  	pwc = wcbuf;  	wcbuf[0] = wc; -	r = __wcsnrtombs(s, &pwc, 1, MB_LEN_MAX, ps); +	r = wcsnrtombs(s, &pwc, 1, MB_LEN_MAX, ps);  	return (r != 0) ? r : 1;  } -strong_alias(__wcrtomb,wcrtomb) +libc_hidden_proto(wcrtomb) +libc_hidden_def(wcrtomb)  #endif  /**********************************************************************/  #ifdef L_mbsrtowcs -size_t attribute_hidden __mbsrtowcs(wchar_t *__restrict dst, const char **__restrict src, +libc_hidden_proto(mbsnrtowcs) + +size_t mbsrtowcs(wchar_t *__restrict dst, const char **__restrict src,  				 size_t len, mbstate_t *__restrict ps)  {  	static mbstate_t mbstate;	/* Rely on bss 0-init. */ -	return __mbsnrtowcs(dst, src, SIZE_MAX, len, +	return mbsnrtowcs(dst, src, SIZE_MAX, len,  						((ps != NULL) ? ps : &mbstate));  } -strong_alias(__mbsrtowcs,mbsrtowcs) +libc_hidden_proto(mbsrtowcs) +libc_hidden_def(mbsrtowcs)  #endif  /**********************************************************************/ @@ -387,12 +388,15 @@ strong_alias(__mbsrtowcs,mbsrtowcs)   * TODO: Check for valid state anyway? */ -size_t attribute_hidden __wcsrtombs(char *__restrict dst, const wchar_t **__restrict src, +libc_hidden_proto(wcsnrtombs) + +size_t wcsrtombs(char *__restrict dst, const wchar_t **__restrict src,  				 size_t len, mbstate_t *__restrict ps)  { -	return __wcsnrtombs(dst, src, SIZE_MAX, len, ps); +	return wcsnrtombs(dst, src, SIZE_MAX, len, ps);  } -strong_alias(__wcsrtombs,wcsrtombs) +libc_hidden_proto(wcsrtombs) +libc_hidden_def(wcsrtombs)  #endif  /**********************************************************************/ @@ -686,11 +690,11 @@ size_t attribute_hidden _wchar_wcsntoutf8s(char *__restrict s, size_t n,  #endif  /**********************************************************************/ -#ifdef L___mbsnrtowcs +#ifdef L_mbsnrtowcs  /* WARNING: We treat len as SIZE_MAX when dst is NULL! */ -size_t attribute_hidden __mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, +size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,  					size_t NMC, size_t len, mbstate_t *__restrict ps)  {  	static mbstate_t mbstate;	/* Rely on bss 0-init. */ @@ -788,18 +792,19 @@ size_t attribute_hidden __mbsnrtowcs(wchar_t *__restrict dst, const char **__res  	}  	return len - count;  } -weak_alias(__mbsnrtowcs,mbsnrtowcs) +libc_hidden_proto(mbsnrtowcs) +libc_hidden_def(mbsnrtowcs)  #endif  /**********************************************************************/ -#ifdef L___wcsnrtombs +#ifdef L_wcsnrtombs  /* WARNING: We treat len as SIZE_MAX when dst is NULL! */  /* Note: We completely ignore ps in all currently supported conversions.   * TODO: Check for valid state anyway? */ -size_t attribute_hidden __wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, +size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,  					size_t NWC, size_t len, mbstate_t *__restrict ps)  {  	const __uwchar_t *s; @@ -907,7 +912,8 @@ size_t attribute_hidden __wcsnrtombs(char *__restrict dst, const wchar_t **__res  	}  	return len - count;  } -weak_alias(__wcsnrtombs,wcsnrtombs) +libc_hidden_proto(wcsnrtombs) +libc_hidden_def(wcsnrtombs)  #endif  /**********************************************************************/ @@ -1027,7 +1033,9 @@ static const signed char new_wtbl[] = {  	0,    2,    1,    2,    1,    0,    1,   }; -int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n) +libc_hidden_proto(wcsnrtombs) + +int wcswidth(const wchar_t *pwcs, size_t n)  {      int h, l, m, count;      wchar_t wc; @@ -1047,7 +1055,7 @@ int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n)  		mbstate_t mbstate;  		mbstate.__mask = 0;			/* Initialize the mbstate. */ -		if (__wcsnrtombs(NULL, &pwcs, n, SIZE_MAX, &mbstate) == ((size_t) - 1)) { +		if (wcsnrtombs(NULL, &pwcs, n, SIZE_MAX, &mbstate) == ((size_t) - 1)) {  			return -1;  		}  	} @@ -1124,7 +1132,7 @@ int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n)  #else  /*  __UCLIBC_HAS_LOCALE__ */ -int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n) +int wcswidth(const wchar_t *pwcs, size_t n)  {  	int count;  	wchar_t wc; @@ -1147,17 +1155,18 @@ int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n)  #endif /*  __UCLIBC_HAS_LOCALE__ */ -strong_alias(__wcswidth,wcswidth) +libc_hidden_proto(wcswidth) +libc_hidden_def(wcswidth)  #endif  /**********************************************************************/  #ifdef L_wcwidth -extern int __wcswidth (__const wchar_t *__s, size_t __n) attribute_hidden; +libc_hidden_proto(wcswidth)  int wcwidth(wchar_t wc)  { -    return __wcswidth(&wc, 1); +    return wcswidth(&wc, 1);  }  #endif @@ -1256,13 +1265,15 @@ const unsigned char __iconv_codesets[] =  	"\x0b\x01""US-ASCII\x00"  	"\x07\x01""ASCII";			/* Must be last! (special case to save a nul) */ +libc_hidden_proto(strcasecmp) +  static int find_codeset(const char *name)  {  	const unsigned char *s;  	int codeset;  	for (s = __iconv_codesets ; *s ; s += *s) { -		if (!__strcasecmp(s+2, name)) { +		if (!strcasecmp(s+2, name)) {  			return s[1];  		}  	} @@ -1275,7 +1286,7 @@ static int find_codeset(const char *name)  	s = __LOCALE_DATA_CODESET_LIST;  	do {  		++codeset;		/* Increment codeset first. */ -		if (!__strcasecmp(__LOCALE_DATA_CODESET_LIST+*s, name)) { +		if (!strcasecmp(__LOCALE_DATA_CODESET_LIST+*s, name)) {  			return codeset;  		}  	} while (*++s); diff --git a/libc/misc/wchar/wstdio.c b/libc/misc/wchar/wstdio.c index 55e7fef6b..69287f871 100644 --- a/libc/misc/wchar/wstdio.c +++ b/libc/misc/wchar/wstdio.c @@ -49,12 +49,6 @@   * Should auto_wr_transition init the mbstate object?  */ -#define wcslen __wcslen -#define wcsrtombs __wcsrtombs -#define mbrtowc __mbrtowc -#define wcrtomb __wcrtomb -#define fflush_unlocked __fflush_unlocked -  #define _GNU_SOURCE  #include <stdio.h>  #include <wchar.h> @@ -168,6 +162,8 @@ static void munge_stream(register FILE *stream, unsigned char *buf)  	stream->bufpos = stream->bufread = stream->bufend = stream->bufstart = buf;  } +libc_hidden_proto(mbrtowc) +  UNLOCKED(wint_t,fgetwc,(register FILE *stream),(stream))  {  	wint_t wi; @@ -263,6 +259,8 @@ UNLOCKED(wint_t,fgetwc,(register FILE *stream),(stream))  	return wi;  } +libc_hidden_proto(fgetwc_unlocked) +libc_hidden_def(fgetwc_unlocked)  strong_alias(fgetwc_unlocked,getwc_unlocked)  strong_alias(fgetwc,getwc) @@ -271,6 +269,8 @@ strong_alias(fgetwc,getwc)  /**********************************************************************/  #ifdef L_getwchar +libc_hidden_proto(fgetwc_unlocked) +  UNLOCKED_STREAM(wint_t,getwchar,(void),(),stdin)  {  	register FILE *stream = stdin; /* This helps bcc optimize. */ @@ -282,6 +282,8 @@ UNLOCKED_STREAM(wint_t,getwchar,(void),(),stdin)  /**********************************************************************/  #ifdef L_fgetws +libc_hidden_proto(fgetwc_unlocked) +  UNLOCKED(wchar_t *,fgetws,(wchar_t *__restrict ws, int n,  						   FILE *__restrict stream),(ws, n, stream))  { @@ -289,7 +291,7 @@ UNLOCKED(wchar_t *,fgetws,(wchar_t *__restrict ws, int n,  	wint_t wi;  	while ((n > 1) -		   && ((wi = __fgetwc_unlocked(stream)) != WEOF) +		   && ((wi = fgetwc_unlocked(stream)) != WEOF)  		   && ((*p++ = wi) != '\n')  		   ) {  		--n; @@ -309,6 +311,8 @@ UNLOCKED(wchar_t *,fgetws,(wchar_t *__restrict ws, int n,  /**********************************************************************/  #ifdef L_fputwc +/* libc_hidden_proto(wcrtomb) */ +  UNLOCKED(wint_t,fputwc,(wchar_t wc, FILE *stream),(wc, stream))  {  #if 1 @@ -329,6 +333,8 @@ UNLOCKED(wint_t,fputwc,(wchar_t wc, FILE *stream),(wc, stream))  		? wc : WEOF;  #endif  } +libc_hidden_proto(fputwc_unlocked) +libc_hidden_def(fputwc_unlocked)  strong_alias(fputwc_unlocked,putwc_unlocked)  strong_alias(fputwc,putwc) @@ -337,6 +343,8 @@ strong_alias(fputwc,putwc)  /**********************************************************************/  #ifdef L_putwchar +libc_hidden_proto(fputwc_unlocked) +  UNLOCKED_STREAM(wint_t,putwchar,(wchar_t wc),(wc),stdout)  {  	register FILE *stream = stdout; /* This helps bcc optimize. */ @@ -348,6 +356,9 @@ UNLOCKED_STREAM(wint_t,putwchar,(wchar_t wc),(wc),stdout)  /**********************************************************************/  #ifdef L_fputws +libc_hidden_proto(wcslen) +/* libc_hidden_proto(wcsrtombs) */ +  UNLOCKED(int,fputws,(const wchar_t *__restrict ws,  					 register FILE *__restrict stream),(ws, stream))  { @@ -393,6 +404,8 @@ UNLOCKED(int,fputws,(const wchar_t *__restrict ws,  /* Reentrant. */ +libc_hidden_proto(fflush_unlocked) +  wint_t ungetwc(wint_t c, register FILE *stream)  {  	__STDIO_THREADLOCK(stream); diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c index 659000558..0be119a57 100644 --- a/libc/misc/wctype/wctype.c +++ b/libc/misc/wctype/wctype.c @@ -38,9 +38,11 @@  #include <stdint.h>  #include <bits/uClibc_uwchar.h> -extern wctype_t __wctype (__const char *__property) attribute_hidden; -extern wint_t __towlower (wint_t __wc) __THROW attribute_hidden; -extern wint_t __towupper (wint_t __wc) __THROW attribute_hidden; +libc_hidden_proto(strcmp) +libc_hidden_proto(towlower) +libc_hidden_proto(towupper) +libc_hidden_proto(towctrans) +libc_hidden_proto(iswctype)  #if defined(__LOCALE_C_ONLY) && defined(__UCLIBC_DO_XLOCALE)  #error xlocale functionality is not supported in stub locale mode. @@ -48,10 +50,10 @@ extern wint_t __towupper (wint_t __wc) __THROW attribute_hidden;  #ifdef __UCLIBC_HAS_XLOCALE__  #include <xlocale.h> -extern wint_t __towlower_l(wint_t __wc, __locale_t __locale) __THROW attribute_hidden; -extern wint_t __towupper_l(wint_t __wc, __locale_t __locale) __THROW attribute_hidden; -extern int __iswctype_l(wint_t __wc, wctype_t __desc, __locale_t __locale) __THROW attribute_hidden; -extern wint_t __towctrans_l(wint_t __wc, wctrans_t __desc, __locale_t __locale) __THROW attribute_hidden; +libc_hidden_proto(towlower_l) +libc_hidden_proto(towupper_l) +libc_hidden_proto(towctrans_l) +libc_hidden_proto(iswctype_l)  #endif /* __UCLIBC_HAS_XLOCALE__ */  /* We know wide char support is enabled.  We wouldn't be here otherwise. */ @@ -182,26 +184,23 @@ enum {  #ifdef __UCLIBC_DO_XLOCALE -extern int __iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) -     __THROW attribute_hidden; -  #define ISW_FUNC_BODY(NAME) \ -int attribute_hidden __PASTE3(__isw,NAME,_l) (wint_t wc, __locale_t l) \ +int __PASTE3(isw,NAME,_l) (wint_t wc, __locale_t l) \  { \ -	return __iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \ +	return iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \  } \ -weak_alias(__PASTE3(__isw,NAME,_l), __PASTE3(isw,NAME,_l)) +libc_hidden_proto(__PASTE3(isw,NAME,_l)); \ +libc_hidden_def(__PASTE3(isw,NAME,_l))  #else  /* __UCLIBC_DO_XLOCALE */ -extern int __iswctype (wint_t __wc, wctype_t __desc) __THROW attribute_hidden; -  #define ISW_FUNC_BODY(NAME) \ -int attribute_hidden __PASTE2(__isw,NAME) (wint_t wc) \ +int __PASTE2(isw,NAME) (wint_t wc) \  { \ -	return __iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \ +	return iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \  } \ -weak_alias(__PASTE2(__isw,NAME), __PASTE2(isw,NAME)) +libc_hidden_proto(__PASTE2(isw,NAME)); \ +libc_hidden_def(__PASTE2(isw,NAME))  #endif /* __UCLIBC_DO_XLOCALE */  /**********************************************************************/ @@ -280,9 +279,9 @@ ISW_FUNC_BODY(xdigit);  #if defined(L_towlower) || defined(L_towlower_l)  #ifdef L_towlower -#define TOWLOWER(w) __towlower(w) +#define TOWLOWER(w) towlower(w)  #else  /* L_towlower */ -#define TOWLOWER(w) __towlower_l(w, __locale_t locale) +#define TOWLOWER(w) towlower_l(w, __locale_t locale)  #undef __UCLIBC_CURLOCALE_DATA  #undef __UCLIBC_CURLOCALE  #define __UCLIBC_CURLOCALE_DATA (*locale) @@ -290,9 +289,9 @@ ISW_FUNC_BODY(xdigit);  #endif /* L_towlower */  #ifdef __UCLIBC_HAS_XLOCALE__ -#define TOWCTRANS(w,d) __towctrans_l(w,d, __UCLIBC_CURLOCALE) +#define TOWCTRANS(w,d) towctrans_l(w,d, __UCLIBC_CURLOCALE)  #else  /* __UCLIBC_HAS_XLOCALE__ */ -#define TOWCTRANS(w,d) __towctrans(w,d) +#define TOWCTRANS(w,d) towctrans(w,d)  #endif /* __UCLIBC_HAS_XLOCALE__ */  #define __C_towlower(wc) \ @@ -300,7 +299,7 @@ ISW_FUNC_BODY(xdigit);  #ifdef __LOCALE_C_ONLY -wint_t attribute_hidden __towlower(wint_t wc) +wint_t towlower(wint_t wc)  {  #ifdef __UCLIBC_HAS_CTYPE_TABLES__  	return __C_towlower(wc); @@ -317,14 +316,14 @@ wint_t attribute_hidden __towlower(wint_t wc)  #if defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towlower(wint_t wc) +wint_t towlower(wint_t wc)  { -	return __towctrans_l(wc, _CTYPE_tolower, __UCLIBC_CURLOCALE); +	return towctrans_l(wc, _CTYPE_tolower, __UCLIBC_CURLOCALE);  }  #else  /* defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) */ -wint_t attribute_hidden TOWLOWER(wint_t wc) +wint_t TOWLOWER(wint_t wc)  {  	return TOWCTRANS(wc, _CTYPE_tolower);  } @@ -335,14 +334,14 @@ wint_t attribute_hidden TOWLOWER(wint_t wc)  #if defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towlower(wint_t wc) +wint_t towlower(wint_t wc)  { -	return __towlower_l(wc, __UCLIBC_CURLOCALE); +	return towlower_l(wc, __UCLIBC_CURLOCALE);  }  #else  /* defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) */ -wint_t attribute_hidden TOWLOWER(wint_t wc) +wint_t TOWLOWER(wint_t wc)  {  	unsigned int sc, n, i;  	__uwchar_t u = wc; @@ -373,13 +372,15 @@ wint_t attribute_hidden TOWLOWER(wint_t wc)  #endif /* SMALL_UPLOW */  #ifdef L_towlower_l -strong_alias(__towlower_l,towlower_l) +//libc_hidden_proto(towlower_l) +libc_hidden_def(towlower_l)  #endif /* L_towlower_l */  #endif /* __LOCALE_C_ONLY */  #ifndef L_towlower_l -strong_alias(__towlower,towlower) +//libc_hidden_proto(towlower) +libc_hidden_def(towlower)  #endif  #endif @@ -387,9 +388,9 @@ strong_alias(__towlower,towlower)  #if defined(L_towupper) || defined(L_towupper_l)  #ifdef L_towupper -#define TOWUPPER(w) __towupper(w) +#define TOWUPPER(w) towupper(w)  #else  /* L_towupper */ -#define TOWUPPER(w) __towupper_l(w, __locale_t locale) +#define TOWUPPER(w) towupper_l(w, __locale_t locale)  #undef __UCLIBC_CURLOCALE_DATA  #undef __UCLIBC_CURLOCALE  #define __UCLIBC_CURLOCALE_DATA (*locale) @@ -397,9 +398,9 @@ strong_alias(__towlower,towlower)  #endif /* L_towupper */  #ifdef __UCLIBC_HAS_XLOCALE__ -#define TOWCTRANS(w,d) __towctrans_l(w,d, __UCLIBC_CURLOCALE) +#define TOWCTRANS(w,d) towctrans_l(w,d, __UCLIBC_CURLOCALE)  #else  /* __UCLIBC_HAS_XLOCALE__ */ -#define TOWCTRANS(w,d) __towctrans(w,d) +#define TOWCTRANS(w,d) towctrans(w,d)  #endif /* __UCLIBC_HAS_XLOCALE__ */  #define __C_towupper(wc) \ @@ -407,7 +408,7 @@ strong_alias(__towlower,towlower)  #ifdef __LOCALE_C_ONLY -wint_t attribute_hidden __towupper(wint_t wc) +wint_t towupper(wint_t wc)  {  #ifdef __UCLIBC_HAS_CTYPE_TABLES__  	return __C_towupper(wc); @@ -425,14 +426,14 @@ wint_t attribute_hidden __towupper(wint_t wc)  #if defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towupper(wint_t wc) +wint_t towupper(wint_t wc)  { -	return __towctrans_l(wc, _CTYPE_toupper, __UCLIBC_CURLOCALE); +	return towctrans_l(wc, _CTYPE_toupper, __UCLIBC_CURLOCALE);  }  #else  /* defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) */ -wint_t attribute_hidden TOWUPPER(wint_t wc) +wint_t TOWUPPER(wint_t wc)  {  	return TOWCTRANS(wc, _CTYPE_toupper);  } @@ -443,14 +444,14 @@ wint_t attribute_hidden TOWUPPER(wint_t wc)  #if defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towupper(wint_t wc) +wint_t towupper(wint_t wc)  { -	return __towupper_l(wc, __UCLIBC_CURLOCALE); +	return towupper_l(wc, __UCLIBC_CURLOCALE);  }  #else  /* defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) */ -wint_t attribute_hidden TOWUPPER(wint_t wc) +wint_t TOWUPPER(wint_t wc)  {  	unsigned int sc, n, i;  	__uwchar_t u = wc; @@ -481,13 +482,15 @@ wint_t attribute_hidden TOWUPPER(wint_t wc)  #endif /* SMALL_UPLOW */  #ifdef L_towupper_l -strong_alias(__towupper_l,towupper_l) +//libc_hidden_proto(towupper_l) +libc_hidden_def(towupper_l)  #endif /* L_towupper_l */  #endif /* __LOCALE_C_ONLY */  #ifndef L_towupper_l -strong_alias(__towupper,towupper) +//libc_hidden_proto(towupper) +libc_hidden_def(towupper)  #endif  #endif @@ -497,7 +500,7 @@ strong_alias(__towupper,towupper)  static const unsigned char typestring[] = __CTYPE_TYPESTRING;  /*  extern const unsigned char typestring[]; */ -wctype_t attribute_hidden __wctype(const char *property) +wctype_t wctype(const char *property)  {  	const unsigned char *p;  	int i; @@ -505,7 +508,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; @@ -515,7 +518,8 @@ wctype_t attribute_hidden __wctype(const char *property)  	/* TODO - Add locale-specific classifications. */  	return 0;  } -strong_alias(__wctype,wctype) +libc_hidden_proto(wctype) +libc_hidden_def(wctype)  #endif  /**********************************************************************/ @@ -525,12 +529,14 @@ strong_alias(__wctype,wctype)  #warning REMINDER: Currently wctype_l simply calls wctype.  #endif /* __UCLIBC_MJN3_ONLY__ */ -wctype_t attribute_hidden __wctype_l (const char *property, __locale_t locale) +libc_hidden_proto(wctype) + +wctype_t wctype_l (const char *property, __locale_t locale)  { -	return __wctype(property); +	return wctype(property);  } - -weak_alias(__wctype_l, wctype_l) +libc_hidden_proto(wctype_l) +libc_hidden_def(wctype_l)  #endif  /**********************************************************************/ @@ -579,7 +585,7 @@ static const unsigned short int desc2flag[] = {  #ifdef __UCLIBC_HAS_CTYPE_TABLES__ -int attribute_hidden __iswctype(wint_t wc, wctype_t desc) +int iswctype(wint_t wc, wctype_t desc)  {  	/* Note... wctype_t is unsigned. */ @@ -593,7 +599,7 @@ int attribute_hidden __iswctype(wint_t wc, wctype_t desc)  #else  /* __UCLIBC_HAS_CTYPE_TABLES__ */ -int attribute_hidden __iswctype(wint_t wc, wctype_t desc) +int iswctype(wint_t wc, wctype_t desc)  {  	/* This is lame, but it is here just to get it working for now. */ @@ -641,9 +647,9 @@ int attribute_hidden __iswctype(wint_t wc, wctype_t desc)  #endif /* __UCLIBC_MJN3_ONLY__ */  #ifdef L_iswctype -#define ISWCTYPE(w,d) __iswctype(w,d) +#define ISWCTYPE(w,d) iswctype(w,d)  #else  /* L_iswctype */ -#define ISWCTYPE(w,d) __iswctype_l(w,d, __locale_t locale) +#define ISWCTYPE(w,d) iswctype_l(w,d, __locale_t locale)  #undef __UCLIBC_CURLOCALE_DATA  #undef __UCLIBC_CURLOCALE  #define __UCLIBC_CURLOCALE_DATA (*locale) @@ -652,14 +658,14 @@ int attribute_hidden __iswctype(wint_t wc, wctype_t desc)  #if defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) -int attribute_hidden __iswctype(wint_t wc, wctype_t desc) +int iswctype(wint_t wc, wctype_t desc)  { -	return __iswctype_l(wc, desc, __UCLIBC_CURLOCALE); +	return iswctype_l(wc, desc, __UCLIBC_CURLOCALE);  }  #else  /* defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) */ -int attribute_hidden ISWCTYPE(wint_t wc, wctype_t desc) +int ISWCTYPE(wint_t wc, wctype_t desc)  {  	unsigned int sc, n, i0, i1;  	unsigned char d = __CTYPE_unclassified; @@ -709,13 +715,15 @@ int attribute_hidden ISWCTYPE(wint_t wc, wctype_t desc)  #endif /* defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) */  #ifdef L_iswctype_l -weak_alias(__iswctype_l, iswctype_l) +//libc_hidden_proto(iswctype_l) +libc_hidden_def(iswctype_l)  #endif /* L_iswctype_l */  #endif /* __LOCALE_C_ONLY */  #ifdef L_iswctype -weak_alias(__iswctype, iswctype) +//libc_hidden_proto(iswctype) +libc_hidden_def(iswctype)  #endif /* L_iswctype */  #endif @@ -728,14 +736,14 @@ weak_alias(__iswctype, iswctype)  #ifndef _tolower  #warning _tolower is undefined! -#define _tolower(c)    __tolower(c) +#define _tolower(c)    tolower(c)  #endif  #ifndef _toupper  #warning _toupper is undefined! -#define _toupper(c)    __toupper(c) +#define _toupper(c)    toupper(c)  #endif -wint_t attribute_hidden __towctrans(wint_t wc, wctrans_t desc) +wint_t towctrans(wint_t wc, wctrans_t desc)  {  	if (((unsigned int)(desc - _CTYPE_tolower))  		<= (_CTYPE_toupper - _CTYPE_tolower) @@ -753,9 +761,9 @@ wint_t attribute_hidden __towctrans(wint_t wc, wctrans_t desc)  #else  /* __LOCALE_C_ONLY */  #ifdef L_towctrans -#define TOWCTRANS(w,d) __towctrans(w,d) +#define TOWCTRANS(w,d) towctrans(w,d)  #else  /* L_towctrans */ -#define TOWCTRANS(w,d) __towctrans_l(w,d, __locale_t locale) +#define TOWCTRANS(w,d) towctrans_l(w,d, __locale_t locale)  #undef __UCLIBC_CURLOCALE_DATA  #undef __UCLIBC_CURLOCALE  #define __UCLIBC_CURLOCALE_DATA (*locale) @@ -763,25 +771,25 @@ wint_t attribute_hidden __towctrans(wint_t wc, wctrans_t desc)  #endif /* L_towctrans */  #ifdef __UCLIBC_HAS_XLOCALE__ -#define TOWLOWER(w,l) __towlower_l(w,l) -#define TOWUPPER(w,l) __towupper_l(w,l) +#define TOWLOWER(w,l) towlower_l(w,l) +#define TOWUPPER(w,l) towupper_l(w,l)  #else  /* __UCLIBC_HAS_XLOCALE__ */ -#define TOWLOWER(w,l) __towlower(w) -#define TOWUPPER(w,l) __towupper(w) +#define TOWLOWER(w,l) towlower(w) +#define TOWUPPER(w,l) towupper(w)  #endif /* __UCLIBC_HAS_XLOCALE__ */  #if defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towctrans(wint_t wc, wctrans_t desc) +wint_t towctrans(wint_t wc, wctrans_t desc)  { -	return __towctrans_l(wc, desc, __UCLIBC_CURLOCALE); +	return towctrans_l(wc, desc, __UCLIBC_CURLOCALE);  }  #else  /* defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__) */  #ifdef SMALL_UPLOW -wint_t attribute_hidden TOWCTRANS(wint_t wc, wctrans_t desc) +wint_t TOWCTRANS(wint_t wc, wctrans_t desc)  {  	unsigned int sc, n, i;  	__uwchar_t u = wc; @@ -839,7 +847,7 @@ wint_t attribute_hidden TOWCTRANS(wint_t wc, wctrans_t desc)  #else  /* SMALL_UPLOW */ -wint_t attribute_hidden TOWCTRANS(wint_t wc, wctrans_t desc) +wint_t TOWCTRANS(wint_t wc, wctrans_t desc)  {  	if (ENCODING == __ctype_encoding_7_bit) {  		if ((((__uwchar_t) wc) > 0x7f) @@ -882,13 +890,15 @@ wint_t attribute_hidden TOWCTRANS(wint_t wc, wctrans_t desc)  #endif /* defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__) */  #ifdef L_towctrans_l -strong_alias(__towctrans_l, towctrans_l) +//libc_hidden_proto(towctrans_l) +libc_hidden_def(towctrans_l)  #endif /* L_towctrans_l */  #endif /* __LOCALE_C_ONLY */  #ifndef L_towctrans_l -strong_alias(__towctrans,towctrans) +//libc_hidden_proto(towctrans) +libc_hidden_def(towctrans)  #endif  #endif @@ -897,7 +907,7 @@ strong_alias(__towctrans,towctrans)  static const char transstring[] = __CTYPE_TRANSTRING; -wctrans_t attribute_hidden __wctrans(const char *property) +wctrans_t wctrans(const char *property)  {  	const unsigned char *p;  	int i; @@ -905,7 +915,7 @@ wctrans_t attribute_hidden __wctrans(const char *property)  	p = transstring;  	i = 1;  	do { -		if (!__strcmp(property, ++p)) { +		if (!strcmp(property, ++p)) {  			return i;  		}  		++i; @@ -915,7 +925,8 @@ wctrans_t attribute_hidden __wctrans(const char *property)  	/* TODO - Add locale-specific translations. */  	return 0;  } -strong_alias(__wctrans,wctrans) +libc_hidden_proto(wctrans) +libc_hidden_def(wctrans)  #endif  /**********************************************************************/ @@ -925,14 +936,12 @@ strong_alias(__wctrans,wctrans)  #warning REMINDER: Currently wctrans_l simply calls wctrans.  #endif /* __UCLIBC_MJN3_ONLY__ */ -extern wctrans_t __wctrans (__const char *__property) __THROW attribute_hidden; +libc_hidden_proto(wctrans) -wctrans_t __wctrans_l(const char *property, __locale_t locale) +wctrans_t wctrans_l(const char *property, __locale_t locale)  { -	return __wctrans(property); +	return wctrans(property);  } -weak_alias(__wctrans_l, wctrans_l) -  #endif  /**********************************************************************/ diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index a91e64e3c..70d43e1e1 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -19,25 +19,6 @@     write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,     Boston, MA 02111-1307, USA.  */ -#define mempcpy __mempcpy -#define stpcpy __stpcpy -#define strndup __strndup -#define strspn __strspn -#define strcspn __strcspn -#define setenv __setenv -#define unsetenv __unsetenv -#define waitpid __waitpid -#define kill __kill -#define getuid __getuid -#define getpwnam_r __getpwnam_r -#define getpwuid_r __getpwuid_r -#define execve __execve -#define dup2 __dup2 -#define atoi __atoi -#define fnmatch __fnmatch -#define pipe __pipe -#define fork __fork -  #define _GNU_SOURCE  #include <features.h>  #include <sys/types.h> @@ -55,6 +36,37 @@  #include <glob.h>  #include <wordexp.h> +libc_hidden_proto(mempcpy) +libc_hidden_proto(stpcpy) +libc_hidden_proto(strchr) +libc_hidden_proto(strcpy) +libc_hidden_proto(strdup) +libc_hidden_proto(strlen) +libc_hidden_proto(strndup) +libc_hidden_proto(strspn) +libc_hidden_proto(strcspn) +libc_hidden_proto(setenv) +libc_hidden_proto(unsetenv) +libc_hidden_proto(waitpid) +libc_hidden_proto(kill) +libc_hidden_proto(getuid) +libc_hidden_proto(getpwnam_r) +libc_hidden_proto(getpwuid_r) +libc_hidden_proto(execve) +libc_hidden_proto(dup2) +libc_hidden_proto(atoi) +libc_hidden_proto(fnmatch) +libc_hidden_proto(pipe) +libc_hidden_proto(fork) +libc_hidden_proto(open) +libc_hidden_proto(close) +libc_hidden_proto(read) +libc_hidden_proto(getenv) +libc_hidden_proto(getpid) +libc_hidden_proto(sprintf) +libc_hidden_proto(fprintf) +libc_hidden_proto(abort) +  extern void __wordfree (wordexp_t *__wordexp) __THROW attribute_hidden;  extern int __glob (__const char *__restrict __pattern, int __flags,  		 int (*__errfunc) (__const char *, int), @@ -155,7 +167,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);  } @@ -170,7 +182,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;  	} @@ -272,7 +284,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;  			} @@ -303,7 +315,7 @@ parse_tilde(char **word, size_t * word_length, size_t * max_length,  		   results are unspecified.  We do a lookup on the uid if  		   HOME is unset. */ -		home = __getenv("HOME"); +		home = getenv("HOME");  		if (home != NULL) {  			*word = w_addstr(*word, word_length, max_length, home);  			if (*word == NULL) @@ -397,7 +409,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); @@ -424,8 +436,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; @@ -515,7 +527,7 @@ static int eval_expr(char *expr, long int *result);  static char *_itoa(unsigned long long int value, char *buflim)  { -	__sprintf(buflim, "%llu", value); +	sprintf(buflim, "%llu", value);  	return buflim;  } @@ -782,24 +794,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?  */ @@ -832,8 +844,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;  	} @@ -842,17 +854,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;  			} @@ -875,17 +887,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 @@ -979,7 +991,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) { @@ -1002,7 +1014,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;  } @@ -1201,7 +1213,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]); @@ -1237,7 +1249,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; @@ -1348,7 +1360,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,  		/* Is it `$$'? */  		if (*env == '$') {  			buffer[20] = '\0'; -			value = _itoa(__getpid(), &buffer[20]); +			value = _itoa(getpid(), &buffer[20]);  		}  		/* Is it `${#*}' or `${#@}'? */  		else if ((*env == '*' || *env == '@') && seen_hash) { @@ -1369,7 +1381,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; @@ -1399,7 +1411,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; @@ -1415,7 +1427,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,  			}  		}  	} else -		value = __getenv(env); +		value = getenv(env);  	if (value == NULL && (flags & WRDE_UNDEF)) {  		/* Variable not defined. */ @@ -1579,7 +1591,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: @@ -1589,7 +1601,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); @@ -1613,7 +1625,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); @@ -1717,7 +1729,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) @@ -1730,7 +1742,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) @@ -1759,7 +1771,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) @@ -1783,7 +1795,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,  									¶m_length[20]));  		if (free_value) {  			assert(value != NULL); @@ -1805,7 +1817,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; @@ -1845,7 +1857,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++;  			} @@ -2088,11 +2100,11 @@ int wordexp(const char *words, wordexp_t * we, int flags)  	/* Find out what the field separators are.  	 * There are two types: whitespace and non-whitespace.  	 */ -	ifs = __getenv("IFS"); +	ifs = getenv("IFS");  	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; @@ -2211,11 +2223,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;  | 
