/******************************************************************************
* @file variable.c
*****************************************************************************/
+#if defined (__GNUC__)
+# ifndef _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 200112L /* for setenv() */
+# endif
+#endif
+
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#if defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__)
-# define __USE_POSIX
+# ifndef __USE_POSIX
+# define __USE_POSIX
+# endif
#elif defined (_WIN32)
# define strcasecmp _stricmp
#endif
} else {
- if (state->env_override) {
+ if (state->env_override || strcmp (content, "PATH") == 0) {
if ((alloc_replacement = getenv (content))) {
}
+ if (strcmp (var_name, "PATH") == 0) {
+
+#if defined (_WIN32)
+
+ char *temp = xmalloc (strlen (new_value) + 6);
+ int i;
+
+ sprintf (temp, "PATH=%s", new_value);
+
+ for (i = 5; temp[i] != '\0'; i++) {
+
+ if (temp[i] == ':' && temp[i + 1] != '\\') {
+ temp[i] = ';';
+ }
+
+ }
+
+ _putenv (temp);
+ free (temp);
+
+#else
+ setenv ("PATH", new_value, 1);
+#endif
+
+ }
+
if ((var = variable_change (var_name, new_value, origin))) {
var->flavor = flavor;
}