|
|
1.1 root 1: /*
2: * getenv - f77 subroutine to return environment variables
3: *
4: * called by:
5: * call getenv (ENV_NAME, char_var)
6: * where:
7: * ENV_NAME is the name of an environment variable
8: * char_var is a character variable which will receive
9: * the current value of ENV_NAME, or all blanks
10: * if ENV_NAME is not defined
11: */
12:
13: getenv_(fname, value, flen, vlen)
14: char *value, *fname;
15: long int vlen, flen;
16: {
17: extern char **environ;
18: register char *ep, *fp, *flast;
19: register char **env = environ;
20:
21: flast = fname + flen;
22: for(fp = fname ; fp < flast ; ++fp)
23: if(*fp == ' ')
24: {
25: flast = fp;
26: break;
27: }
28:
29: while (ep = *env++)
30: {
31: for(fp = fname; fp<flast ; )
32: if(*fp++ != *ep++)
33: goto endloop;
34:
35: if(*ep++ == '=') /* copy right hand side */
36: while( *ep && --vlen>=0 )
37: *value++ = *ep++;
38:
39: goto blank;
40:
41: endloop: ;
42: }
43:
44: blank:
45: while( --vlen >= 0 )
46: *value++ = ' ';
47: return(0);
48: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.