diff options
author | 1996-03-25 22:16:37 +0000 | |
---|---|---|
committer | 1996-03-25 22:16:37 +0000 | |
commit | d6b090604520ff153cf625a21b175c2788328f20 (patch) | |
tree | 40f8889a8da6ddc0a6e965160d7fa78edc5c0986 /lib/libc/stdlib/getenv.c | |
parent | Protect internal mcount symbol from lint(1) (diff) | |
download | wireguard-openbsd-d6b090604520ff153cf625a21b175c2788328f20.tar.xz wireguard-openbsd-d6b090604520ff153cf625a21b175c2788328f20.zip |
Add prototypes for internal functions
Change inline to __inline
Diffstat (limited to 'lib/libc/stdlib/getenv.c')
-rw-r--r-- | lib/libc/stdlib/getenv.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index 09d47f2149e..d1487a7afc7 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -33,27 +33,13 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)getenv.c 5.8 (Berkeley) 2/23/91";*/ -static char *rcsid = "$Id: getenv.c,v 1.1.1.1 1995/10/18 08:42:17 deraadt Exp $"; +static char *rcsid = "$Id: getenv.c,v 1.2 1996/03/25 22:16:38 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdlib.h> #include <string.h> /* - * getenv -- - * Returns ptr to value associated with name, if any, else NULL. - */ -char * -getenv(name) - const char *name; -{ - int offset; - char *__findenv(); - - return(__findenv(name, &offset)); -} - -/* * __findenv -- * Returns pointer to value associated with name, if any, else NULL. * Sets offset to be the offset of the name/value combination in the @@ -64,14 +50,15 @@ getenv(name) */ char * __findenv(name, offset) - register char *name; + register const char *name; int *offset; { extern char **environ; register int len; register char **P, *C; + register const char *cp; - for (C = name, len = 0; *C && *C != '='; ++C, ++len); + for (cp = name, len = 0; *cp != '\0' && *cp != '='; ++cp, ++len); for (P = environ; *P; ++P) if (!strncmp(*P, name, len)) if (*(C = *P + len) == '=') { @@ -80,3 +67,17 @@ __findenv(name, offset) } return(NULL); } + +/* + * getenv -- + * Returns ptr to value associated with name, if any, else NULL. + */ +char * +getenv(name) + const char *name; +{ + int offset; + char *__findenv(); + + return(__findenv(name, &offset)); +} |