2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
10 * replaces or adds the `name' entry with "name=arg";
12 * Uses malloc() for space for new vector and new entry;
14 * Bruce Borden January 1980
15 * The Rand Corporation
20 extern char **environ
;
26 register char **ep
, **nep
, *cp
;
28 if((cp
= (char *) malloc(strlen(name
) + strlen(arg
) + 2)) == NULL
)
33 for(ep
= environ
, i
= 0; *ep
; ep
++, i
++)
34 if(nvmatch(name
, *ep
)) {
38 if((nep
= (char **) malloc((i
+2) * sizeof *nep
)) == NULL
)
40 for(ep
= environ
, i
= 0; *ep
; )
49 * s1 is either name, or name=value
51 * if names match, return value of s2, else NULL
52 * used for environment searching: see getenv
57 register char *s1
, *s2
;
63 if (*s1
== '\0' && *(s2
-1) == '=')