| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #if defined (_AIX) && !defined (__GNUC__) |
| #pragma alloca |
| #endif |
| |
| #if HAVE_CONFIG_H |
| # include <config.h> |
| #endif |
| |
| #include "ansidecl.h" |
| |
| #define putenv libiberty_putenv |
| |
| #if HAVE_STDLIB_H |
| # include <stdlib.h> |
| #endif |
| #if HAVE_STRING_H |
| # include <string.h> |
| #endif |
| |
| #ifdef HAVE_ALLOCA_H |
| # include <alloca.h> |
| #else |
| # ifndef alloca |
| # ifdef __GNUC__ |
| # define alloca __builtin_alloca |
| # else |
| extern char *alloca (); |
| # endif |
| # endif |
| #endif |
| |
| #undef putenv |
| |
| |
| |
| |
| |
| int |
| putenv (const char *string) |
| { |
| const char *const name_end = strchr (string, '='); |
| |
| if (name_end) |
| { |
| char *name = (char *) alloca (name_end - string + 1); |
| memcpy (name, string, name_end - string); |
| name[name_end - string] = '\0'; |
| return setenv (name, name_end + 1, 1); |
| } |
| |
| unsetenv (string); |
| return 0; |
| } |