Imported Upstream version 2.6.0

This commit is contained in:
arnaud.quette@free.fr 2011-01-26 10:35:08 +01:00
parent 26fb71b504
commit 459aaf9392
510 changed files with 40508 additions and 18859 deletions

26
common/setenv.c Normal file
View file

@ -0,0 +1,26 @@
/* setenv.c Ben Collver <collver@softhome.net> */
#ifndef HAVE_SETENV
#include <stdlib.h>
#include <string.h>
#include "common.h"
int nut_setenv(const char *name, const char *value, int overwrite)
{
char *val;
char *buffer;
int rv;
if (overwrite == 0) {
val = getenv(name);
if (val != NULL) {
return 0;
}
}
buffer = xmalloc(strlen(value) + strlen(name) + 2);
strcpy(buffer, name);
strcat(buffer, "=");
strcat(buffer, value);
rv = putenv(buffer); /* man putenv, do not free(buffer) */
return (rv);
}
#endif