|
|
1.1 root 1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)getenv_.c 5.1 6/7/85
7: */
8:
9: /*
10: * return environment variables
11: *
12: * calling sequence:
13: * character*20 evar
14: * call getenv (ENV_NAME, evar)
15: * where:
16: * ENV_NAME is the name of an environment variable
17: * evar is a character variable which will receive
18: * the current value of ENV_NAME,
19: * or all blanks if ENV_NAME is not defined
20: */
21:
22: extern char **environ;
23:
24: getenv_(fname, value, flen, vlen)
25: char *value, *fname;
26: long int vlen, flen;
27: {
28: register char *ep, *fp;
29: register char **env = environ;
30: int i;
31:
32: while (ep = *env++) {
33: for (fp=fname, i=0; i <= flen; i++) {
34: if (i == flen || *fp == ' ') {
35: if (*ep++ == '=') {
36: b_char(ep, value, vlen);
37: return(0);
38: }
39: else break;
40: }
41: else if (*ep++ != *fp++) break;
42: }
43: }
44: b_char(" ", value, vlen);
45: return(0);
46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.