Last change
on this file since 5f1d169 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
823 bytes
|
Rev | Line | |
---|
[3ae31e9] | 1 | #include "stdio.h"
|
---|
| 2 | #include "ctype.h"
|
---|
| 3 | #include "osbind.h"
|
---|
| 4 |
|
---|
| 5 | #define TRUE 1
|
---|
| 6 | #define FALSE 0
|
---|
| 7 |
|
---|
| 8 | struct basepage {
|
---|
| 9 |
|
---|
| 10 | char *ltpa;
|
---|
| 11 | char *htpa;
|
---|
| 12 | char *lcode;
|
---|
| 13 | long codelen;
|
---|
| 14 | char *ldata;
|
---|
| 15 | long datalen;
|
---|
| 16 | char *lbss;
|
---|
| 17 | long bsslen;
|
---|
| 18 | char *dta;
|
---|
| 19 | char *parent;
|
---|
| 20 | long rsvd;
|
---|
| 21 | char *env;
|
---|
| 22 | };
|
---|
| 23 |
|
---|
| 24 | extern struct basepage *_BasePag;
|
---|
| 25 |
|
---|
| 26 | /* locate variable name in environment string */
|
---|
| 27 |
|
---|
| 28 | static
|
---|
| 29 | char *
|
---|
| 30 | findenv(s)
|
---|
| 31 | char *s;
|
---|
| 32 | {
|
---|
| 33 | char name[20];
|
---|
| 34 | char *p;
|
---|
| 35 |
|
---|
| 36 | if (s) {
|
---|
| 37 |
|
---|
| 38 | strcpy(name, s);
|
---|
| 39 | strcat(name, "=");
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | for (p = _BasePag->env; *p; p++) {
|
---|
| 43 |
|
---|
| 44 | if (s) {
|
---|
| 45 |
|
---|
| 46 | if (strcmp(p, name) == 0)
|
---|
| 47 | break;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | while (*p)
|
---|
| 51 | p++;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | return(p);
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | char *
|
---|
| 58 | getenv(name)
|
---|
| 59 | char *name;
|
---|
| 60 | {
|
---|
| 61 | char *p;
|
---|
| 62 |
|
---|
| 63 | p = findenv(name);
|
---|
| 64 |
|
---|
| 65 | if (*p) {
|
---|
| 66 |
|
---|
| 67 | while (*p)
|
---|
| 68 | p++;
|
---|
| 69 |
|
---|
| 70 | return(++p);
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | return(NULL);
|
---|
| 74 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.