Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / src / backend / port / nextstep / port.c
blobe273d3818a9801b4fed96535a0d5c08107a185ba
1 /*
2 * $PostgreSQL$
3 */
4 #include "postgres.h"
6 #ifndef _POSIX_SOURCE
7 #include "libc.h"
8 #else
9 #include <unistd.h>
10 #endif
12 #include <sys/signal.h>
15 void
16 putenv(char *name)
18 extern char **environ;
19 static int was_mallocated = 0;
20 int size;
22 /* Compute the size of environ array including the final NULL */
23 for (size = 1; environ[size++];)
24 /* nothing */ ;
26 if (!was_mallocated)
28 char **tmp = environ;
29 int i;
31 was_mallocated = 1;
32 environ = malloc(size * sizeof(char *));
33 for (i = 0; i < size; i++)
34 environ[i] = tmp[i];
37 environ = realloc(environ, (size + 1) * sizeof(char *));
38 environ[size - 1] = strcpy(malloc(strlen(name) + 1), name);
39 environ[size] = NULL;
42 #ifndef _POSIX_SOURCE
43 int
44 sigaddset(int *set, int signo)
46 *set |= sigmask(signo);
47 return *set;
50 int
51 sigemptyset(int *set)
53 return *set = 0;
56 char *
57 getcwd(char *buf, size_t size)
59 return getwd(buf);
62 #endif