branch update for HEAD-2003021201
[reactos.git] / lib / msvcrt / stdlib / putenv.c
index ce68245..3f5c3de 100644 (file)
@@ -8,44 +8,24 @@
 
 extern int BlockEnvToEnviron(); // defined in misc/dllmain.c
 
-int _putenv(const char *val)
+int _putenv(const charval)
 {
-  char *buffer;
-  char *epos;
-  int res;
+    char* buffer;
+    char* epos;
+    int res;
 
-  DPRINT("_putenv('%s')\n", val);
-  epos = strchr(val, '=');
-  if ( epos == NULL )
-       return -1;
-  buffer = (char*)malloc(epos - val + 1);
-  if (buffer == NULL)
-       return -1;
-  strncpy(buffer, val, epos - val);
-  buffer[epos - val] = 0;
-  res = SetEnvironmentVariableA(buffer,epos+1);
-  free(buffer);
-  if (BlockEnvToEnviron()) return 0;
-  return  res;
-}
-
-int _wputenv(const wchar_t *val)
-{
-  wchar_t *buffer;
-  wchar_t *epos;
-  int res;
-
-  DPRINT("_wputenv('%S')\n", val);
-  epos = wcsrchr(val, L'=');
-  if ( epos == NULL )
-       return -1;
-  buffer = (char*)malloc((epos - val + 1) * sizeof (wchar_t));
-  if (buffer == NULL)
-       return -1;
-  wcsncpy(buffer, val, epos - val);
-  buffer[epos - val] = 0;
-  res = SetEnvironmentVariableW(buffer,epos+1);
-  free(buffer);
-  if (BlockEnvToEnviron() ) return 0;
-  return  res;
+    DPRINT("_putenv('%s')\n", val);
+    epos = strchr(val, '=');
+    if ( epos == NULL )
+        return -1;
+    buffer = (char*)malloc(epos - val + 1);
+    if (buffer == NULL)
+        return -1;
+    strncpy(buffer, val, epos - val);
+    buffer[epos - val] = 0;
+    res = SetEnvironmentVariableA(buffer, epos+1);
+    free(buffer);
+    if (BlockEnvToEnviron())
+        return 0;
+    return res;
 }