Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / apps / JAWS / clients / WebSTONE / src / sysdep.h
blob09d13504754cd2223ee116f77bb5c99a35d76fb6
1 #ifndef __SYSDEP_H__
2 #define __SYSDEP_H__
3 /**************************************************************************
4 * *
5 * Copyright (C) 1995 Silicon Graphics, Inc. *
6 * *
7 * These coded instructions, statements, and computer programs were *
8 * developed by SGI for public use. If any changes are made to this code*
9 * please try to get the changes back to the author. Feel free to make *
10 * modifications and changes to the code and release it. *
11 * *
12 **************************************************************************/
14 /* include config.h, output from autoconf */
15 #ifdef HAVE_CONFIG_H
16 #ifndef __CONFIG_H__
17 #define __CONFIG_H__
18 #include "config.h"
19 #endif
20 #endif
22 #ifdef WIN32
23 #include <windows.h>
24 #include <winsock.h>
25 #endif /* WIN32 */
27 /* MAXHOSTNAMELEN is undefined on some systems */
28 #ifndef MAXHOSTNAMELEN
29 #define MAXHOSTNAMELEN 64
30 #endif
32 //FUZZ: disable check_for_NULL
33 /* SunOS doesn't define NULL */
34 #ifndef NULL
35 #define NULL 0
36 #endif
37 //FUZZ: enable check_for_NULL
39 /* encapsulation of minor UNIX/WIN NT differences */
40 #ifdef WIN32
41 #define NETREAD(sock, buf, len) recv(sock, buf, len, 0)
42 #define NETWRITE(sock, buf, len) send(sock, buf, len, 0)
43 #define NETCLOSE(sock) closesocket(sock)
44 #define BADSOCKET(sock) ((sock) == INVALID_SOCKET)
45 #define BADSOCKET_ERRNO(sock) BADSOCKET(sock)
46 #define BADSOCKET_VALUE INVALID_SOCKET
47 #define S_ADDR S_un.S_addr
49 #ifdef USE_TIMEZONE
50 #error NT gettimeofday() doesn't support USE_TIMEZONE (yet)
51 #else
52 #define GETTIMEOFDAY(timeval, tz) gettimeofday(timeval)
53 #endif /* USE_TIMEZONE */
55 typedef unsigned short NETPORT;
56 #define SRANDOM srand
57 #define RANDOM_R rand_r
58 #define RANDOM rand
59 #define THREAD __declspec ( thread )
60 #define PROGPATH "c:\\webstone\\webclient"
61 #define FILENAME_SIZE 256
62 #define HAVE_VPRINTF 1
64 #define SIGCHLD 0 /* dummy value */
65 #define SIGALRM 0 /* dummy value */
66 typedef int pid_t;
67 typedef unsigned short ushort;
68 #define MAXPATHLEN 512
71 #else /* not WIN32 */
72 #define NETREAD(sock, buf, len) read(sock, buf, len)
73 #define NETWRITE(sock, buf, len) write(sock, buf, len)
74 #define NETCLOSE(sock) close(sock)
75 #define BADSOCKET(sock) ((sock) < 0)
76 #define BADSOCKET_ERRNO(sock) (BADSOCKET(sock) || errno)
77 #define BADSOCKET_VALUE (-1)
78 #define S_ADDR s_addr
80 #ifdef USE_TIMEZONE
81 #define GETTIMEOFDAY(timeval,tz) gettimeofday(timeval, 0)
82 #else
83 #define GETTIMEOFDAY(timeval,tz) gettimeofday(timeval, tz)
84 #endif /* USE_TIMEZONE */
86 typedef unsigned short NETPORT;
87 #define SRANDOM srandom
88 #define RANDOM random
89 #define THREAD
90 #define PROGPATH "/tmp/webclient" /* "/usr/local/bin/webclient" */
91 #define FILENAME_SIZE 1024
92 #define HAVE_VPRINTF 1
94 typedef int SOCKET;
95 #define min(a,b) (((a) < (b)) ? a : b)
96 #define max(a,b) (((a) > (b)) ? a : b)
97 #endif /* WIN32 */
100 /* function prototypes */
102 #ifdef WIN32
103 int getopt(int argc, char ** argv, char *opts);
104 int getpid();
105 int gettimeofday(struct timeval *curTimeP);
106 int random_number(int max);
107 SOCKET rexec(const char **hostname, NETPORT port, char *username, char *password,
108 char *command, SOCKET *sockerr);
109 void sleep(int secs);
111 #else
112 #ifdef NO_REXEC
113 extern int rexec(char **, int, char *, char *, char *, int *);
114 #endif
115 #endif /* WIN32 */
118 #ifndef HAVE_STRERROR
119 /* strerror() is not available on SunOS 4.x and others */
120 char *strerror(int errnum);
122 #endif
123 /* strerror() */
126 #ifndef INADDR_NONE
127 #define INADDR_NONE -1
128 #endif
130 /* !__SYSDEP_H__ */
131 #endif