2 * (c) copyright 1989 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
11 #define rounded(x) (((x / ENTRY_INC) + 1) * ENTRY_INC)
13 extern _CONST
char ***_penviron
;
19 register _CONST
char **v
= *_penviron
;
22 /* When size != 0, it contains the number of entries in the
23 * table (including the final NULL pointer). This means that the
24 * last non-null entry is environ[size - 2].
28 if (*_penviron
== NULL
) return 1;
29 if (r
= strchr(name
, '=')) {
30 register _CONST
char *p
, *q
;
35 while ((p
= *v
) != NULL
) {
37 while (*q
&& (*q
++ == *p
++))
39 if (*q
|| (*p
!= '=')) {
42 /* The name was already in the
56 register _CONST
char **p
;
63 if (!(v
= malloc(rounded(i
) * sizeof(char **))))
68 while (*v
++ = *p
++); /* copy the environment */
70 } else if (!(size
% ENTRY_INC
)) {
71 if (!(v
= realloc(*_penviron
, rounded(size
) * sizeof(char **))))