xref: /csrg-svn/lib/libc/stdlib/putenv.c (revision 42137)
1 /*-
2  * Copyright (c) 1988 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)putenv.c	5.2 (Berkeley) 05/16/90";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <stdlib.h>
13 
14 putenv(str)
15 	char *str;
16 {
17 	register char *equal;
18 	int rval;
19 
20 	if (!(equal = index(str, '=')))
21 		return(1);
22 	*equal = '\0';
23 	rval = setenv(str, equal + 1, 1);
24 	*equal = '=';
25 	return(rval);
26 }
27