/**************************************************************************** * * * The contents of this file are subject to the WebStone Public License * * Version 1.0 (the "License"); you may not use this file except in * * compliance with the License. You may obtain a copy of the License * * at http://www.mindcraft.com/webstone/license10.html * * * * Software distributed under the License is distributed on an "AS IS" * * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * * the License for the specific language governing rights and limitations * * under the License. * * * * The Original Code is WebStone 2.5. * * * * The Initial Developer of the Original Code is Silicon Graphics, Inc. * * and Mindcraft, Inc.. Portions created by Silicon Graphics. and * * Mindcraft. are Copyright (C) 1995-1998 Silicon Graphics, Inc. and * * Mindcraft, Inc. All Rights Reserved. * * * * Contributor(s): ______________________________________. * * * ***************************************************************************/ #ifndef __SYSDEP_H__ #define __SYSDEP_H__ /* include config.h, output from autoconf */ #ifdef HAVE_CONFIG_H #ifndef __CONFIG_H__ #define __CONFIG_H__ #include "config.h" #endif #else #define VERSION "2.5b" #endif #ifdef WIN32 #include #include #endif /* WIN32 */ /* MAXHOSTNAMELEN is undefined on some systems */ #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif /* SunOS doesn't define NULL */ #ifndef NULL #define NULL 0 #endif /* encapsulation of minor UNIX/WIN NT differences */ #ifdef WIN32 #define NETREAD(sock, buf, len) recv(sock, buf, len, 0) #define NETWRITE(sock, buf, len) send(sock, buf, len, 0) #define NETCLOSE(sock) closesocket(sock) #define BADSOCKET(sock) ((sock) == INVALID_SOCKET) #define BADSOCKET_VALUE INVALID_SOCKET #define SOCK_ERR(ret) ((ret) == SOCKET_ERROR) #define CLEAR_SOCK_ERR WSASetLastError(0) #define GET_NET_ERR WSAGetLastError() #define S_ADDR S_un.S_addr #ifdef USE_TIMEZONE #error NT gettimeofday() does not support USE_TIMEZONE (yet) #else #define GETTIMEOFDAY(timeval, tz) gettimeofday(timeval) #endif /* USE_TIMEZONE */ typedef unsigned short NETPORT; #define SRANDOM srand #define RANDOM rand #define THREAD __declspec ( thread ) #define FILENAME_SIZE 256 #define HAVE_VPRINTF 1 #define SIGCHLD 0 /* dummy value */ #define SIGALRM 0 /* dummy value */ typedef int pid_t; typedef unsigned short ushort; #define MAXPATHLEN 512 #else /* not WIN32 */ #define NETREAD(sock, buf, len) read(sock, buf, len) #define NETWRITE(sock, buf, len) write(sock, buf, len) #define NETCLOSE(sock) close(sock) #define BADSOCKET(sock) ((sock) < 0) #define BADSOCKET_VALUE (-1) #define SOCK_ERR(ret) ((ret) < 0) #define CLEAR_SOCK_ERR errno = 0 #define GET_NET_ERR errno #define S_ADDR s_addr #ifdef USE_TIMEZONE #define GETTIMEOFDAY(timeval,tz) gettimeofday(timeval, NULL) #else #define GETTIMEOFDAY(timeval,tz) gettimeofday(timeval, tz) #endif /* USE_TIMEZONE */ typedef unsigned short NETPORT; #define SRANDOM srand #define RANDOM rand #define THREAD #define FILENAME_SIZE 1024 #define HAVE_VPRINTF 1 typedef int SOCKET; #define min(a,b) (((a) < (b)) ? a : b) #define max(a,b) (((a) > (b)) ? a : b) #endif /* WIN32 */ /* function prototypes */ #ifdef WIN32 int getopt(int argc, char ** argv, char *opts); int getpid(void); int gettimeofday(struct timeval *curTimeP); int random_number(int max); SOCKET rexec(const char **hostname, NETPORT port, char *username, char *password, char *command, SOCKET *sockerr); void sleep(int secs); #else #ifdef NO_REXEC extern int rexec(char **, int, char *, char *, char *, int *); #endif #endif /* WIN32 */ #ifndef HAVE_STRERROR /* strerror() is not available on SunOS 4.x and others */ char *strerror(int errnum); #endif /* strerror() */ #ifndef INADDR_NONE #define INADDR_NONE -1 #endif /* !__SYSDEP_H__ */ #endif