envread.c (441B)
1 #include "env.h" 2 #include "str.h" 3 4 extern /*@null@*/char *env_get(s) 5 char *s; 6 { 7 int i; 8 unsigned int slen; 9 char *envi; 10 11 slen = str_len(s); 12 for (i = 0;(envi = environ[i]);++i) 13 if ((!str_diffn(s,envi,slen)) && (envi[slen] == '=')) 14 return envi + slen + 1; 15 return 0; 16 } 17 18 extern char *env_pick() 19 { 20 return environ[0]; 21 } 22 23 extern char *env_findeq(s) 24 char *s; 25 { 26 for (;*s;++s) 27 if (*s == '=') 28 return s; 29 return 0; 30 }