1 #ifndef EL__OSDEP_STUB_H
2 #define EL__OSDEP_STUB_H
9 #define CONFIG_OWN_LIBC
13 #ifdef CONFIG_OWN_LIBC
15 #undef HAVE_BCOPY /* prevent using bcopy() stub for memmove() */
21 #undef HAVE_STRCASECMP
22 #undef HAVE_STRCASESTR
25 #undef HAVE_STRNCASECMP
29 #endif /* CONFIG_OWN_LIBC */
32 /* These stubs are exception to our "Use (unsigned char *)!" rule. This is
33 * because the stubbed functions are defined using (char *), and we could get
34 * in trouble with this. Or when you use (foo ? strstr() : strcasestr()) and
35 * one of these is system and another stub, we're in trouble and get "Pointer
36 * type mismatch in conditional expression", game over. */
42 #ifdef HAVE_INDEX /* for old BSD systems. */
45 #define strchr(a, b) index(a, b)
47 #define strrchr(a, b) rindex(a, b)
49 #else /* ! HAVE_INDEX */
50 # error You have neither strchr() nor index() function. Please go upgrade your system.
51 #endif /* HAVE_INDEX */
52 #endif /* HAVE_STRCHR */
56 #define isdigit(a) elinks_isdigit(a)
57 int elinks_isdigit(int);
63 #define strerror(e) elinks_strerror(e)
64 const char *elinks_strerror(int);
70 #define strstr(a, b) elinks_strstr(a, b)
71 char *elinks_strstr(const char *, const char *);
77 # define memmove(dst, src, n) bcopy(src, dst, n)
80 #define memmove(dst, src, n) elinks_memmove(dst, src, n)
81 void *elinks_memmove(void *, const void *, size_t);
86 #ifndef HAVE_STRCASECMP
88 #define strcasecmp(a, b) elinks_strcasecmp(a, b)
89 int elinks_strcasecmp(const char *, const char *);
93 #ifndef HAVE_STRNCASECMP
95 #define strncasecmp(a, b, l) elinks_strncasecmp(a, b, l)
96 int elinks_strncasecmp(const char *, const char *, size_t);
100 #ifndef HAVE_STRCASESTR
102 #define strcasestr(a, b) elinks_strcasestr(a, b)
103 char *elinks_strcasestr(const char *, const char *);
109 #define strdup(s) elinks_strdup(s)
110 char *elinks_strdup(const char *);
116 #define stpcpy(d, s) elinks_stpcpy(d, s)
117 char *elinks_stpcpy(char *, const char *);
123 #define mempcpy(dest, src, n) elinks_mempcpy(dest, src, n)
124 void *elinks_mempcpy(void *, const void *, size_t);
130 #define memrchr(src, c, n) elinks_memrchr(src, c, n)
131 void *elinks_memrchr(const void *s
, int c
, size_t n
);
137 #define raise(signal) elinks_raise(signal)
138 int elinks_raise(int signal
);
142 #ifndef HAVE_INET_NTOP
144 #define inet_ntop(af, src, dst, size) elinks_inet_ntop(af, src, dst, size)
145 const char *elinks_inet_ntop(int af
, const void *src
, char *dst
, size_t size
);
148 /* Silence various sparse warnings. */
150 #ifndef __builtin_stpcpy
151 extern char *__builtin_stpcpy(char *dest
, const char *src
);
154 #ifndef __builtin_mempcpy
155 extern void *__builtin_mempcpy(void *dest
, const void *src
, size_t n
);
159 #ifndef __builtin_va_copy
160 #define __builtin_va_copy(dest, src) do { dest = src; } while (0)