13 char *eptr, *esptr, *bp;
19 if ((fenv=fopen("environment","r"))!=NULL) {
20 if ((envstr=malloc((size_t)(esize=MAXENV)))==NULL) {
21 fclose(fenv); goto noenv;}
22 esptr=envstr; esize -= 10;
23 while (fgets(esptr,esize,fenv)!=NULL) {
24 if ((bp=strchr(esptr,'\n'))!=NULL) *bp='\0';
25 esize -= (i=strlen(esptr)+1);
34 if (envstr==NULL) return NULL;
36 for (eptr=envstr; *eptr; eptr += strlen(eptr)+1) {
37 if (strncmp(str,eptr,(long)strlen(str))==0) {
38 return strchr(eptr,'=')+1;
43 noenv: envstr=NULL; return NULL;
47 char *to; Str255 from; size_t max;
51 n = (*from<max) ? *from : max;
54 for (i=0; i<n; i++) *to++ = *from++;