updated syslog(), added setenv()

This commit is contained in:
Ben Gras
2006-04-03 15:03:07 +00:00
parent 321f95f6c5
commit d464faf987
3 changed files with 32 additions and 11 deletions
+25
View File
@@ -0,0 +1,25 @@
#include <stdlib.h>
#include <string.h>
int
setenv(const char *name, const char *val, int overwrite)
{
char *bf;
int r;
if(!overwrite && getenv(name))
return 0;
if(!(bf=malloc(strlen(name)+strlen(val)+2)))
return -1;
strcpy(bf, name);
strcat(bf, "=");
strcat(bf, val);
r = putenv(bf);
return r == 0 ? 0 : -1;
}