Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 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 |
||
8 | #include |
||
9 | #include |
||
10 | #include |
||
11 | #include |
||
12 | |||
13 | #include "buf_findstr.h" |
||
14 | |||
15 | char * |
||
16 | _DEFUN (envz_get, (envz, envz_len, name), |
||
17 | const char *envz _AND |
||
18 | size_t envz_len _AND |
||
19 | const char *name) |
||
20 | { |
||
21 | char *buf_ptr = (char *)envz; |
||
22 | size_t buf_len = envz_len; |
||
23 | |||
24 | while(buf_len) |
||
25 | { |
||
26 | if (_buf_findstr(name, &buf_ptr, &buf_len)) |
||
27 | { |
||
28 | if (*buf_ptr == '=') |
||
29 | { |
||
30 | buf_ptr++; |
||
31 | return (char *)buf_ptr; |
||
32 | } |
||
33 | else |
||
34 | { |
||
35 | if (*buf_ptr == '\0') |
||
36 | /* NULL entry. */ |
||
37 | return NULL; |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 | /* No matching entries found. */ |
||
42 | return NULL; |
||
43 | } |