~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/backend/port/nextstep/port.c

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "postgres.h"
 
2
 
 
3
#ifndef _POSIX_SOURCE
 
4
#include "libc.h"
 
5
#else
 
6
#include <unistd.h>
 
7
#endif
 
8
 
 
9
#include <sys/signal.h>
 
10
 
 
11
 
 
12
void
 
13
putenv(char *name)
 
14
{
 
15
        extern char **environ;
 
16
        static int      was_mallocated = 0;
 
17
        int                     size;
 
18
 
 
19
        /* Compute the size of environ array including the final NULL */
 
20
        for (size = 1; environ[size++];)
 
21
                 /* nothing */ ;
 
22
 
 
23
        if (!was_mallocated)
 
24
        {
 
25
                char      **tmp = environ;
 
26
                int                     i;
 
27
 
 
28
                was_mallocated = 1;
 
29
                environ = malloc(size * sizeof(char *));
 
30
                for (i = 0; i < size; i++)
 
31
                        environ[i] = tmp[i];
 
32
        }
 
33
 
 
34
        environ = realloc(environ, (size + 1) * sizeof(char *));
 
35
        environ[size - 1] = strcpy(malloc(strlen(name) + 1), name);
 
36
        environ[size] = NULL;
 
37
}
 
38
 
 
39
#ifndef _POSIX_SOURCE
 
40
int
 
41
sigaddset(int *set, int signo)
 
42
{
 
43
        *set |= sigmask(signo);
 
44
        return *set;
 
45
}
 
46
 
 
47
int
 
48
sigemptyset(int *set)
 
49
{
 
50
        return *set = 0;
 
51
}
 
52
 
 
53
char *
 
54
getcwd(char *buf, size_t size)
 
55
{
 
56
        return getwd(buf);
 
57
}
 
58
 
 
59
#endif