OSDN Git Service

Convert all the rest, remove isxupper/isxlower, if someone objects, I'll add it back
authorPeter S. Mazinger <ps.m@gmx.net>
Fri, 16 Dec 2005 01:18:01 +0000 (01:18 -0000)
committerPeter S. Mazinger <ps.m@gmx.net>
Fri, 16 Dec 2005 01:18:01 +0000 (01:18 -0000)
17 files changed:
include/ctype.h
libc/misc/wordexp/wordexp.c
libc/pwd_grp/pwd_grp.c
libc/stdlib/malloc/heap_debug.c
libc/stdlib/malloc/malloc.h
libc/stdlib/malloc/malloc_debug.c
libc/stdlib/stdlib.c
libc/stdlib/system.c
libc/stdlib/unix_grantpt.c
libc/string/wstring.c
libc/sysdeps/linux/arm/ioperm.c
libc/sysdeps/linux/common/_exit.c
libc/sysdeps/linux/common/bits/uClibc_ctype.h
libc/termios/ttyname.c
libc/unistd/daemon.c
libc/unistd/getpass.c
libc/unistd/usershell.c

index e003131..78cff7d 100644 (file)
@@ -136,18 +136,11 @@ extern const __ctype_touplow_t *__ctype_tolower;
 #define        __isascii(c)    (((c) & ~0x7f) == 0)    /* If C is a 7 bit value.  */
 #define        __toascii(c)    ((c) & 0x7f)            /* Mask off high bits.  */
 
-#ifdef __USE_MISC
-
-/* The following are included for compatibility with older versions of
- * uClibc; but now they're only visible if MISC funcctionality is requested. */
-extern int isxlower(int c) __THROW;
-extern int isxupper(int c) __THROW;
-
+#if defined _LIBC && (defined IS_IN_libc || defined NOT_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)
 #define __isdigit_int(C)     (((unsigned int)((C) - '0')) <= 9)
-
 #endif
 
 #define        __exctype(name) extern int name (int) __THROW
index f2c3d33..a91e64e 100644 (file)
@@ -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
 #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 <features.h>
 #include <glob.h>
 #include <wordexp.h>
 
+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;
index 82c9936..0f7c564 100644 (file)
@@ -21,6 +21,7 @@
 #define setgroups __setgroups
 #define strtoul __strtoul
 #define rewind __rewind
+#define fgets_unlocked __fgets_unlocked
 
 #define _GNU_SOURCE
 #include <features.h>
@@ -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;
        }
 
index 4804ba9..7dab956 100644 (file)
@@ -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
index 08ebfdf..707cad1 100644 (file)
@@ -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 <stdio.h>
+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)
index e8711ff..abe5546 100644 (file)
@@ -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);
 }
index 3b7d37c..ab95c93 100644 (file)
@@ -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 */
index 616d2dd..a537156 100644 (file)
@@ -1,6 +1,8 @@
 #define wait4 __wait4
 #define execl __execl
 #define signal __signal
+#define vfork __vfork
+#define fork __fork
 
 #include <stdio.h>
 #include <stddef.h>
@@ -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);
index c8dbf3c..0e7d50a 100644 (file)
@@ -24,6 +24,8 @@
 #define waitpid __waitpid
 #define dup2 __dup2
 #define chmod __chmod
+#define vfork __vfork
+#define fork __fork
 
 #include <assert.h>
 #include <errno.h>
@@ -42,7 +44,7 @@
 /* uClinux-2.0 has vfork, but Linux 2.0 doesn't */
 #include <sys/syscall.h>
 #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
     {
index c3ac106..baf99db 100644 (file)
@@ -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;
index 837de8a..0c0c211 100644 (file)
@@ -37,6 +37,7 @@
 #define mmap __mmap
 #define sscanf __sscanf
 #define fscanf __fscanf
+#define fgets __fgets
 
 #include <errno.h>
 #include <fcntl.h>
index a36f5a1..4e450bb 100644 (file)
@@ -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)
index 7c2d412..50cbd6b 100644 (file)
@@ -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)
 
index a176dd7..271c9a4 100644 (file)
@@ -1,5 +1,6 @@
 #define opendir __opendir
 #define closedir __closedir
+#define readdir __readdir
 #define isatty __isatty
 
 #include <string.h>
@@ -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? */
index 233dbba..4c18e55 100644 (file)
@@ -26,6 +26,7 @@
 #define dup2 __dup2
 #define setsid __setsid
 #define chdir __chdir
+#define fork __fork
 
 #include <stdio.h>
 #include <features.h>
@@ -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("/");
index a51c8e8..834fba9 100644 (file)
@@ -21,6 +21,8 @@
 #define tcgetattr __tcgetattr
 #define fileno __fileno
 #define fflush __fflush
+#define fgets __fgets
+#define fputs __fputs
 
 #include <stdio.h>
 #include <string.h>
@@ -28,6 +30,8 @@
 #include <unistd.h>
 #include <string.h>
 
+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);
        }
     }
 
index 143dc26..bc29cf2 100644 (file)
@@ -32,6 +32,7 @@
 
 #define __fsetlocking __fsetlocking_internal
 #define fileno __fileno
+#define fgets_unlocked __fgets_unlocked
 
 #define _GNU_SOURCE
 #include <sys/param.h>