xref: /minix/external/bsd/nvi/usr.bin/nvi/port.h (revision 84d9c625)
1 /* $Id: port.h,v 1.2 2013/11/29 22:56:19 christos Exp $ (Berkeley) $Date: 2013/11/29 22:56:19 $ */
2 
3 /*
4  * Declare the basic types, if they aren't already declared.  Named and
5  * some system's db.h files protect them with __BIT_TYPES_DEFINED__.
6  */
7 #ifndef __BIT_TYPES_DEFINED__
8 #define __BIT_TYPES_DEFINED__
9 
10 
11 
12 
13 
14 #endif
15 
16 
17 
18 
19 
20 
21 /*
22  * XXX
23  * Handle function prototypes.  This steps on name space that vi doesn't
24  * control, but all of the other solutions are worse.
25  */
26 #undef	__P
27 #if defined(__STDC__) || defined(__cplusplus)
28 #define	__P(protos)	protos		/* ANSI C prototypes */
29 #else
30 #define	__P(protos)	()		/* K&R C preprocessor */
31 #endif
32 
33 /*
34  * XXX
35  * Some versions of System V changed the number of arguments to gettimeofday
36  * without changing the name.
37  */
38 #ifdef HAVE_BROKEN_GETTIMEOFDAY
39 #define	gettimeofday(tv, tz)	gettimeofday(tv)
40 #endif
41 
42 /*
43  * XXX
44  * If we don't have mmap, we fake it with read and write, but we'll
45  * still need the header information.
46  */
47 #ifndef HAVE_SYS_MMAN_H
48 #define	MAP_SHARED	1		/* share changes */
49 #define	MAP_PRIVATE	2		/* changes are private */
50 #define	PROT_READ	0x1		/* pages can be read */
51 #define	PROT_WRITE	0x2		/* pages can be written */
52 #define	PROT_EXEC	0x4		/* pages can be executed */
53 #endif
54 
55 /*
56  * XXX
57  * POSIX 1003.1 names for file descriptors.
58  */
59 #ifndef STDERR_FILENO
60 #define STDIN_FILENO	0		/* ANSI C #defines */
61 #define STDOUT_FILENO	1
62 #define STDERR_FILENO	2
63 #endif
64 
65 /*
66  * XXX
67  * POSIX 1003.1 names for seek settings.
68  */
69 #ifndef SEEK_END
70 #define	SEEK_SET	0		/* POSIX 1003.1 seek values */
71 #define	SEEK_CUR	1
72 #define	SEEK_END	2
73 #endif
74 
75 /*
76  * Hack _POSIX_VDISABLE to \377 since Ultrix doesn't honor _POSIX_VDISABLE
77  * (treats it as ^@).  The symptom is that the ^@ keystroke immediately
78  * drops core.
79  */
80 #ifdef HAVE_BROKEN_VDISABLE
81 #undef	_POSIX_VDISABLE
82 #define	_POSIX_VDISABLE	((unsigned char)'\377')
83 #endif
84 
85 /*
86  * XXX
87  * POSIX 1003.1 tty disabling character.
88  */
89 #ifndef _POSIX_VDISABLE
90 #define	_POSIX_VDISABLE	0		/* Some systems used 0. */
91 #endif
92 
93 /*
94  * XXX
95  * 4.4BSD extension to only set the software termios bits.
96  */
97 #ifndef	TCSASOFT			/* 4.4BSD extension. */
98 #define	TCSASOFT	0
99 #endif
100 
101 /*
102  * XXX
103  * POSIX 1003.1 maximum path length.
104  */
105 #ifndef MAXPATHLEN
106 #ifdef PATH_MAX
107 #define	MAXPATHLEN	PATH_MAX
108 #else
109 #define	MAXPATHLEN	1024
110 #endif
111 #endif
112 
113 /*
114  * XXX
115  * MIN, MAX, historically in <sys/param.h>
116  */
117 #ifndef	MAX
118 #define	MAX(_a,_b)	((_a)<(_b)?(_b):(_a))
119 #endif
120 #ifndef	MIN
121 #define	MIN(_a,_b)	((_a)<(_b)?(_a):(_b))
122 #endif
123 
124 #ifndef USE_DB1
125 /*
126  * XXX
127  * "DB" isn't always portable, and we want the private information.
128  */
129 #define DB      L__DB
130 #undef	pgno_t			/* IRIX has its own version. */
131 #define	pgno_t	L__db_pgno_t
132 #endif
133 
134 /*
135  * XXX
136  * 4.4BSD extension to provide lock values in the open(2) call.
137  */
138 #ifndef O_EXLOCK
139 #define	O_EXLOCK	0
140 #endif
141 
142 #ifndef O_SHLOCK
143 #define	O_SHLOCK	0
144 #endif
145 
146 /*
147  * XXX
148  * POSIX 1003.1 bad file format errno.
149  */
150 #ifndef EFTYPE
151 #define	EFTYPE		EINVAL
152 #endif
153 
154 /*
155  * XXX
156  * POSIX 1003.2 RE length limit.
157  */
158 #ifndef	_POSIX2_RE_DUP_MAX
159 #define	_POSIX2_RE_DUP_MAX	255
160 #endif
161 
162 /*
163  * XXX
164  * 4.4BSD extension to determine if a program dropped core from the exit
165  * status.
166  */
167 #ifndef	WCOREDUMP
168 #define	WCOREDUMP(a)	0
169 #endif
170 
171 /*
172  * XXX
173  * Endian-ness of the machine.
174  */
175 #if !defined(LITTLE_ENDIAN)
176 #define	LITTLE_ENDIAN	1234
177 #endif
178 #if !defined(BIG_ENDIAN)
179 #define	BIG_ENDIAN	4321
180 #endif
181 #if !defined(BYTE_ORDER)
182 #if WORDS_BIGENDIAN == 1
183 #define	BYTE_ORDER	BIG_ENDIAN
184 #else
185 #define	BYTE_ORDER	LITTLE_ENDIAN
186 #endif
187 #endif
188 
189 #ifndef HAVE_MEMCPY
190 #define memcpy memmove
191 #endif
192 
193 #ifdef NEED_FPRINTF_PROTO
194 extern  int     fprintf( FILE *, const char *, ... );
195 #endif
196 
197 #ifdef HAVE_PTHREAD
198 #define VI_DB_THREAD DB_THREAD
199 #else
200 #define VI_DB_THREAD 0
201 #endif
202