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