diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-03-25 22:16:41 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-03-25 22:16:41 +0000 |
commit | b0213bec8a63d675175a8a30062c37c034677522 (patch) | |
tree | 7cd27fc459a3366fb74f7152cb2560ec33eca541 /lib/libc/stdlib/getenv.c | |
parent | 80c9912a423fbc529a01ca31ab3dd1a5fdfdf0fc (diff) |
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 5c9f9afff4c..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 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)); +} |