9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.11.04.00.37.05; author jromine; state Exp;
19 date 90.04.05.15.32.08; author sources; state Exp;
24 date 90.04.05.14.49.34; author sources; state Exp;
29 date 90.02.06.13.08.41; author sources; state Exp;
34 date 90.02.06.13.06.05; author sources; state Exp;
49 @/* putenv.c - (un) set an envariable */
51 static char ident[] = "@@(#)$Id: putenv.c,v 1.5 1992/11/04 00:37:05 jromine Exp jromine $";
58 extern char **environ;
62 int m_putenv (name, value)
71 if ((cp = malloc ((unsigned) (strlen (name) + strlen (value) + 2)))
74 (void) sprintf (cp, "%s=%s", name, value);
76 for (ep = environ, i = 0; *ep; ep++, i++)
77 if (nvmatch (name, *ep)) {
82 if ((nep = (char **) malloc ((unsigned) ((i + 2) * sizeof *nep))) == NULL)
84 for (ep = environ, i = 0; *ep; nep[i++] = *ep++)
99 for (ep = environ; *ep; ep++)
100 if (nvmatch (name, *ep))
105 for (nep = ep + 1; *nep; nep++)
114 static nvmatch (s1, s2)
122 return (*s1 == '\0' && *--s2 == '=');
134 static char ident[] = "@@(#)$Id: putenv.c,v 1.4 1990/04/05 15:32:08 sources Exp jromine $";
146 static char ident[] = "@@(#)$Id:$";
149 int putenv (name, value)
160 static char ident[] = "$Id:";