summaryrefslogtreecommitdiff
path: root/missing.c
blob: cccadb494f63cc197f99222c3e4016ff8d4a1c60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Do all necessary includes here, so that we don't have to worry about
 * overlapping includes in the files in missing.d.
 */

#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>

#include "ruby.h"

#ifndef __STDC__
#define const
#endif /* !__STDC__ */

#ifdef STDC_HEADERS
#include <string.h>
#endif

#ifndef HAVE_MEMMOVE
#include "missing/memmove.c"
#endif

#ifndef HAVE_STRERROR
#include "missing/strerror.c"
#endif

#ifndef HAVE_STRTOUL
#include "missing/strtoul.c"
#endif

#ifndef HAVE_STRFTIME
#include "missing/strftime.c"
#endif

#ifndef HAVE_STRSTR
#include "missing/strstr.c"
#endif

#ifndef HAVE_GETOPT_LONG
#include "missing/getopt.h"
#include "missing/getopt.c"
#include "missing/getopt1.c"
#endif

#ifndef HAVE_MKDIR
#include "missing/mkdir.c"
#endif

#ifndef HAVE_STRDUP
char *
strdup(str)
    char *str;
{
    extern char *xmalloc();
    char *tmp;
    int len = strlen(str) + 1;

    tmp = xmalloc(len);
    if (tmp == NULL) return NULL;
    memcpy(tmp, str, len);

    return tmp;
}
#endif