From 8a0b43005ad9ea011b80d66e32b46fb430ddaffb Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 1 Dec 2005 20:43:44 +0000 Subject: Hide mostly used functions --- libc/unistd/confstr.c | 4 ++-- libc/unistd/daemon.c | 4 ++-- libc/unistd/exec.c | 10 +++++----- libc/unistd/getlogin.c | 4 ++-- libc/unistd/getopt-susv3.c | 2 +- libc/unistd/getopt.c | 28 ++++++++++++++-------------- libc/unistd/getpass.c | 2 +- libc/unistd/getsubopt.c | 2 +- libc/unistd/sleep.c | 8 ++++---- 9 files changed, 32 insertions(+), 32 deletions(-) (limited to 'libc/unistd') diff --git a/libc/unistd/confstr.c b/libc/unistd/confstr.c index 017cf1e8e..bfaecb198 100644 --- a/libc/unistd/confstr.c +++ b/libc/unistd/confstr.c @@ -48,10 +48,10 @@ size_t confstr ( int name, char *buf, size_t len) if (len > 0 && buf != NULL) { if (string_len <= len) - memcpy (buf, string, string_len); + __memcpy (buf, string, string_len); else { - memcpy (buf, string, len - 1); + __memcpy (buf, string, len - 1); buf[len - 1] = '\0'; } } diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index c584d8fc5..3c54ad234 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -55,12 +55,12 @@ int daemon( int nochdir, int noclose ) if (!nochdir) chdir("/"); - if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + if (!noclose && (fd = __open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > 2) - close(fd); + __close(fd); } return(0); } diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index 21f335da9..7bf58289b 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -232,7 +232,7 @@ int execvp(const char *path, char *const argv[]) return -1; } - if (strchr(path, '/')) { + if (__strchr(path, '/')) { execve(path, argv, __environ); CHECK_ENOEXEC: if (errno == ENOEXEC) { @@ -245,7 +245,7 @@ int execvp(const char *path, char *const argv[]) nargv = (char **) EXEC_ALLOC((n+2) * sizeof(char *), size2); nargv[0] = argv[0]; nargv[1] = (char *)path; - memcpy(nargv+2, argv+1, n*sizeof(char *)); + __memcpy(nargv+2, argv+1, n*sizeof(char *)); execve("/bin/sh", nargv, __environ); EXEC_FREE(nargv, size2); } @@ -258,7 +258,7 @@ int execvp(const char *path, char *const argv[]) p = (char *) default_path; } - plen = strlen(path); + plen = __strlen(path); if (plen > (FILENAME_MAX - 1)) { ALL_TOO_LONG: __set_errno(ENAMETOOLONG); @@ -269,7 +269,7 @@ int execvp(const char *path, char *const argv[]) if ((buf = EXEC_ALLOC(FILENAME_MAX, size)) != NULL) { int seen_small = 0; s0 = buf + len; - memcpy(s0, path, plen+1); + __memcpy(s0, path, plen+1); do { s = s0; @@ -283,7 +283,7 @@ int execvp(const char *path, char *const argv[]) goto NEXT; } s -= plen; - memcpy(s, p, plen); + __memcpy(s, p, plen); s[plen-1] = '/'; } diff --git a/libc/unistd/getlogin.c b/libc/unistd/getlogin.c index d6a11b01e..e1685692c 100644 --- a/libc/unistd/getlogin.c +++ b/libc/unistd/getlogin.c @@ -41,7 +41,7 @@ int getlogin_r(char *name, size_t len) if (! foo) return -1; - strncpy(name, foo, len); + __strncpy(name, foo, len); name[len-1] = '\0'; return 0; } @@ -50,7 +50,7 @@ char *cuserid(char *s) { char *name = getlogin(); if (s) { - return(strcpy(s, name ? name : "")); + return(__strcpy(s, name ? name : "")); } return name; } diff --git a/libc/unistd/getopt-susv3.c b/libc/unistd/getopt-susv3.c index c53e2b089..d9ee18c43 100644 --- a/libc/unistd/getopt-susv3.c +++ b/libc/unistd/getopt-susv3.c @@ -87,7 +87,7 @@ int getopt(int argc, char * const argv[], const char *optstring) #endif retval = (unsigned char) *o; /* Avoid problems for char val of -1. */ - if ((*o == ':') || !(s = strchr(optstring, *o))) { /* Illegal option? */ + if ((*o == ':') || !(s = __strchr(optstring, *o))) { /* Illegal option? */ s = illegal; retval = '?'; goto BAD; diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index ed5237dc5..216e0575a 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -149,7 +149,7 @@ static enum } ordering; # include -# define my_index strchr +# define my_index __strchr /* Handle permutation of arguments. */ @@ -371,7 +371,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ - if (optind != argc && !strcmp (argv[optind], "--")) + if (optind != argc && !__strcmp (argv[optind], "--")) { optind++; @@ -447,10 +447,10 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) + if (!__strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) + == (unsigned int) __strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -479,7 +479,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); optind++; optopt = 0; return '?'; @@ -517,7 +517,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); optopt = pfound->val; return '?'; @@ -535,12 +535,12 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) @@ -651,9 +651,9 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) + if (!__strncmp (p->name, nextchar, nameend - nextchar)) { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + if ((unsigned int) (nameend - nextchar) == __strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -678,7 +678,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); optind++; return '?'; } @@ -700,7 +700,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * argv[0], pfound->name); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); return '?'; } } @@ -716,11 +716,11 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } - nextchar += strlen (nextchar); + nextchar += __strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index ac2159036..5dc6f5cf1 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -80,7 +80,7 @@ getpass (prompt) fgets (buf, PWD_BUFFER_SIZE-1, in); if (buf != NULL) { - nread = strlen(buf); + nread = __strlen(buf); if (nread < 0) buf[0] = '\0'; else if (buf[nread - 1] == '\n') diff --git a/libc/unistd/getsubopt.c b/libc/unistd/getsubopt.c index 2759a6d25..bebfbc4ed 100644 --- a/libc/unistd/getsubopt.c +++ b/libc/unistd/getsubopt.c @@ -50,7 +50,7 @@ int getsubopt(char **optionp, char *const *tokens, char **valuep) /* Try to match the characters between *OPTIONP and VSTART against one of the TOKENS. */ for (cnt = 0; tokens[cnt] != NULL; ++cnt) - if (memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0 + if (__memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0 && tokens[cnt][vstart - *optionp] == '\0') { /* We found the current option in TOKENS. */ diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c index 20689da0e..01a9b641b 100644 --- a/libc/unistd/sleep.c +++ b/libc/unistd/sleep.c @@ -56,7 +56,7 @@ unsigned int sleep (unsigned int seconds) in libc. We block SIGCHLD first. */ if (__sigemptyset (&set) < 0 || __sigaddset (&set, SIGCHLD) < 0 - || sigprocmask (SIG_BLOCK, &set, &oset)) + || __sigprocmask (SIG_BLOCK, &set, &oset)) return -1; /* If SIGCHLD is already blocked, we don't have to do anything. */ @@ -73,7 +73,7 @@ unsigned int sleep (unsigned int seconds) { saved_errno = errno; /* Restore the original signal mask. */ - (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); __set_errno (saved_errno); return -1; } @@ -85,13 +85,13 @@ unsigned int sleep (unsigned int seconds) saved_errno = errno; /* Restore the original signal mask. */ - (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); __set_errno (saved_errno); } else { /* We should unblock SIGCHLD. Restore the original signal mask. */ - (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); result = nanosleep (&ts, &ts); } } -- cgit v1.2.3