From 403d3b6c026812d82647eabf9370722f3f1e7893 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Fri, 16 Dec 2005 01:18:01 +0000 Subject: Convert all the rest, remove isxupper/isxlower, if someone objects, I'll add it back --- libc/misc/wordexp/wordexp.c | 30 +++++++++++++++---------- libc/pwd_grp/pwd_grp.c | 7 ++++-- libc/stdlib/malloc/heap_debug.c | 4 ++-- libc/stdlib/malloc/malloc.h | 2 ++ libc/stdlib/malloc/malloc_debug.c | 4 ++-- libc/stdlib/stdlib.c | 2 +- libc/stdlib/system.c | 4 +++- libc/stdlib/unix_grantpt.c | 8 ++++--- libc/string/wstring.c | 7 +++--- libc/sysdeps/linux/arm/ioperm.c | 1 + libc/sysdeps/linux/common/_exit.c | 2 +- libc/sysdeps/linux/common/bits/uClibc_ctype.h | 32 +-------------------------- libc/termios/ttyname.c | 3 ++- libc/unistd/daemon.c | 5 +++-- libc/unistd/getpass.c | 6 ++++- libc/unistd/usershell.c | 1 + 16 files changed, 56 insertions(+), 62 deletions(-) (limited to 'libc') diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index f2c3d3331..a91e64e3c 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -23,6 +23,8 @@ #define stpcpy __stpcpy #define strndup __strndup #define strspn __strspn +#define strcspn __strcspn +#define setenv __setenv #define unsetenv __unsetenv #define waitpid __waitpid #define kill __kill @@ -34,10 +36,7 @@ #define atoi __atoi #define fnmatch __fnmatch #define pipe __pipe -#if 0 -#define glob __glob -#define globfree __globfree -#endif +#define fork __fork #define _GNU_SOURCE #include @@ -56,6 +55,12 @@ #include #include +extern void __wordfree (wordexp_t *__wordexp) __THROW 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 __WORDEXP_FULL //#undef __WORDEXP_FULL @@ -362,7 +367,7 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length, int match; glob_t globbuf; - error = glob(glob_word, GLOB_NOCHECK, NULL, &globbuf); + error = __glob(glob_word, GLOB_NOCHECK, NULL, &globbuf); if (error != 0) { /* We can only run into memory problems. */ @@ -381,7 +386,7 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length, globbuf.gl_pathv[match]); } - globfree(&globbuf); + __globfree(&globbuf); return *word ? 0 : WRDE_NOSPACE; } @@ -395,12 +400,12 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length, char *matching_word = __strdup(globbuf.gl_pathv[match]); if (matching_word == NULL || w_addword(pwordexp, matching_word)) { - globfree(&globbuf); + __globfree(&globbuf); return WRDE_NOSPACE; } } - globfree(&globbuf); + __globfree(&globbuf); return 0; } @@ -483,7 +488,7 @@ parse_glob(char **word, size_t * word_length, size_t * max_length, /* Now tidy up */ tidy_up: - wordfree(&glob_list); + __wordfree(&glob_list); return error; } @@ -2023,7 +2028,7 @@ parse_dquote(char **word, size_t * word_length, size_t * max_length, * wordfree() is to be called after pwordexp is finished with. */ -void wordfree(wordexp_t * pwordexp) +void attribute_hidden __wordfree(wordexp_t * pwordexp) { /* wordexp can set pwordexp to NULL */ @@ -2037,6 +2042,7 @@ void wordfree(wordexp_t * pwordexp) pwordexp->we_wordv = NULL; } } +strong_alias(__wordfree,wordfree) /* * wordexp() @@ -2055,7 +2061,7 @@ int wordexp(const char *words, wordexp_t * we, int flags) if (flags & WRDE_REUSE) { /* Minimal implementation of WRDE_REUSE for now */ - wordfree(we); + __wordfree(we); old_word.we_wordv = NULL; } @@ -2257,7 +2263,7 @@ int wordexp(const char *words, wordexp_t * we, int flags) return WRDE_NOSPACE; if ((flags & WRDE_APPEND) == 0) - wordfree(we); + __wordfree(we); *we = old_word; return error; diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index 82c99360a..0f7c564f0 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -21,6 +21,7 @@ #define setgroups __setgroups #define strtoul __strtoul #define rewind __rewind +#define fgets_unlocked __fgets_unlocked #define _GNU_SOURCE #include @@ -51,6 +52,8 @@ extern int __getpwuid_r (__uid_t __uid, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) attribute_hidden; +extern int __fputc_unlocked_internal(int c, FILE *stream) attribute_hidden; + /**********************************************************************/ /* Sizes for staticly allocated buffers. */ @@ -806,7 +809,7 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f) do { if (!*m) { - if (fputc_unlocked('\n', f) >= 0) { + if (__fputc_unlocked_internal('\n', f) >= 0) { rv = 0; } break; @@ -872,7 +875,7 @@ int putspent(const struct spwd *p, FILE *stream) goto DO_UNLOCK; } - if (fputc_unlocked('\n', stream) > 0) { + if (__fputc_unlocked_internal('\n', stream) > 0) { rv = 0; } diff --git a/libc/stdlib/malloc/heap_debug.c b/libc/stdlib/malloc/heap_debug.c index 4804ba9ee..7dab95627 100644 --- a/libc/stdlib/malloc/heap_debug.c +++ b/libc/stdlib/malloc/heap_debug.c @@ -80,13 +80,13 @@ __heap_check_failure (struct heap *heap, struct heap_free_area *fa, vfprintf (stderr, fmt, val); va_end (val); - putc ('\n', stderr); + __putc ('\n', stderr); __malloc_debug_set_indent (0); __malloc_debug_printf (1, "heap dump:"); __heap_dump_freelist (heap); - exit (22); + __exit (22); } /* Do some consistency checks on HEAP. If they fail, output an error diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 08ebfdf5b..707cad13d 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -79,6 +79,8 @@ extern struct heap __malloc_mmb_heap; to stderr, when the variable __malloc_mmb_debug is set to true. */ #ifdef MALLOC_MMB_DEBUGGING # include +extern int __putc(int c, FILE *stream) attribute_hidden; + extern int __malloc_mmb_debug; # define MALLOC_MMB_DEBUG(indent, fmt, args...) \ (__malloc_mmb_debug ? __malloc_debug_printf (indent, fmt , ##args) : 0) diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c index e8711ff77..abe5546ca 100644 --- a/libc/stdlib/malloc/malloc_debug.c +++ b/libc/stdlib/malloc/malloc_debug.c @@ -42,7 +42,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...) while (spaces > 0) { - putc (' ', stderr); + __putc (' ', stderr); spaces--; } @@ -50,7 +50,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...) vfprintf (stderr, fmt, val); va_end (val); - putc ('\n', stderr); + __putc ('\n', stderr); __malloc_debug_indent (indent); } diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 3b7d37ccb..ab95c9378 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -724,7 +724,7 @@ unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wc /* void _Exit(int status) */ /* { */ -/* _exit(status); */ +/* _exit_internal(status); */ /* } */ /* #endif */ diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index 616d2dda6..a537156fd 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -1,6 +1,8 @@ #define wait4 __wait4 #define execl __execl #define signal __signal +#define vfork __vfork +#define fork __fork #include #include @@ -38,7 +40,7 @@ int __libc_system(char *command) signal(SIGCHLD, SIG_DFL); execl("/bin/sh", "sh", "-c", command, (char *) 0); - _exit(127); + _exit_internal(127); } /* Signals are not absolutly guarenteed with vfork */ signal(SIGQUIT, SIG_IGN); diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index c8dbf3cb3..0e7d50a99 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -24,6 +24,8 @@ #define waitpid __waitpid #define dup2 __dup2 #define chmod __chmod +#define vfork __vfork +#define fork __fork #include #include @@ -42,7 +44,7 @@ /* uClinux-2.0 has vfork, but Linux 2.0 doesn't */ #include #if ! defined __NR_vfork -#define vfork fork +#define vfork fork #endif extern int __ptsname_r (int fd, char *buf, size_t buflen) attribute_hidden; @@ -166,10 +168,10 @@ grantpt (int fd) /* We pase the master pseudo terminal as file descriptor PTY_FILENO. */ if (fd != PTY_FILENO) if (dup2 (fd, PTY_FILENO) < 0) - _exit (FAIL_EBADF); + _exit_internal (FAIL_EBADF); execle (_PATH_PT_CHOWN, _PATH_PT_CHOWN, NULL, NULL); - _exit (FAIL_EXEC); + _exit_internal (FAIL_EXEC); } else { diff --git a/libc/string/wstring.c b/libc/string/wstring.c index c3ac10667..baf99dbaf 100644 --- a/libc/string/wstring.c +++ b/libc/string/wstring.c @@ -81,6 +81,7 @@ extern wchar_t *__wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept) at extern int __wcscmp (__const wchar_t *__s1, __const wchar_t *__s2) attribute_hidden; extern size_t __wcsxfrm (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n) attribute_hidden; +extern wint_t __towlower (wint_t __wc) __THROW attribute_hidden; #endif #ifdef __UCLIBC_HAS_XLOCALE__ extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l) attribute_hidden; @@ -1263,7 +1264,7 @@ strong_alias(__ffs, ffs) #ifdef __UCLIBC_DO_XLOCALE #define TOLOWER(C) __towlower_l((C), locale_arg) #else -#define TOLOWER(C) towlower((C)) +#define TOLOWER(C) __towlower((C)) #endif #else /* defined(L_wcscasecmp) || defined(L_wcscasecmp_l) */ @@ -1328,7 +1329,7 @@ __UCXL_ALIAS(strcasecmp) #ifdef __UCLIBC_DO_XLOCALE #define TOLOWER(C) __towlower_l((C), locale_arg) #else -#define TOLOWER(C) towlower((C)) +#define TOLOWER(C) __towlower((C)) #endif #else /* defined(L_wcsncasecmp) || defined(L_wcsncasecmp_l) */ @@ -2113,7 +2114,7 @@ char attribute_hidden *__strsep(char ** __restrict s1, const char * __restrict s *p++ = 0; } #else - if (s && *s && *(p = s + strcspn(s, s2))) { + if (s && *s && *(p = s + __strcspn(s, s2))) { *p++ = 0; } else { p = NULL; diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index 837de8adf..0c0c21182 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -37,6 +37,7 @@ #define mmap __mmap #define sscanf __sscanf #define fscanf __fscanf +#define fgets __fgets #include #include diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index a36f5a128..4e450bbc5 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -34,7 +34,7 @@ static inline _syscall1(void, __syscall_exit, int, status); #undef _exit #undef _exit_internal -void attribute_noreturn _exit_internal(int status) +void attribute_noreturn attribute_hidden _exit_internal(int status) { /* The loop is added only to keep gcc happy. */ while(1) diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index 7c2d412cf..50cbd6bb2 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -134,17 +134,6 @@ enum { #define __C_tolower(c) (__C_isupper(c) ? ((c) | 0x20) : (c)) #define __C_toupper(c) (__C_islower(c) ? ((c) ^ 0x20) : (c)) -#define __C_isxlower(c) \ - (__C_isdigit(c) \ - || ((sizeof(c) == sizeof(char)) \ - ? (((unsigned char)(((c)) - 'a')) < 6) \ - : (((unsigned int)(((c)) - 'a')) < 6))) -#define __C_isxupper(c) \ - (__C_isdigit(c) \ - || ((sizeof(c) == sizeof(char)) \ - ? (((unsigned char)(((c)) - 'A')) < 6) \ - : (((unsigned int)(((c)) - 'A')) < 6))) - /**********************************************************************/ __BEGIN_DECLS @@ -171,14 +160,7 @@ extern int isascii(int c) __THROW; extern int toascii(int c) __THROW; #endif -/* The following are included for compatibility with older versions of - * uClibc; but now they're only visible if MISC funcctionality is requested. - * However, as they are locale-independent, the hidden macro versions are - * always present. */ -#ifdef __USE_MISC -extern int isxlower(int c) __THROW; /* uClibc-specific. */ -extern int isxupper(int c) __THROW; /* uClibc-specific. */ - +#if defined _LIBC && (defined NOT_IN_libc || defined IS_IN_libc) /* isdigit() is really locale-invariant, so provide some small fast macros. * These are uClibc-specific. */ #define __isdigit_char(C) (((unsigned char)((C) - '0')) <= 9) @@ -203,12 +185,6 @@ extern int isxupper(int c) __THROW; /* uClibc-specific. */ #define _tolower(c) ((c) | 0x20) -/* For compatibility with older versions of uClibc. Are these ever used? */ -#if 0 -#define __isxlower(c) __C_isxlower(c) /* uClibc-specific. */ -#define __isxupper(c) __C_isxupper(c) /* uClibc-specific. */ -#endif - /* Apparently, glibc implements things as macros if __NO_CTYPE isn't defined. * If we don't have locale support, we'll do the same. Otherwise, we'll * only use macros for the supported-locale-invariant cases. */ @@ -264,9 +240,6 @@ __END_DECLS #define __ispunct(c) __body(ispunct,c) #define __isgraph(c) __body(isgraph,c) -#define __isxlower(c) __body(isxlower,c) -#define __isxupper(c) __body(isxupper,c) - #define __tolower(c) __body(tolower,c) #define __toupper(c) __body(toupper,c) @@ -285,9 +258,6 @@ __END_DECLS #define ispunct(c) __ispunct(c) #define isgraph(c) __isgraph(c) -#define isxlower(c) __isxlower(c) -#define isxupper(c) __isxupper(c) - #define tolower(c) __tolower(c) #define toupper(c) __toupper(c) diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c index a176dd7d4..271c9a4ab 100644 --- a/libc/termios/ttyname.c +++ b/libc/termios/ttyname.c @@ -1,5 +1,6 @@ #define opendir __opendir #define closedir __closedir +#define readdir __readdir #define isatty __isatty #include @@ -73,7 +74,7 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) continue; } - while ((d = __readdir(fp)) != NULL) { + while ((d = readdir(fp)) != NULL) { /* This should never trigger for standard names, but we * check it to be safe. */ if (__strlen(d->d_name) > len) { /* Too big? */ diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index 233dbbac4..4c18e55fa 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -26,6 +26,7 @@ #define dup2 __dup2 #define setsid __setsid #define chdir __chdir +#define fork __fork #include #include @@ -45,7 +46,7 @@ int daemon( int nochdir, int noclose ) case 0: break; default: - _exit(0); + _exit_internal(0); } if (setsid() == -1) @@ -54,7 +55,7 @@ int daemon( int nochdir, int noclose ) /* Make certain we are not a session leader, or else we * might reacquire a controlling terminal */ if (fork()) - _exit(0); + _exit_internal(0); if (!nochdir) chdir("/"); diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index a51c8e87f..834fba9d9 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -21,6 +21,8 @@ #define tcgetattr __tcgetattr #define fileno __fileno #define fflush __fflush +#define fgets __fgets +#define fputs __fputs #include #include @@ -28,6 +30,8 @@ #include #include +extern int __putc(int c, FILE *stream) attribute_hidden; + /* It is desirable to use this bit on systems that have it. The only bit of terminal state we want to twiddle is echoing, which is done in software; there is no need to change the state of the terminal @@ -95,7 +99,7 @@ getpass (prompt) buf[nread - 1] = '\0'; if (tty_changed) /* Write the newline that was not echoed. */ - putc('\n', out); + __putc('\n', out); } } diff --git a/libc/unistd/usershell.c b/libc/unistd/usershell.c index 143dc2630..bc29cf247 100644 --- a/libc/unistd/usershell.c +++ b/libc/unistd/usershell.c @@ -32,6 +32,7 @@ #define __fsetlocking __fsetlocking_internal #define fileno __fileno +#define fgets_unlocked __fgets_unlocked #define _GNU_SOURCE #include -- cgit v1.2.3