diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2001-10-23 22:34:36 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2001-10-23 22:34:36 +0000 |
| commit | 21cbf0cc8b6ea163d10591b74a13611591cc37a2 (patch) | |
| tree | 60f4d494d562414989f6de7171d845184d80f7b0 /sys/kern/kern_environment.c | |
| parent | a33cbf355e3fc9dfcfead16ecaaa6812520399c1 (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_environment.c')
| -rw-r--r-- | sys/kern/kern_environment.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/kern/kern_environment.c b/sys/kern/kern_environment.c index 97897066b5c5..08af003df136 100644 --- a/sys/kern/kern_environment.c +++ b/sys/kern/kern_environment.c @@ -46,6 +46,9 @@ char *kern_envp; static char *kernenv_next(char *cp); +/* + * Look up an environment variable by name. + */ char * getenv(const char *name) { @@ -65,6 +68,23 @@ getenv(const char *name) } /* + * Return a string value from an environment variable. + */ +int +getenv_string(const char *name, char *data, int size) +{ + char *tmp; + + tmp = getenv(name); + if (tmp == NULL) { + strncpy(data, tmp, size); + data[size - 1] = 0; + return (1); + } else + return (0); +} + +/* * Return an integer value from an environment variable. */ int @@ -83,7 +103,7 @@ getenv_int(const char *name, int *data) /* * Return a quad_t value from an environment variable. */ -quad_t +int getenv_quad(const char *name, quad_t *data) { const char *value; |
