21 #if !defined(HAVE_PUTENV) && !defined(HAVE_SETENV)
22 extern char **environ;
35 #if defined(HAVE_PUTENV)
36 sprintf(buf,
"%s=%s",
name, value);
38 #elif defined(HAVE_SETENV)
39 setenv(
name, value, 1);
47 for (i = 0; environ[i]; i++)
49 newenv = (
char **)
G_malloc((i + 1) *
sizeof(
char *));
50 for (i = 0; env = environ[i], env; i++)
57 for (i = 0; env = environ[i], env; i++) {
60 if (sscanf(env,
"%[^=]=%1s", buf, temp) < 1)
63 if (strcmp(buf,
name) != 0)
67 sprintf(buf,
"%s=%s",
name, value);
72 environ = (
char **)
G_realloc(environ, (i + 2) *
sizeof(
char *));
73 sprintf(buf,
"%s=%s",
name, value);
void G_free(void *)
Free allocated memory.
char * G_store(const char *)
Copy string to allocated memory.
void G_putenv(const char *name, const char *value)
Sets the UNIX environment variable name to value.