xref: /csrg-svn/lib/libc/stdlib/putenv.c (revision 42137)
1*42137Sbostic /*-
236771Sbostic  * Copyright (c) 1988 The Regents of the University of California.
336771Sbostic  * All rights reserved.
436771Sbostic  *
5*42137Sbostic  * %sccs.include.redist.c%
636771Sbostic  */
736771Sbostic 
836771Sbostic #if defined(LIBC_SCCS) && !defined(lint)
9*42137Sbostic static char sccsid[] = "@(#)putenv.c	5.2 (Berkeley) 05/16/90";
1036771Sbostic #endif /* LIBC_SCCS and not lint */
1136771Sbostic 
12*42137Sbostic #include <stdlib.h>
13*42137Sbostic 
1436771Sbostic putenv(str)
1536771Sbostic 	char *str;
1636771Sbostic {
1736771Sbostic 	register char *equal;
1836771Sbostic 	int rval;
1936771Sbostic 
2036771Sbostic 	if (!(equal = index(str, '=')))
2136771Sbostic 		return(1);
2236771Sbostic 	*equal = '\0';
2336771Sbostic 	rval = setenv(str, equal + 1, 1);
2436771Sbostic 	*equal = '=';
2536771Sbostic 	return(rval);
2636771Sbostic }
27