1: /* 2: char id_getenv[] = "@(#)getenv_.c 1.1"; 3: * 4: * return environment variables 5: * 6: * calling sequence: 7: * character*20 evar 8: * call getenv (ENV_NAME, evar) 9: * where: 10: * ENV_NAME is the name of an environment variable 11: * evar is a character variable which will receive 12: * the current value of ENV_NAME, 13: * or all blanks if ENV_NAME is not defined 14: */ 15: 16: #include "../libI77/fiodefs.h" 17: 18: extern char **environ; 19: 20: ftnint 21: getenv_(fname, value, flen, vlen) 22: char *value, *fname; 23: ftnlen vlen, flen; 24: { 25: register char *ep, *fp; 26: register char **env = environ; 27: int i; 28: 29: while (ep = *env++) { 30: for (fp=fname, i=0; i <= flen; i++) { 31: if (i == flen || *fp == ' ') { 32: if (*ep++ == '=') { 33: b_char(ep, value, vlen); 34: return((ftnint) 0); 35: } 36: else break; 37: } 38: else if (*ep++ != *fp++) break; 39: } 40: } 41: b_char(" ", value, vlen); 42: return((ftnint) 0); 43: }