1 /* bsd.h - simplify porting BSD programs to Linux - rick sladkey */ 2 3 /* make sure BSD features are enabled, i.e. __USE_BSD and _FAVOR_BSD */ 4 5 /* cpp in gcc 2.3.3 is broken. 6 #ifndef _BSD_BSD_H 7 #define _BSD_BSD_H 8 */ 9 10 #define _BSD_SOURCE 1 11 #include <features.h> 12 #include <endian.h> 13 14 /* some BSD progs expect MIN and MAX to be defined */ 15 16 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 17 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 18 19 /* make sure we get L_SET and L_INCR, which is in a different place */ 20 21 #include <sys/file.h> 22 23 /* BSD has slight non-POSIX names (and meanings :-) for some things */ 24 25 #define FAPPEND O_APPEND 26 27 #include <limits.h> 28 29 /* (absolute) max # characters in exec arglist */ 30 31 #define NCARGS ARG_MAX 32 33 /* ftpd uses this as bits per byte, I don't know why it's called NBBY */ 34 35 #define NBBY CHAR_BIT 36 37 /* gloss over slight differences between BSD direct and POSIX dirent */ 38 39 #define d_namlen d_reclen 40 41 #if 0 42 43 /* See <bsd/signal.h> */ 44 45 typedef void sig_t; 46 47 #endif 48 49 /* #endif _BSD_BSD_H */ 50