Last change
on this file was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
895 bytes
|
Rev | Line | |
---|
[444] | 1 | /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. |
---|
| 2 | * |
---|
| 3 | * Permission to use, copy, modify, and distribute this software |
---|
| 4 | * is freely granted, provided that this notice is preserved. |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #include <errno.h> |
---|
| 8 | #include <sys/types.h> |
---|
| 9 | #include <string.h> |
---|
| 10 | #include <stdlib.h> |
---|
| 11 | #include <envz.h> |
---|
| 12 | |
---|
| 13 | #include "buf_findstr.h" |
---|
| 14 | |
---|
| 15 | char * |
---|
| 16 | envz_get (const char *envz, |
---|
| 17 | size_t envz_len, |
---|
| 18 | const char *name) |
---|
| 19 | { |
---|
| 20 | char *buf_ptr = (char *)envz; |
---|
| 21 | size_t buf_len = envz_len; |
---|
| 22 | |
---|
| 23 | while(buf_len) |
---|
| 24 | { |
---|
| 25 | if (_buf_findstr(name, &buf_ptr, &buf_len)) |
---|
| 26 | { |
---|
| 27 | if (*buf_ptr == '=') |
---|
| 28 | { |
---|
| 29 | buf_ptr++; |
---|
| 30 | return (char *)buf_ptr; |
---|
| 31 | } |
---|
| 32 | else |
---|
| 33 | { |
---|
| 34 | if (*buf_ptr == '\0') |
---|
| 35 | /* NULL entry. */ |
---|
| 36 | return NULL; |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | } |
---|
| 40 | /* No matching entries found. */ |
---|
| 41 | return NULL; |
---|
| 42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.