1 /* This file may have been modified by DJ Delorie (Jan 1991). If so,
2 ** these modifications are Copyright (C) 1991 DJ Delorie.
6 * Copyright (c) 1988 The Regents of the University of California.
9 * Redistribution and use in source and binary forms are permitted
10 * provided that: (1) source distributions retain this entire copyright
11 * notice and comment, and (2) distributions including binaries display
12 * the following acknowledgement: ``This product includes software
13 * developed by the University of California, Berkeley and its contributors''
14 * in the documentation or other materials provided with the distribution.
15 * Neither the name of the University nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 /* _putenv_r - reentrant version of putenv that either adds
30 or replaces the environment variable "name"
31 with "value" which is specified by str as "name=value". */
33 _putenv_r (struct _reent
*reent_ptr
,
36 register char *p
, *equal
;
39 p
= _strdup_r (reent_ptr
, str
);
44 if (!(equal
= strchr (p
, '=')))
46 (void) _free_r (reent_ptr
, p
);
51 rval
= _setenv_r (reent_ptr
, p
, equal
+ 1, 1);
52 (void) _free_r (reent_ptr
, p
);