diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/bbs.h | 22 | ||||
-rw-r--r-- | include/osdep.h | 64 | ||||
-rw-r--r-- | include/proto.h | 34 |
3 files changed, 97 insertions, 23 deletions
diff --git a/include/bbs.h b/include/bbs.h index 45ca1292..5b4dca21 100644 --- a/include/bbs.h +++ b/include/bbs.h @@ -34,27 +34,7 @@ #include <sys/sem.h> #include <sys/msg.h> -/* os dependant include file, define */ -#ifdef __FreeBSD__ - #if __FreeBSD__ >=5 - #include <sys/limits.h> - #else - #include <machine/limits.h> - #endif - #include <machine/param.h> -#endif -#ifdef __linux__ - #include <sys/param.h> - #include <sys/ioctl.h> - #include <limits.h> - #include <sys/file.h> /* for flock() */ - #include <strings.h> /* for strcasecmp() */ - size_t - strlcpy(char *dst, const char *src, size_t size); - - size_t - strlcat(char *dst, const char *src, size_t size); -#endif +#include "osdep.h" /* our header */ #include "config.h" diff --git a/include/osdep.h b/include/osdep.h new file mode 100644 index 00000000..a7c719d1 --- /dev/null +++ b/include/osdep.h @@ -0,0 +1,64 @@ + +#ifndef __OSDEP_H__ +#define __OSDEP_H__ + +/* os dependant include file, define */ +#ifdef __FreeBSD__ + #if __FreeBSD__ >= 5 + #include <sys/limits.h> + #else + #include <machine/limits.h> + #endif + #include <machine/param.h> + +#elif defined(__linux__) + + #include <sys/param.h> + #include <sys/ioctl.h> + #include <limits.h> + #include <sys/file.h> /* for flock() */ + #include <strings.h> /* for strcasecmp() */ + + #define NEED_STRCASESTR + #define NEED_STRLCPY + #define NEED_STRLCAT + +#elif defined(Solaris) + + #include <alloca.h> + #include <crypt.h> + #include <sys/param.h> + #include <sys/ioctl.h> + #include <limits.h> + #include <strings.h> /* for strcasecmp() */ + + #define NEED_FLOCK + #define NEED_UNSETENV + #define NEED_SCANDIR + #define NEED_STRCASESTR + + #if __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 8 + #define NEED_STRLCPY + #define NEED_STRLCAT + #define NEED_INET_PTON + #endif + + #if __OS_MAJOR_VERSION__ == 5 && __OS_MAJOR_VERSION__ < 6 + #define NEED_BSD_SIGNAL + #endif + +#else + + #warning "Unknown OSTYPE" + +#endif + + +#ifdef Solaris + #define Signal (bsd_signal) +#else + #define Signal (signal) +#endif + + +#endif diff --git a/include/proto.h b/include/proto.h index f86e0a24..6c42c241 100644 --- a/include/proto.h +++ b/include/proto.h @@ -375,11 +375,41 @@ int completeutmp_compar(int where, char *str, int len); int completeutmp_permission(int where); char *completeutmp_getname(int where); + /* osdep */ int cpuload(char *str); double swapused(int *total, int *used); -#ifdef __linux__ -char *strcasestr(const char *big, const char *little); + +#ifdef NEED_FLOCK + #define LOCK_EX 1 + #define LOCK_UN 2 + + int flock(int, int); +#endif + +#ifdef NEED_UNSETENV + void unsetenv(char *name); +#endif + +#ifdef NEED_STRCASESTR + char *strcasestr(const char *big, const char *little); +#endif + +#ifdef NEED_STRLCPY + size_t strlcpy(char *dst, const char *src, size_t size); +#endif + +#ifdef NEED_STRLCAT + size_t strlcat(char *dst, const char *src, size_t size); +#endif + +#ifdef NEED_SCANDIR + int scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const void *, const void *)); + int alphasort(const void *d1, const void *d2); +#endif + +#ifdef NEED_INET_PTON + int inet_pton(int af, const char *src, void *dst); #endif /* othello */ |