1 /* Copyright (c) 2006-2013 Jonas Fonseca <jonas.fonseca@gmail.com>
2  * Copyright (c) 2013 Drew Northup <n1xim.email@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14 
15 #ifndef TIG_COMPAT_H
16 #define TIG_COMPAT_H
17 
18 #ifndef HAVE_CONFIG_H
19 /*
20  * Enable inclusion of header files checked by configure.
21  */
22 #define HAVE_STDINT_H
23 #define HAVE_STDLIB_H
24 #define HAVE_STRING_H
25 #define HAVE_SYS_TIME_H
26 #define HAVE_UNISTD_H
27 #define HAVE_WORDEXP_H
28 #endif
29 
30 /*
31  * XXX: Compatibility code must never be enabled by default.
32  */
33 
34 #ifdef NO_MKSTEMPS
35 #define mkstemps compat_mkstemps
36 int compat_mkstemps(char *pattern, int suffix_len);
37 #endif
38 
39 #ifdef NO_SETENV
40 #define setenv compat_setenv
41 int compat_setenv(const char *name, const char *value, int replace);
42 #endif
43 
44 #ifdef NO_STRNDUP
45 #include <stddef.h>
46 #define strndup compat_strndup
47 char *compat_strndup(const char *s, size_t n);
48 #endif
49 
50 #ifdef NO_WORDEXP
51 #define wordexp compat_wordexp
52 #define wordfree compat_wordfree
53 #define WRDE_NOCMD 4
54 typedef struct
55 {
56 	char **we_wordv;
57 } wordexp_t;
58 int compat_wordexp (const char *words, wordexp_t *pwordexp, int flags);
59 void compat_wordfree (wordexp_t *pwordexp);
60 #else
61 #include <wordexp.h>
62 #endif
63 
64 #endif
65 
66 /* vim: set ts=8 sw=8 noexpandtab: */
67