1 #ifndef _JOE_CONFIG_H
2 #define _JOE_CONFIG_H
3 
4 /* see bottom for RCSID on this one */
5 
6 #ifndef TEST
7 #include "autoconf.h"
8 #else
9 #define HAVE_CTIME 1
10 #define HAVE_STRLCAT 1
11 #define HAVE_STRLCPY 1
12 #define HAVE_DECL_STRLCAT 1
13 #define HAVE_DECL_STRLCPY 1
14 #define HAVE_GETCWD 1
15 #define HAVE_MKSTEMP 1
16 #define HAVE_SNPRINTF 1
17 #define HAVE_SYS_TYPES_H 1
18 #define HAVE_SYS_STAT_H 1
19 #define HAVE_DIRENT_H 1
20 #define HAVE_LIMITS_H 1
21 #define HAVE_SIGNAL_H 1
22 #define HAVE_STDLIB_H 1
23 #define HAVE_UNISTD_H 1
24 #define RETSIGTYPE void
25 #endif
26 
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
29 #endif
30 
31 #ifdef HAVE_SNPRINTF
32 
33 #define joe_snprintf_0(buf,len,fmt) snprintf((buf),(len),(fmt))
34 #define joe_snprintf_1(buf,len,fmt,a) snprintf((buf),(len),(fmt),(a))
35 #define joe_snprintf_2(buf,len,fmt,a,b) snprintf((buf),(len),(fmt),(a),(b))
36 #define joe_snprintf_3(buf,len,fmt,a,b,c) snprintf((buf),(len),(fmt),(a),(b),(c))
37 #define joe_snprintf_4(buf,len,fmt,a,b,c,d) snprintf((buf),(len),(fmt),(a),(b),(c),(d))
38 #define joe_snprintf_5(buf,len,fmt,a,b,c,d,e) snprintf((buf),(len),(fmt),(a),(b),(c),(d),(e))
39 #define joe_snprintf_6(buf,len,fmt,a,b,c,d,e,f) snprintf((buf),(len),(fmt),(a),(b),(c),(d),(e),(f))
40 #define joe_snprintf_7(buf,len,fmt,a,b,c,d,e,f,g) snprintf((buf),(len),(fmt),(a),(b),(c),(d),(e),(f),(g))
41 #define joe_snprintf_8(buf,len,fmt,a,b,c,d,e,f,g,h) snprintf((buf),(len),(fmt),(a),(b),(c),(d),(e),(f),(g),(h))
42 #define joe_snprintf_9(buf,len,fmt,a,b,c,d,e,f,g,h,i) snprintf((buf),(len),(fmt),(a),(b),(c),(d),(e),(f),(g),(h),(i))
43 #define joe_snprintf_10(buf,len,fmt,a,b,c,d,e,f,g,h,i,j) snprintf((buf),(len),(fmt),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j))
44 
45 #else
46 
47 #define joe_snprintf_0(buf,len,fmt) sprintf((buf),(fmt))
48 #define joe_snprintf_1(buf,len,fmt,a) sprintf((buf),(fmt),(a))
49 #define joe_snprintf_2(buf,len,fmt,a,b) sprintf((buf),(fmt),(a),(b))
50 #define joe_snprintf_3(buf,len,fmt,a,b,c) sprintf((buf),(fmt),(a),(b),(c))
51 #define joe_snprintf_4(buf,len,fmt,a,b,c,d) sprintf((buf),(fmt),(a),(b),(c),(d))
52 #define joe_snprintf_5(buf,len,fmt,a,b,c,d,e) sprintf((buf),(fmt),(a),(b),(c),(d),(e))
53 #define joe_snprintf_6(buf,len,fmt,a,b,c,d,e,f) sprintf((buf),(fmt),(a),(b),(c),(d),(e),(f))
54 #define joe_snprintf_7(buf,len,fmt,a,b,c,d,e,f,g) sprintf((buf),(fmt),(a),(b),(c),(d),(e),(f),(g))
55 #define joe_snprintf_8(buf,len,fmt,a,b,c,d,e,f,g,h) sprintf((buf),(fmt),(a),(b),(c),(d),(e),(f),(g),(h))
56 #define joe_snprintf_9(buf,len,fmt,a,b,c,d,e,f,g,h,i) sprintf((buf),(fmt),(a),(b),(c),(d),(e),(f),(g),(h),(i))
57 #define joe_snprintf_10(buf,len,fmt,a,b,c,d,e,f,g,h,i,j) sprintf((buf),(fmt),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j))
58 
59 #endif
60 
61 #include <stdio.h>
62 #ifndef EOF
63 #define EOF (-1)
64 #endif
65 #define NO_MORE_DATA EOF
66 
67 #ifdef PAGE_SIZE
68 #define PGSIZE PAGE_SIZE
69 #else
70 #define PGSIZE 4096
71 #endif
72 #define SEGSIZ PGSIZE
73 #define LPGSIZE 12
74 #define ILIMIT (PGSIZE*1024)
75 #define HTSIZE 2048
76 
77 #if !defined(__GNUC__) && !defined(__attribute__)
78 #define __attribute__(p) /* nothing */
79 #endif
80 
81 #ifdef HAVE_GCC_ATTRIBUTE_BOUNDED
82 #define ATTR_BOUNDED(p)	__attribute__((__bounded__ p))
83 #else
84 #define ATTR_BOUNDED(p)	/* nothing */
85 #endif
86 
87 #if !HAVE_DECL_STRLCAT
88 size_t strlcat(char *, const char *, size_t)
89     ATTR_BOUNDED((__string__, 1, 3));
90 #endif
91 #if !HAVE_DECL_STRLCPY
92 size_t strlcpy(char *, const char *, size_t)
93     ATTR_BOUNDED((__string__, 1, 3));
94 #endif
95 
96 /* from mksh */
97 
98 #define BIT(i)		(1U << (i))
99 #define NELEM(a)	(sizeof(a) / sizeof((a)[0]))
100 
101 #if defined(MirBSD) && (MirBSD >= 0x09A1) && \
102     defined(__ELF__) && defined(__GNUC__) && \
103     !defined(__llvm__) && !defined(__NWCC__)
104 /*
105  * We got usable __IDSTRING __COPYRIGHT __RCSID __SCCSID macros
106  * which work for all cases; no need to redefine them using the
107  * "portable" macros from below when we might have the "better"
108  * gcc+ELF specific macros or other system dependent ones.
109  */
110 #else
111 #undef __IDSTRING
112 #undef __IDSTRING_CONCAT
113 #undef __IDSTRING_EXPAND
114 #undef __COPYRIGHT
115 #undef __RCSID
116 #undef __SCCSID
117 #define __IDSTRING_CONCAT(l,p)		__LINTED__ ## l ## _ ## p
118 #define __IDSTRING_EXPAND(l,p)		__IDSTRING_CONCAT(l,p)
119 #ifdef MKSH_DONT_EMIT_IDSTRING
120 #define __IDSTRING(prefix, string)	/* nothing */
121 #elif defined(__ELF__) && defined(__GNUC__) && \
122     !defined(__llvm__) && !defined(__NWCC__) && !defined(NO_ASM)
123 #define __IDSTRING(prefix, string)				\
124 	__asm__(".section .comment"				\
125 	"\n	.ascii	\"@(\"\"#)" #prefix ": \""		\
126 	"\n	.asciz	\"" string "\""				\
127 	"\n	.previous")
128 #else
129 #define __IDSTRING(prefix, string)				\
130 	static const char __IDSTRING_EXPAND(__LINE__,prefix) []	\
131 	    __attribute__((__used__)) = "@(""#)" #prefix ": " string
132 #endif
133 #define __COPYRIGHT(x)		__IDSTRING(copyright,x)
134 #define __RCSID(x)		__IDSTRING(rcsid,x)
135 #define __SCCSID(x)		__IDSTRING(sccsid,x)
136 #endif
137 
138 #ifdef EXTERN
139 __IDSTRING(rcsid_config_h, "$MirOS: contrib/code/jupp/config.h,v 1.14 2017/12/08 02:17:21 tg Exp $");
140 #endif
141 
142 #endif /* ifndef _JOE_CONFIG_H */
143