honeyd/setenv.c

Tue, 08 Jan 2013 20:08:32 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 08 Jan 2013 20:08:32 +0100
changeset 755
192d78fefb97
permissions
-rw-r--r--

Update to new vendor version (chan_capi as well) and adapt patch logic,
introducing a new variable to control build time SMS call centre channel.

michael@574 1
michael@574 2 #ifndef HAVE_SETENV
michael@574 3 #ifdef HAVE_CONFIG_H
michael@574 4 #include "config.h"
michael@574 5 #endif
michael@574 6 #include <sys/types.h>
michael@574 7 #include <stdlib.h>
michael@574 8 #include <string.h>
michael@574 9
michael@574 10 int setenv(const char *kszName, const char *kszValue, int nOverwrite)
michael@574 11 {
michael@574 12 char *szPair = NULL;
michael@574 13
michael@574 14 if (nOverwrite == 0 && getenv(kszName) != 0)
michael@574 15 return 0;
michael@574 16 szPair = malloc(strlen(kszName) + 1 + strlen(kszValue) + 1);
michael@574 17 if (szPair == NULL)
michael@574 18 return -1;
michael@574 19 strcpy(szPair, kszName);
michael@574 20 strcat(szPair, "=");
michael@574 21 strcat(szPair, kszValue);
michael@574 22 putenv(szPair);
michael@574 23 return 0;
michael@574 24 }
michael@574 25 #endif /* !HAVE_SETENV */
michael@574 26

mercurial