comparison compat.h @ 3:67a643a734d9

Import
author ktk@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 03 Jul 2001 07:50:39 +0000
parents
children d9e87e8bcf1d
comparison
equal deleted inserted replaced
2:36c5f0ce3fbe 3:67a643a734d9
1 /* $Id$ */
2
3 /* This header includes and defines everything needed for a given OS/compiler */
4 #if !defined(__EMX__) && !defined(__IBMC__) && !defined(__WIN32__) && !defined(WINNT)
5 #include "config.h"
6
7 #define msleep(a) usleep(a*1000)
8 #endif /* Unix */
9
10 #include <sys/types.h>
11 #if HAVE_DIRENT_H
12 #include <dirent.h>
13 #define NAMLEN(dirent) strlen((dirent)->d_name)
14 #else
15 #define dirent direct
16 #define NAMLEN(dirent) (dirent)->d_namlen
17 #if HAVE_SYS_NDIR_H
18 #include <sys/ndir.h>
19 #endif /* HAVE_SYS_NDIR_H */
20 #if HAVE_SYS_DIR_H
21 #include <sys/dir.h>
22 #endif /* HAVE_SYS_DIR_H */
23 #if HAVE_NDIR_H
24 #include <ndir.h>
25 #endif /* HAVE_NDIR_H */
26 #endif /* HAVE_DIRENT_H */
27
28 #ifdef DIRSEP
29 #undef DIRSEP
30 #endif
31
32 #if defined(__EMX__) || defined(__IBMC__) || defined(__WIN32__) || defined(WINNT)
33 #include <io.h>
34 #include <process.h>
35
36 #define DIRSEP "\\"
37 #define INIDIR "."
38 #define TYPDIR "."
39 #else
40 #define DIRSEP "/"
41 #define INIDIR "~/.handyftp"
42 #define TYPDIR "/usr/local/handyftp"
43 #endif
44
45 /* OS/2 */
46 #if defined(__EMX__) || defined(__IBMC__)
47 #define INCL_WIN
48 #define INCL_GPI
49 #define INCL_VIO
50 #define INCL_NLS
51 #define INCL_DOS
52 #define INCL_DEV
53 #define INCL_DOSERRORS
54
55 #define msleep(a) DosSleep(a)
56
57 #ifdef __EMX__
58 #define FD_SETSIZE 1024
59 #define strcasecmp stricmp
60 #define strncasecmp strnicmp
61 #endif /* __EMX__ */
62
63 #ifndef OS2
64 #define OS2
65 #endif /* OS2 */
66
67 #include <os2.h>
68
69 #ifndef BKS_TABBEDDIALOG
70 #define BKS_TABBEDDIALOG 0x0800
71 #endif
72
73 #define PIPENAME "\\socket\\handyftp%d"
74 #define TPIPENAME "\\socket\\handyftpt%d"
75 #else
76 #define PIPENAME "/tmp/handyftp%d"
77 #define TPIPENAME "/tmp/handyftpt%d"
78 #endif /* __EMX__ || __IBMC__ */
79
80 #ifdef __IBMC__
81 #define BSD_SELECT
82
83 #include <types.h>
84 #include <time.h>
85 #include <sys/stat.h>
86 #include <sys/select.h>
87 #include <sys/ioctl.h>
88 #include <direct.h>
89 #include <stdarg.h>
90 /* For VAC we are using the Mozilla dirent.c */
91 #include "dirent.h"
92 #endif
93
94 /* Windows */
95 #if defined(__WIN32__) || defined(WINNT)
96 #include <windows.h>
97 #include <winsock.h>
98 #include <time.h>
99 #include <process.h>
100 #include <sys/stat.h>
101 #ifdef MSVC
102 #include "dirent.h"
103 #else
104 #include <dir.h>
105 #include <dirent.h>
106 #endif
107 #include <stdarg.h>
108
109 #if defined(__CYGWIN32__) || defined(__MINGW32__)
110 #include <sys/un.h>
111 #endif /* __CYGWIN32__ || __MINGW32__ */
112
113 #ifndef __CYGWIN32__
114 #define NO_DOMAIN_SOCKETS
115 #endif /* __CYGWIN32__ */
116
117 #if defined(_P_NOWAIT) && !defined(P_NOWAIT)
118 #define P_NOWAIT _P_NOWAIT
119 #endif
120
121 #define strcasecmp stricmp
122 #define strncasecmp strnicmp
123 #define msleep Sleep
124
125 #endif /* WIN32 */
126
127 /* Everything else ;) */
128 #include <stdio.h>
129 #ifdef HAVE_UNISTD_H
130 #include <unistd.h>
131 #endif /* HAVE_UNISTD_H */
132 #ifdef HAVE_SYS_STAT_H
133 #include <sys/stat.h>
134 #endif
135 #include <stdlib.h>
136 #include <stddef.h>
137 #include <signal.h>
138 #include <fcntl.h>
139
140 #if !defined(__WIN32__) && !defined(WINNT)
141 #include <sys/time.h>
142 #include <sys/socket.h>
143 #include <sys/un.h>
144 #include <netinet/in.h>
145 #include <netdb.h>
146 #include <arpa/nameser.h>
147 #include <resolv.h>
148 #ifdef STDC_HEADERS
149 #include <stdarg.h>
150 #include <string.h>
151 #endif /* STDC_HEADERS */
152 #endif /* !WIN32 */
153
154 #ifndef _MAX_PATH
155 #define _MAX_PATH 255
156 #endif
157
158 /* IBM C doesn't allow "t" in the mode parameter
159 * because it violates the ANSI standard.
160 */
161 #ifdef __IBMC__
162 #define FOPEN_READ_TEXT "r"
163 #define FOPEN_WRITE_TEXT "w"
164 #define FOPEN_APPEND_TEXT "a"
165 #else
166 #define FOPEN_READ_TEXT "rt"
167 #define FOPEN_WRITE_TEXT "wt"
168 #define FOPEN_APPEND_TEXT "at"
169 #endif
170 #define FOPEN_READ_BINARY "rb"
171 #define FOPEN_WRITE_BINARY "wb"
172 #define FOPEN_APPEND_BINARY "ab"
173
174 /* Compatibility layer for IBM C/Winsock */
175 int sockread (int a, void *b, int c, int d);
176 int sockwrite (int a, void *b, int c, int d);
177 int sockclose(int a);
178 int socksprintf(int fd, char *format, ...);
179 int sockpipe(int *pipes);
180 void sockinit(void);
181 void sockshutdown(void);
182 int makedir(char *path);
183 void nonblock(int fd);
184 void setfileinfo(char *filename, char *url);
185 #if defined(__IBMC__) || defined(__WIN32__)
186 unsigned long drivefree(int drive);
187 #else
188 unsigned long long drivefree(int drive);
189 #endif
190 int isdrive(int drive);
191 FILE *fsopen(char *path, char *modes);
192 int fsclose(FILE *fp);
193 char *fsgets(char *str, int size, FILE *stream);
194