]>
diplodocus.org Git - nmh/blob - sbr/putenv.c
d8fb56f3d5d91b4b4fa756d8e5fcb21c9ffd0d8e
1 /* putenv.c -- (un)set an envariable
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
11 extern char **environ
;
16 int unputenv (char *);
17 static int nvmatch (char *, char *);
19 /* FIXME: These functions leak memory. No easy fix since they might not
20 * be malloc'd. Switch to setenv(3) and unsetenv(3). */
27 for (ep
= environ
; *ep
; ep
++)
28 if (nvmatch (name
, *ep
))
33 for (nep
= ep
+ 1; *nep
; nep
++)
42 nvmatch (char *s1
, char *s2
)
48 return (*s1
== '\0' && *--s2
== '=');