Annotation of libwww/Library/src/wwwsys.html, revision 2.118
2.7 timbl 1: <HTML>
2: <HEAD>
2.118 ! frystyk 3: <!-- Changed by: Henrik Frystyk Nielsen, 15-Jul-1996 -->
2.109 frystyk 4: <TITLE>W3C Sample Code Library libwww System Dependencies</TITLE>
2.7 timbl 5: </HEAD>
2.2 timbl 6: <BODY>
2.95 frystyk 7: <H1>
8: System Dependencies
9: </H1>
2.35 frystyk 10: <PRE>
11: /*
2.49 frystyk 12: ** (c) COPYRIGHT MIT 1995.
2.35 frystyk 13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
2.95 frystyk 16: <P>
2.97 frystyk 17: This file makes up for the differencies in the systems and platforms supported
18: by libwww. On Unix, it is a question of <A HREF="../../INSTALL.html">using
19: autoconf</A> to figure out what environment we are in. This is done by running
2.113 frystyk 20: the configure script which creates a <CODE>wwwconf.h</CODE> file. This
2.97 frystyk 21: configuration include file contains a large set of macro definitions telling
22: what features we have and don't have. On platforms not supported by autoconf
23: (Windows, Mac, VMS etc.) you will find the information normally contained
2.113 frystyk 24: in the <CODE>wwwconf.h</CODE> file directly included below. The
2.97 frystyk 25: <A HREF="#Platform">second part of this file </A>uses all the information
2.113 frystyk 26: that we either have from the wwwconf.h file or directly coded and actually
2.97 frystyk 27: does the includes etc.
28: <P>
29: <UL>
30: <LI>
2.113 frystyk 31: <A HREF="wwwsys.html#Unix">Unix</A>
2.97 frystyk 32: <LI>
2.113 frystyk 33: <A HREF="wwwsys.html#Microsoft">Microsoft Windows Win32 API</A>
2.97 frystyk 34: <LI>
2.113 frystyk 35: <A HREF="wwwsys.html#Macintosh">Macintosh</A>
2.97 frystyk 36: <LI>
2.113 frystyk 37: <A HREF="wwwsys.html#Macintosh">Vax VMS</A>
2.97 frystyk 38: </UL>
2.95 frystyk 39: <P>
2.118 ! frystyk 40: This module is a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample
! 41: Code Library</A>.
2.95 frystyk 42: <H3>
43: Authors
44: </H3>
2.2 timbl 45: <DL>
2.95 frystyk 46: <DT>
47: TBL
48: <DD>
49: Tim Berners-Lee, W3 project, CERN, <timbl@w3.org>
50: <DT>
51: EvA
52: <DD>
53: Eelco van Asperen <evas@cs.few.eur.nl>
54: <DT>
55: MA
56: <DD>
57: Marc Andreesen NCSA
58: <DT>
59: MD
60: <DD>
61: Mark Donszelmann <duns@vxcern.cern.ch>
62: <DT>
63: AT
64: <DD>
65: Aleksandar Totic <atotic@ncsa.uiuc.edu>
66: <DT>
67: SCW
68: <DD>
69: Susan C. Weber <sweber@kyle.eitech.com>
70: <DT>
71: HF
72: <DD>
73: Henrik Frystyk, <frystyk@w3.org>
74: <DT>
75: CLB
76: <DD>
77: Charlie Brooks, <cbrooks@osf.org>
2.2 timbl 78: </DL>
2.95 frystyk 79: <H3>
80: History:
81: </H3>
2.2 timbl 82: <DL>
2.95 frystyk 83: <DT>
84: 22 Feb 91
85: <DD>
86: Written (TBL) as part of the WWW library.
87: <DT>
88: 16 Jan 92
89: <DD>
90: PC code from (EvA)
91: <DT>
92: 22 Apr 93
93: <DD>
94: Merged diffs bits from xmosaic release
95: <DT>
96: 29 Apr 93
97: <DD>
98: Windows/NT code from (SCW)
99: <DT>
100: 29 Sep 93
101: <DD>
102: Mar 96 CLB - changed SLEEP() macro for Windows/NT MSC compiler added
103: BOOLEAN_DEFINED macro to avoid duplicate definitions in HUtils.h changed
104: netread() macros to support reading from stdin,etc. as well as sockets. (Required
105: for linemode browser to work).
106: <DT>
107: Henrik
108: <DD>
109: Changed to support autoconf for Unix
2.2 timbl 110: </DL>
2.1 timbl 111: <PRE>
2.88 frystyk 112: #ifndef SYSDEP_H
113: #define SYSDEP_H
2.26 frystyk 114: </PRE>
2.95 frystyk 115: <H1>
116: Platform Specific Stuff
117: </H1>
118: <H2>
2.97 frystyk 119: <A NAME="Unix">Unix</A>
2.95 frystyk 120: </H2>
121: <P>
2.97 frystyk 122: We rely on <I>autoconf</I> to do the dirty job. If you have any changhes
123: then please add them to the <A HREF="../../../INSTALL.html">configure
124: script</A>
2.26 frystyk 125: <PRE>
2.88 frystyk 126: #ifdef HAVE_CONFIG_H
2.113 frystyk 127: #include <wwwconf.h>
2.1 timbl 128: #endif
2.26 frystyk 129: </PRE>
2.95 frystyk 130: <H2>
2.97 frystyk 131: <A NAME="Microsoft">Microsoft Windows Win32 API</A>
2.95 frystyk 132: </H2>
133: <P>
2.83 frystyk 134: Help provided by Eric Prud'hommeaux, Susan C. Weber
135: <sweber@kyle.eitech.com>, Paul Hounslow
136: <P.M.Hounslow@reading.ac.uk>, and a lot of other PC people.
2.26 frystyk 137: <PRE>
2.83 frystyk 138: #if defined(_WINDOWS) || defined(_CONSOLE)
139: #define WWW_MSWINDOWS
140: #endif
141:
2.95 frystyk 142: #if defined(_WINDOWS) && !defined (_CONSOLE)
2.83 frystyk 143: #define WWW_WIN_WINDOW
144: #endif
145:
146: #if defined(_CONSOLE)
147: #define WWW_WIN_CONSOLE
148: #endif
149:
2.84 frystyk 150: #ifdef WWW_MSWINDOWS
2.107 frystyk 151:
2.111 frystyk 152: #include <windows.h>
153: #include <io.h>
154: #include <process.h>
155: #include <winsock.h>
156:
2.107 frystyk 157: #include "windows/config.h"
158:
2.37 frystyk 159: #define NETREAD(s,b,l) recv((s),(b),(l),0)
160: #define NETWRITE(s,b,l) send((s),(b),(l),0)
161: #define NETCLOSE(s) closesocket(s)
162: #define IOCTL(s,c,a) ioctlsocket(s,c, (long *) a)
2.4 timbl 163:
2.41 frystyk 164: #define MKDIR(a,b) mkdir((a))
2.56 frystyk 165: #define REMOVE(a) remove((a))
2.47 frystyk 166: #define DEFAULT_SUFFIXES "."
2.41 frystyk 167:
2.78 frystyk 168: #ifndef _CONSOLE
169: #define NO_STDIO
2.37 frystyk 170: #endif
171:
2.79 frystyk 172: #define SOCKET SOCKET /* WinSocks socket descriptor */
2.37 frystyk 173: #define INVSOC INVALID_SOCKET /* WinSocks invalid socket */
174:
175: #define DESIRED_WINSOCK_VERSION 0x0101 /* we'd like winsock ver 1.1... */
176: #define MINIMUM_WINSOCK_VERSION 0x0101 /* ...but we'll take ver 1.1 :) */
177: </PRE>
2.95 frystyk 178: <H3>
179: File and Directory Access
180: </H3>
181: <P>
182: These next defintions are because the UNIX stuff is not supplied with BC4
183: (Paul Hounslow <P.M.Hounslow@reading.ac.uk>)
2.37 frystyk 184: <PRE>
185: #define NO_UNIX_IO
186:
2.84 frystyk 187: #define _IFMT 0170000 /* type of file */
188: #define _IFDIR 0040000 /* directory */
189: #define _IFCHR 0020000 /* character special */
190: #define _IFBLK 0060000 /* block special */
191: #define _IFREG 0100000 /* regular */
192: #define _IFLNK 0120000 /* symbolic link */
193: #define _IFSOCK 0140000 /* socket */
194: #define _IFIFO 0010000 /* fifo */
2.37 frystyk 195:
196: #define S_ISUID 0004000 /* set user id on execution */
197: #define S_ISGID 0002000 /* set group id on execution */
198: #define S_ISVTX 0001000 /* save swapped text even after use */
199:
200: #ifdef S_IREAD
201: #undef S_IREAD
202: #define S_IREAD 0000400 /* read permission, owner */
203: #endif
204:
205: #ifdef S_IWRITE
206: #undef S_IWRITE
207: #define S_IWRITE 0000200 /* write permission, owner */
208: #endif
209:
210: #ifdef S_IEXEC
211: #undef S_IEXEC
212: #define S_IEXEC 0000100 /* execute/search permission, owner */
213: #endif
214:
215: #define S_ENFMT 0002000 /* enforcement-mode locking */
216:
217: #ifdef S_IFMT
218: #undef S_IFMT
219: #define S_IFMT _IFMT
220: #endif
221:
222: #ifdef S_IDIR
223: #undef S_IDIR
224: #define S_IFDIR _IFDIR
225: #endif
226:
227: #ifdef S_IFCHR
228: #undef S_IFCHR
229: #define S_IFCHR _IFCHR
230: #endif
231:
232: #ifdef S_IBLK
233: #undef S_IBLK
234: #define S_IFBLK _IFBLK
235: #endif
236:
237: #ifdef S_IREG
238: #undef S_IREG
239: #define S_IFREG _IFREG
240: #endif
241:
242: #define S_IFLNK _IFLNK
243:
244: #ifdef S_IFIFO
245: #undef S_IFIFO
246: #define S_IFIFO _IFIFO
247: #endif
248:
249: #define S_IRWXU 0000700 /* rwx, owner */
250: #define S_IRUSR 0000400 /* read permission, owner */
251: #define S_IWUSR 0000200 /* write permission, owner */
252: #define S_IXUSR 0000100 /* execute/search permission, owner */
253: #define S_IRWXG 0000070 /* rwx, group */
254: #define S_IRGRP 0000040 /* read permission, group */
255: #define S_IWGRP 0000020 /* write permission, grougroup */
256: #define S_IXGRP 0000010 /* execute/search permission, group */
257: #define S_IRWXO 0000007 /* rwx, other */
258: #define S_IROTH 0000004 /* read permission, other */
259: #define S_IWOTH 0000002 /* write permission, other */
260: #define S_IXOTH 0000001 /* execute/search permission, other */
261:
2.95 frystyk 262: #define S_ISREG(m) (((m)&_IFMT) == _IFREG)
2.37 frystyk 263: </PRE>
2.95 frystyk 264: <H3>
265: Errno and Return Codes
266: </H3>
267: <P>
268: Winsock has its own errno codes and it returns them through WSAGetLastError().
269: However, it does also support BSD error codes, so we make a compromise. WSA
270: definitions moved from _WIN32 ifdef by EGP
2.37 frystyk 271: <PRE>
272: #define socerrno WSAGetLastError()
273: #define ERRNO_DONE
274: </PRE>
2.95 frystyk 275: <P>
276: Return code for socket functions. We can't use -1 as return value
277: <P>
2.104 eric 278: <PRE>
279: #define EWOULDBLOCK WSAEWOULDBLOCK
2.77 frystyk 280: #define EINPROGRESS WSAEINPROGRESS
281: #define ECONNREFUSED WSAECONNREFUSED
282: #define ETIMEDOUT WSAETIMEDOUT
283: #define ENETUNREACH WSAENETUNREACH
284: #define EHOSTUNREACH WSAEHOSTUNREACH
285: #define EHOSTDOWN WSAEHOSTDOWN
286: #define EISCONN WSAEISCONN
2.104 eric 287: #define EINVAL WSAEINVAL
2.38 frystyk 288:
2.48 frystyk 289: /* Some compilers do only define WIN32 and NOT _WINDOWS */
2.77 frystyk 290: #define NO_GROUPS
2.85 frystyk 291:
2.77 frystyk 292: #ifdef _WIN32
2.85 frystyk 293: #define MKDIR(a,b) mkdir((a)) /* CLB NT has mkdir, but only one arg */
2.77 frystyk 294: #define SLEEP(n) Sleep((n)*1000)
295: #else
2.85 frystyk 296: #define MKDIR(a,b) _mkdir((a)) /* CLB NT has mkdir, but only one arg */
2.50 frystyk 297: #endif /* WIN32 */
2.84 frystyk 298:
299: #endif /* WWW_MSWINDOWS */
2.38 frystyk 300: </PRE>
2.95 frystyk 301: <H2>
2.97 frystyk 302: <A NAME="Macintosh">Macintosh</A>
2.95 frystyk 303: </H2>
304: <P>
2.97 frystyk 305: We have two environments on Macintosh: Codeworrior and MPV.
306: <H3>
307: Metrowerks Codewarrior 6
308: </H3>
309: <P>
2.95 frystyk 310: Metrowerks Codewarrior is one development environment on the Mac. We are
311: using GUSI (1.5.9) by Matthias Neeracher <neeri@iis.ee.ethz.ch> for
2.97 frystyk 312: our socket lib. You can find more information about the
313: <A HREF="http://err.ethz.ch/~neeri/macintosh/gusiman/">GUSI Library</A> from
314: Switzerland.
2.95 frystyk 315: <P>
316: Compiles on PPC. Should compile on 68K.
317: <P>
2.118 ! frystyk 318: August 31, 1995 by Steven T. Roussey <sroussey@eng.uci.edu> (STR).
! 319: and jeff@macalot.com (Jeff Dripps). Thanks a bunch!
2.88 frystyk 320: <PRE>
321: #ifdef __MWERKS__
2.116 veillard 322: #include <gusi.h>
323: #include <dirent.h>
324: #include <errno.h>
325: #include <sys/errno.h>
326: #include <sioux.h>
2.88 frystyk 327:
328: #define INCLUDES_DONE
329: #define TCP_INCLUDES_DONE
330:
2.98 frystyk 331: #define GUSI /* Identifies changes made for GUSI */
2.88 frystyk 332:
2.98 frystyk 333: #undef HAVE_GETDOMAINNAME /* STR */
2.88 frystyk 334: #undef HAVE_GETPASS
335: #undef HAVE_GETWD
336:
337: #define HAVE_GETCWD
338: #define USE_DIRENT
339: #define NO_GROUPS
340: #define GOT_READ_DIR
341:
2.98 frystyk 342: #undef HAVE_TIMEZONE /* STR */
2.88 frystyk 343: #define NO_GMTOFF
344: #define HAVE_STRERROR
2.98 frystyk 345: #define HAVE_GETHOSTNAME
2.88 frystyk 346:
347: #define d_ino d_fileno /* backward compatibility */
348:
2.98 frystyk 349: #define SLEEP(n) GUSIDefaultSpin( SP_SLEEP, n/60)
2.88 frystyk 350:
351: #define MKDIR(a,b) mkdir(a)
2.98 frystyk 352:
353: #define HAVE_STRFTIME // added JTD:5/1/96
354: #define HAVE_MKTIME // added JTD:5/1/96
355: #define HAVE_STRCHR // added JTD:5/1/96
356: #define STDC_HEADERS // added JTD:5/1/96
357: #define HAVE_MEMCPY // added JTD:5/1/96
358: #define TTY_IS_SELECTABLE // added JTD:5/1/96
359: #define HAVE_READDIR // added JTD:5/1/96
360: #define HAVE_DIRENT_INO // added JTD:5/1/96
361: #define HAVE_DIRENT_H // added JTD:5/1/96
362:
2.88 frystyk 363: #endif
364: </PRE>
2.97 frystyk 365: <H3>
366: MPW
367: </H3>
2.95 frystyk 368: <P>
369: MPW is one development environment on the Mac.
370: <P>
371: This entry was created by Aleksandar Totic (atotic@ncsa.uiuc.edu) this file
372: is compatible with sockets package released by NCSA. One major conflict is
373: that this library redefines write/read/etc as macros. In some of HTML code
374: these macros get executed when they should not be. Such files should define
375: NO_SOCKET_DEFS on top. This is a temporary hack.
2.88 frystyk 376: <PRE>
377: #ifdef applec /* MPW */
378: #undef HAVE_SYSTEM
379: #define DEBUG /* Can't put it on the CC command line */
380:
381: #define NO_UNIX_IO /* getuid() missing */
382: #undef HAVE_GETPID /* getpid() does not exist */
383: #define NO_GETWD /* getwd() does not exist */
384:
385: #define NETCLOSE s_close /* Routine to close a TCP-IP socket */
386: #define NETREAD s_read /* Routine to read from a TCP-IP socket */
387: #define NETWRITE s_write /* Routine to write to a TCP-IP socket */
388:
389: #define _ANSI_SOURCE
390: #define GUI
391: #define LINEFEED 10
392: #define ANON_FTP_HOSTNAME
393: #ifndef NO_SOCKET_DEFS
394: #include <MacSockDefs.h>
395: #endif /* NO_SOCKET_DEFS */
396:
397: #include <socket.ext.h>
398: #include <string.h>
399:
400: #endif /* applec MPW */
401: </PRE>
2.95 frystyk 402: <H2>
2.97 frystyk 403: <A NAME="VAX">VAX/VMS</A>
2.95 frystyk 404: </H2>
405: <P>
406: Under VMS, there are many versions of TCP-IP. Define one if you do not use
407: Digital's UCX product:
2.4 timbl 408: <DL>
2.95 frystyk 409: <DT>
410: UCX
411: <DD>
412: DEC's "Ultrix connection" (default)
413: <DT>
414: WIN_TCP
415: <DD>
416: From Wollongong, now GEC software.
417: <DT>
418: MULTINET
419: <DD>
420: From SRI, now from TGV Inv.
421: <DT>
422: DECNET
423: <DD>
424: Cern's TCP socket emulation over DECnet
2.4 timbl 425: </DL>
2.95 frystyk 426: <P>
427: The last three do not interfere with the unix i/o library, and so they need
428: special calls to read, write and close sockets. In these cases the socket
429: number is a VMS channel number, so we make the @@@ HORRIBLE @@@ assumption
430: that a channel number will be greater than 10 but a unix file descriptor
431: less than 10. It works.
2.26 frystyk 432: <PRE>
2.76 frystyk 433: #ifdef VMS
434: #include "HTVMSUtils.h"
2.47 frystyk 435: #define CACHE_FILE_PREFIX "SYS$LOGIN:Z_"
436: #define DEFAULT_SUFFIXES "._"
2.7 timbl 437:
2.88 frystyk 438: #define HAVE_CUSERID
439:
2.7 timbl 440: #ifdef WIN_TCP
2.32 frystyk 441: #define NETREAD(s,b,l) ((s)>10 ? netread((s),(b),(l)) : read((s),(b),(l)))
442: #define NETWRITE(s,b,l) ((s)>10 ? netwrite((s),(b),(l)) : write((s),(b),(l)))
443: #define NETCLOSE(s) ((s)>10 ? netclose(s) : close(s))
2.16 duns 444: #endif /* WIN_TCP */
2.1 timbl 445:
446: #ifdef MULTINET
447: #undef NETCLOSE
448: #undef NETREAD
449: #undef NETWRITE
2.32 frystyk 450: #define NETREAD(s,b,l) ((s)>10 ? socket_read((s),(b),(l)) : read((s),(b),(l)))
451: #define NETWRITE(s,b,l) ((s)>10 ? socket_write((s),(b),(l)) : \
2.1 timbl 452: write((s),(b),(l)))
2.32 frystyk 453: #define NETCLOSE(s) ((s)>10 ? socket_close(s) : close(s))
2.37 frystyk 454: #define IOCTL(s,c,a) socket_ioctl(s,c,a);
2.16 duns 455: #endif /* MULTINET */
2.1 timbl 456:
457: #ifdef DECNET
2.74 frystyk 458: #define DNP_OBJ 80 /* This one doesn't look busy, but we must check */
459: /* That one was for decnet */
460: #undef SELECT /* not supported */
2.32 frystyk 461: #define NETREAD(s,b,l) ((s)>10 ? recv((s),(b),(l),0) : read((s),(b),(l)))
462: #define NETWRITE(s,b,l) ((s)>10 ? send((s),(b),(l),0) : write((s),(b),(l)))
463: #define NETCLOSE(s) ((s)>10 ? socket_close(s) : close(s))
2.73 frystyk 464:
2.88 frystyk 465: #undef HAVE_GETHOSTNAME /* Decnet doesn't have a name server */
2.1 timbl 466: #endif /* Decnet */
2.73 frystyk 467:
2.88 frystyk 468: #undef HAVE_GETDOMAINNAME
2.31 duns 469:
2.1 timbl 470: /* Certainly this works for UCX and Multinet; not tried for Wollongong
471: */
472: #ifdef MULTINET
2.32 frystyk 473: #include <time.h>
2.16 duns 474: #ifdef __TIME_T
475: #define __TYPES
476: #define __TYPES_LOADED
477: #endif /* __TIME_T */
2.37 frystyk 478: #include <multinet_root:[multinet.include.sys]types.h>
479: #include <multinet_root:[multinet.include]errno.h>
2.16 duns 480: #ifdef __TYPES
481: #define __TIME_T
482: #endif /* __TYPE */
483: #ifdef __TIME_LOADED
484: #define __TIME
485: #endif /* __TIME_LOADED */
2.37 frystyk 486: #include <multinet_root:[multinet.include.sys]time.h>
2.16 duns 487: #else /* not MULTINET */
2.32 frystyk 488: #include <types.h>
489: #include <errno.h>
490: #include <time.h>
2.16 duns 491: #endif /* not MULTINET */
2.1 timbl 492:
493: #include string
494:
495: #ifndef STDIO_H
2.24 luotonen 496: #include <stdio>
2.1 timbl 497: #define STDIO_H
498: #endif
499:
500: #include file
501:
2.37 frystyk 502: #ifndef DECNET /* Why is it used at all ? Types conflict with "types.h> */
2.1 timbl 503: #include unixio
504: #endif
505:
506: #define INCLUDES_DONE
507:
508: #ifdef MULTINET /* Include from standard Multinet directories */
2.37 frystyk 509: #include <multinet_root:[multinet.include.sys]socket.h>
2.1 timbl 510: #ifdef __TIME_LOADED /* defined by sys$library:time.h */
511: #define __TIME /* to avoid double definitions in next file */
512: #endif
2.37 frystyk 513: #include <multinet_root:[multinet.include.netinet]in.h>
514: #include <multinet_root:[multinet.include.arpa]inet.h>
515: #include <multinet_root:[multinet.include]netdb.h>
516: #include <multinet_root:[multinet.include.sys]ioctl.h>
2.1 timbl 517:
518: #else /* not multinet */
519: #ifdef DECNET
2.37 frystyk 520: #include <types.h> /* for socket.h */
521: #include <socket.h>
2.65 frystyk 522: #include <dn>
523: #include <dnetdb>
2.1 timbl 524:
525: #else /* UCX or WIN */
2.16 duns 526: #ifdef CADDR_T
527: #define __CADDR_T
528: #endif /* problem with xlib.h inclusion */
2.32 frystyk 529: #include <socket.h>
530: #include <in.h>
531: #include <inet.h>
532: #include <netdb.h>
533: #include <ucx$inetdef.h>
2.1 timbl 534:
535: #endif /* not DECNET */
536: #endif /* of Multinet or other TCP includes */
537:
538: #define TCP_INCLUDES_DONE
2.63 frystyk 539:
540: #ifdef UCX
541: #define SIMPLE_TELNET
542: #endif
2.26 frystyk 543: </PRE>
2.95 frystyk 544: <P>
545: On VMS directory browsing is available through a separate copy of dirent.c.
546: The definition of R_OK seem to be missing from the system include files...
2.31 duns 547: <PRE>
548: #define USE_DIRENT
2.37 frystyk 549: #define GOT_READ_DIR
550: #include <dirent.h>
2.88 frystyk 551: #define DIR struct dirent
2.31 duns 552: #define R_OK 4
553: </PRE>
2.95 frystyk 554: <P>
555: On VMS machines, the linker needs to be told to put global data sections
556: into a data segment using these storage classes. (MarkDonszelmann)
2.26 frystyk 557: <PRE>
558: #ifdef VAXC
2.7 timbl 559: #define GLOBALDEF globaldef
560: #define GLOBALREF globalref
561: #endif /* VAXC */
2.1 timbl 562: #endif /* vms */
2.26 frystyk 563: </PRE>
2.95 frystyk 564: <P>
565: On non-VMS machines, the GLOBALDEF and GLOBALREF storage types default to
566: normal C storage types.
2.26 frystyk 567: <PRE>
568: #ifndef GLOBALREF
2.7 timbl 569: #define GLOBALDEF
570: #define GLOBALREF extern
571: #endif
2.31 duns 572: </PRE>
2.95 frystyk 573: <P>
574: On non-VMS machines STAT should be stat...On VMS machines STAT is a function
575: that converts directories and devices so that you can stat them.
2.31 duns 576: <PRE>
577: #ifdef VMS
2.37 frystyk 578: typedef unsigned long mode_t;
2.69 frystyk 579: #define HT_STAT HTStat
580: #define HT_LSTAT HTStat
581: #else
582: #define HT_STAT stat
583: #define HT_LSTAT lstat
2.31 duns 584: #endif /* non VMS */
2.26 frystyk 585: </PRE>
2.95 frystyk 586: <H3>
587: Dynamic Memory
588: </H3>
589: <P>
590: Replace memory allocation and free C RTL functions with VAXC$xxx_OPT alternatives
591: for VAXC (but not DECC) on VMS. This makes a big performance difference.
592: (Foteos Macrides). Also have a look at the <A HREF="HTMemory.html">Dynamic
593: Memory Module</A> for how to handle <CODE>malloc</CODE> and
594: <CODE>calloc</CODE>.
2.88 frystyk 595: <PRE>
596: #ifdef VMS
597: #include <stdio.h>
598: #include <stdlib.h>
599: #include <unixlib.h>
600: #include <ctype.h>
2.95 frystyk 601: #if defined(VAXC) && !defined(__DECC)
2.88 frystyk 602: #define malloc VAXC$MALLOC_OPT
603: #define calloc VAXC$CALLOC_OPT
604: #define free VAXC$FREE_OPT
605: #define cfree VAXC$CFREE_OPT
606: #define realloc VAXC$REALLOC_OPT
607: #endif /* VAXC but not DECC */
608: #define unlink remove
609: #define gmtime localtime
610: #include <stat.h>
2.95 frystyk 611: #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
612: #define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
2.88 frystyk 613: #define putenv HTVMS_putenv
614: #endif /* VMS */
615: </PRE>
2.95 frystyk 616: <H3>
617: Strftime and other time stuff
618: </H3>
2.41 frystyk 619: <PRE>
620: #ifdef VMS
621: #ifndef DECC
2.88 frystyk 622: #undef HAVE_STRFTIME
2.41 frystyk 623: #endif
2.88 frystyk 624: #undef HAVE_MKTIME
625: #undef HAVE_TIMEGM
2.41 frystyk 626: #define NO_GMTOFF
2.88 frystyk 627: #undef HAVE_TIMEZONE
2.41 frystyk 628: #endif
2.90 eric 629:
2.41 frystyk 630: </PRE>
2.95 frystyk 631: <H3>
632: Definition of Errno
633: </H3>
2.37 frystyk 634: <PRE>
635: #ifdef VMS
636: #ifndef __DECC
637: extern int uerrno; /* Deposit of error info (as per errno.h) */
638: extern volatile noshare int socket_errno; /* socket VMS error info
639: (used for translation of vmserrno) */
640: extern volatile noshare int vmserrno; /* Deposit of VMS error info */
641: extern volatile noshare int errno; /* noshare to avoid PSECT conflict */
642: #define ERRNO_DONE
643: #endif /* not DECC */
644: #endif /* VMS */
645: </PRE>
2.95 frystyk 646: <P>
647: <HR>
648: <H1>
2.97 frystyk 649: <A NAME="Platform">Platform Independent Stuff</A>
2.95 frystyk 650: </H1>
651: <P>
2.88 frystyk 652: Here we use all the knowledge we got above...
2.95 frystyk 653: <H2>
654: Include Files
655: </H2>
656: <P>
657: This file includes all system header files that are needed, iff they exist.
658: Their existance is discovered by <CODE>configure</CODE>.
2.40 frystyk 659: <PRE>
2.88 frystyk 660: /* stdio.h */
661: #ifdef HAVE_STDIO_H
662: #include <stdio.h>
2.40 frystyk 663: #endif
664:
2.88 frystyk 665: /* types.h */
666: #ifdef HAVE_SYS_TYPES_H
667: #include <sys/types.h>
668: #else
669: #ifdef HAVE_TYPES_H
670: #include <types.h>
2.42 frystyk 671: #endif
2.32 frystyk 672: #endif
673:
2.88 frystyk 674: /* unistd.h */
675: #ifdef HAVE_UNISTD_H
2.28 luotonen 676: #include <unistd.h>
2.88 frystyk 677: #else
678: #ifdef HAVE_SYS_UNISTD_H
679: #include <sys/unistd.h>
680: #endif
2.32 frystyk 681: #endif
682:
2.88 frystyk 683: /* fcntl.h */
684: #ifdef HAVE_FCNTL_H
2.28 luotonen 685: #include <fcntl.h>
686: #else
2.88 frystyk 687: #ifdef HAVE_SYS_FCNTL_H
2.28 luotonen 688: #include <sys/fcntl.h>
689: #endif
2.88 frystyk 690: #endif
2.28 luotonen 691:
2.115 frystyk 692: /* sys/machine.h */
693: #ifdef HAVE_SYS_MACHINE_H
694: #include <sys/machine.h>
695: #endif
696:
2.88 frystyk 697: /* limits.h */
698: #ifdef HAVE_SYS_LIMITS_H
699: #include <sys/limits.h>
700: #else
701: #ifdef HAVE_LIMITS_H
2.32 frystyk 702: #include <limits.h>
2.88 frystyk 703: #endif
704: #endif
2.41 frystyk 705:
2.88 frystyk 706: /* stat.h */
707: #ifdef HAVE_SYS_STAT_H
708: #include <sys/stat.h>
709: #else
710: #ifdef HAVE_STAT_H
711: #include <stat.h>
712: #endif
2.41 frystyk 713: #endif
714:
2.112 frystyk 715: /* Patch for problems in glibc6 */
716: #if defined(__GLIBC__)
717: #undef S_IFMT
718: #undef S_IFDIR
719: #define S_IFMT __S_IFMT
720: #define S_IFDIR __S_IFDIR
721: #endif
722:
2.117 frystyk 723: /* in.h */
724: #ifdef HAVE_NETINET_IN_H
725: #include <netinet/in.h>
726: #else
727: #ifdef HAVE_IN_H
728: #include <in.h>
729: #endif
730: #endif
731:
2.103 frystyk 732: /* tcp.h */
733: #ifdef HAVE_NETINET_TCP_H
734: #include <netinet/tcp.h>
735: #else
736: #ifdef HAVE_TCP_H
737: #include <tcp.h>
738: #endif
739: #endif
740:
2.88 frystyk 741: /* file.h */
742: #ifdef HAVE_SYS_FILE_H
743: #include <sys/file.h>
744: #endif
2.37 frystyk 745:
2.88 frystyk 746: /* systeminfo.h */
747: #ifdef HAVE_SYS_SYSTEMINFO_H
748: #include <sys/systeminfo.h>
749: #endif
2.37 frystyk 750:
2.88 frystyk 751: /* ioctl.h */
752: #ifdef HAVE_SYS_IOCTL_H
753: #include <sys/ioctl.h>
754: #endif
2.32 frystyk 755:
2.108 frystyk 756: /* termios.h */
757: #ifdef HAVE_TERMIOS_H
758: #include <termios.h>
759: #endif
760:
2.88 frystyk 761: /* time.h */
762: #ifdef TIME_WITH_SYS_TIME
763: #include <sys/time.h>
764: #include <time.h>
765: #else
766: #ifdef HAVE_SYS_TIME_H
767: #include <sys/time.h>
768: #else
769: #ifdef HAVE_TIME_H
2.28 luotonen 770: #include <time.h>
2.88 frystyk 771: #endif
772: #endif
773: #endif
2.28 luotonen 774:
2.88 frystyk 775: /* string{,s}.h */
776: #ifdef HAVE_STRING_H
777: #include <string.h>
2.110 frystyk 778: #else
2.88 frystyk 779: #ifdef HAVE_STRINGS_H
780: #include <strings.h>
2.41 frystyk 781: #endif
2.110 frystyk 782: #endif
2.28 luotonen 783:
2.88 frystyk 784: /* syslog.h */
785: #ifdef HAVE_SYSLOG_H
786: #include <syslog.h>
787: #endif
2.28 luotonen 788:
2.88 frystyk 789: /* socket.h */
790: #ifdef HAVE_SYS_SOCKET_H
791: #include <sys/socket.h>
792: #else
793: #ifdef HAVE_SOCKET_H
794: #include <socket.h>
795: #endif
796: #endif
2.44 frystyk 797:
2.88 frystyk 798: /* socket.ext.h */
799: #ifdef HAVE_SOCKET_EXT_H
800: #include <socket.ext.h>
801: #endif
2.43 frystyk 802:
2.88 frystyk 803: /* appkit.h */
804: #ifdef HAVE_APPKIT_APPKIT_H
2.91 frystyk 805: #include <appkit/appkit.h>
2.88 frystyk 806: #else
807: #ifdef HAVE_APPKIT_H
2.91 frystyk 808: #include <appkit.h>
2.88 frystyk 809: #endif
810: #endif
2.43 frystyk 811:
2.88 frystyk 812: /* dn.h */
813: #ifdef HAVE_DN_H
814: #include <dn.h>
815: #endif
2.22 luotonen 816:
2.88 frystyk 817: /* ipc.h */
818: #ifdef HAVE_SYS_IPC_H
2.30 luotonen 819: #include <sys/ipc.h>
2.88 frystyk 820: #endif
2.41 frystyk 821:
2.88 frystyk 822: /* errno.h */
823: #ifdef HAVE_ERRNO_H
824: #include <errno.h>
825: #else
826: #ifdef HAVE_SYS_ERRNO_H
827: #include <sys/errno.h>
828: #else
829: #ifdef HAVE_NET_ERRNO_H
2.30 luotonen 830: #include <net/errno.h>
2.88 frystyk 831: #endif
832: #endif
833: #endif
2.22 luotonen 834:
2.88 frystyk 835: /* pwd.h */
836: #ifdef HAVE_PWD_H
837: #include <pwd.h>
838: #endif
2.22 luotonen 839:
2.88 frystyk 840: /* grp.h */
841: #ifdef HAVE_GRP_H
842: #include <grp.h>
843: #endif
2.21 frystyk 844:
2.88 frystyk 845: /* inet.h */
846: #ifdef HAVE_ARPA_INET_H
847: #include <arpa/inet.h>
848: #else
849: #ifdef HAVE_INET_H
850: #include <inet.h>
851: #endif
852: #endif
2.41 frystyk 853:
2.88 frystyk 854: /* netdb.h */
855: #ifdef HAVE_NETDB_H
856: #include <netdb.h>
857: #endif
2.41 frystyk 858:
2.88 frystyk 859: /* manifest.h */
860: #ifdef HAVE_MANIFEST_H
861: #include <manifest.h>
862: #endif
2.15 luotonen 863:
2.88 frystyk 864: /* bsdtypes.h */
865: #ifdef HAVE_BSDTYPES_H
866: #include <bsdtypes.h>
867: #endif
2.17 luotonen 868:
2.88 frystyk 869: /* stdefs.h */
870: #ifdef HAVE_STDEFS_H
871: #include <stdefs.h>
2.15 luotonen 872: #endif
873:
2.88 frystyk 874: /* bsdtime.h */
875: #ifdef HAVE_BSDTIME_H
876: #include <bsdtime.h>
2.15 luotonen 877: #endif
2.36 frystyk 878:
2.88 frystyk 879: /* select.h */
880: #ifdef HAVE_SYS_SELECT_H
881: #include <sys/select.h>
882: #else
883: #ifdef HAVE_SELECT_H
884: #include <select.h>
2.36 frystyk 885: #endif
2.88 frystyk 886: #endif
2.51 frystyk 887:
2.88 frystyk 888: /* dnetdb.h */
889: #ifdef HAVE_DNETDB_H
890: #include <dnetdb.h>
891: #endif
2.25 luotonen 892:
2.88 frystyk 893: /* ucx$inetdef.h */
894: #ifdef HAVE_UCX_INETDEF_H
895: #include <ucx$inetdef.h>
896: #endif
2.26 frystyk 897:
2.88 frystyk 898: /* libc.h */
899: #ifdef HAVE_LIBC_H
900: #include <libc.h>
901: #endif
2.32 frystyk 902:
2.88 frystyk 903: /* stdlib.h */
904: #ifdef HAVE_STDLIB_H
905: #include <stdlib.h>
906: #endif
2.32 frystyk 907:
2.88 frystyk 908: /* malloc.h */
909: #ifdef HAVE_MALLOC_H
910: #include <malloc.h>
2.58 frystyk 911: #endif
912:
2.88 frystyk 913: /* memory.h */
914: #ifdef HAVE_MEMORY_H
915: #include <memory.h>
916: #endif
2.58 frystyk 917:
2.88 frystyk 918: /* unixlib.h */
919: #ifdef HAVE_UNIXLIB_H
920: #include <unixlib.h>
921: #endif
2.58 frystyk 922:
2.111 frystyk 923: /* direct.h */
924: #ifdef HAVE_DIRECT_H
925: #include <direct.h>
926: #endif
927:
2.88 frystyk 928: /* ctype.h */
929: #ifdef HAVE_CTYPE_H
930: #include <ctype.h>
2.32 frystyk 931: #endif
932:
2.88 frystyk 933: /* curses.h */
934: #ifdef CURSES
935: #ifdef HAVE_CURSESX_H
936: #include <cursesX.h>
937: #else
938: #ifdef HAVE_CURSES_H
939: #include <curses.h>
940: #endif
941: #endif
2.62 frystyk 942: #endif
943:
2.88 frystyk 944: /* resource.h (some wait.h's require it) */
945: #ifdef HAVE_SYS_RESOURCE_H
946: #include <sys/resource.h>
947: #else
948: #ifdef HAVE_RESOURCE_H
949: #include <resource.h>
2.45 frystyk 950: #endif
2.81 frystyk 951: #endif
952:
2.88 frystyk 953: /* dirent.h / ndir.h / dir.h */
954: #ifdef HAVE_DIRENT_H
2.32 frystyk 955: #include <dirent.h>
2.95 frystyk 956: #define NAMLEN(dirent) strlen((dirent)->d_name)
2.26 frystyk 957: #else
2.88 frystyk 958: #define dirent direct
2.95 frystyk 959: #define NAMLEN(dirent) (dirent)->d_namlen
2.88 frystyk 960: #ifdef HAVE_SYS_NDIR_H
961: #include <sys/ndir.h>
962: #endif
963: #ifdef HAVE_SYS_DIR_H
2.32 frystyk 964: #include <sys/dir.h>
2.88 frystyk 965: #endif
966: #ifdef HAVE_DIR_H
967: #include <dir.h>
968: #endif
969: #ifdef HAVE_NDIR_H
970: #include <ndir.h>
971: #endif
2.26 frystyk 972: #endif
973:
2.111 frystyk 974: #if !defined(HAVE_STRCHR)
2.88 frystyk 975: #define strchr index
976: #define strrchr rindex
2.26 frystyk 977: #endif
2.111 frystyk 978: #if !defined(HAVE_MEMCPY)
2.88 frystyk 979: #define memcpy(d, s, n) bcopy((s), (d), (n))
980: #define memmove(d, s, n) bcopy((s), (d), (n))
2.25 luotonen 981: #endif
2.37 frystyk 982:
2.101 frystyk 983: /* Definition of var args */
984: #if defined(STDC_HEADERS) || defined(__STDC__)
2.88 frystyk 985: #include <stdarg.h>
986: #else
2.90 eric 987: #ifndef WWW_MSWINDOWS
2.88 frystyk 988: #include <varargs.h>
2.90 eric 989: #endif
2.88 frystyk 990: #endif
2.26 frystyk 991:
2.88 frystyk 992: /* wait.h */
993: #ifdef HAVE_SYS_WAIT_H
994: #include <sys/wait.h>
995: #endif
996: #ifndef WEXITSTATUS
2.95 frystyk 997: #define WEXITSTATUS(stat_val) (((unsigned)(stat_val) >> 8) & 255)
2.88 frystyk 998: #endif
999: #ifndef WIFEXITED
1000: #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
1001: #endif
2.118 ! frystyk 1002:
! 1003: #ifdef HT_POSIX_REGEX
! 1004: #ifdef HAVE_RXPOSIX_H
! 1005: #include <rxposix.h>
! 1006: #else
! 1007: #ifdef HAVE_REGEX_H
! 1008: #include <regex.h>
! 1009: #endif
! 1010: #endif
! 1011: #define W3C_DEFAULT_REGEX_FLAGS (REG_EXTENDED | REG_NEWLINE)
! 1012: #endif
2.92 eric 1013: </PRE>
2.95 frystyk 1014: <H2>
1015: Booleans
1016: </H2>
2.92 eric 1017: <PRE>
2.111 frystyk 1018: #ifndef BOOLEAN
2.92 eric 1019: typedef char BOOLEAN; /* Logical value */
1020: #endif
1021:
1022: #ifndef CURSES
1023: #ifndef TRUE
1024: #define TRUE (BOOLEAN)1
1025: #define FALSE (BOOLEAN)0
1026: #endif
1027: #endif /* CURSES */
1028:
2.118 ! frystyk 1029: #if !defined(BOOL) && !defined(WWW_MSWINDOWS)
2.92 eric 1030: #define BOOL BOOLEAN
1031: #endif
1032:
1033: #ifndef YES
1034: #define YES (BOOL)1
1035: #define NO (BOOL)0
1036: #endif
1037: </PRE>
2.95 frystyk 1038: <H2>
2.112 frystyk 1039: Integers
1040: </H2>
2.118 ! frystyk 1041: <P>
! 1042: If we don't have these (for some mysterious reason) then define them. This
! 1043: should (is?) be handled by the configure script already.
2.112 frystyk 1044: <PRE>
1045: #ifndef u_short
1046: #define u_short unsigned short
1047: #endif
1048:
1049: #ifndef u_long
1050: #define u_long unsigned long
1051: #endif
1052: </PRE>
1053: <H2>
2.95 frystyk 1054: NULL Definition
1055: </H2>
2.92 eric 1056: <PRE>
1057: #ifndef NULL
1058: #define NULL ((void *)0)
1059: #endif
2.95 frystyk 1060: </PRE>
1061: <H2>
1062: Sleep System Call
1063: </H2>
1064: <P>
2.39 frystyk 1065: Some systems use milliseconds instead of seconds
1066: <PRE>
1067: #ifndef SLEEP
1068: #define SLEEP(n) sleep(n)
1069: #endif
1070: </PRE>
2.95 frystyk 1071: <H2>
1072: SOCKS
1073: </H2>
1074: <P>
1075: SOCKS is a package for allowing socket connections to tunnel through firewalls
1076: in carefully controlled situations. This package can be optionally compiled
1077: with SOCKS support; these definitions replace the normal socket calls with
1078: the SOCKS ones. Initial modification of the library is credited to Ian Dunkin
1079: <imd1707@ggr.co.uk>.
2.37 frystyk 1080: <PRE>
2.88 frystyk 1081: #ifdef SOCKS
2.101 frystyk 1082: #ifdef SOCKS4
1083: #define connect Rconnect
1084: #define getsockname Rgetsockname
1085: #define getpeername Rgetpeername
1086: #define bind Rbind
1087: #define accept Raccept
1088: #define listen Rlisten
1089: #define select Rselect
1090: #define recvfrom Rrecvfrom
1091: #define sendto Rsendto
1092: #define recv Rrecv
1093: #define send Rsend
1094: #define read Rread
1095: #define write Rwrite
1096: #define rresvport Rrresvport
1097: #define shutdown Rshutdown
1098: #define listen Rlisten
1099: #define close Rclose
1100: #define dup Rdup
1101: #define dup2 Rdup2
1102: #define fclose Rfclose
1103: #define gethostbyname Rgethostbyname
1104: #else
1105: #ifdef SOCKS5
1106: #define connect SOCKSconnect
1107: #define getsockname SOCKSgetsockname
1108: #define getpeername SOCKSgetpeername
1109: #define bind SOCKSbind
1110: #define accept SOCKSaccept
1111: #define listen SOCKSlisten
1112: #define select SOCKSselect
1113: #define recvfrom SOCKSrecvfrom
1114: #define sendto SOCKSsendto
1115: #define recv SOCKSrecv
1116: #define send SOCKSsend
1117: #define read SOCKSread
1118: #define write SOCKSwrite
1119: #define rresvport SOCKSrresvport
1120: #define shutdown SOCKSshutdown
1121: #define listen SOCKSlisten
1122: #define close SOCKSclose
1123: #define dup SOCKSdup
1124: #define dup2 SOCKSdup2
1125: #define fclose SOCKSfclose
1126: #define gethostbyname SOCKSgethostbyname
1127: #endif /* SOCKS5 */
1128: #endif /* SOCKS4 */
1129: #endif /* SOCKS */
2.37 frystyk 1130: </PRE>
2.95 frystyk 1131: <H2>
1132: Network Family
1133: </H2>
2.37 frystyk 1134: <PRE>
1135: #ifdef DECNET
1136: typedef struct sockaddr_dn SockA; /* See netdnet/dn.h or custom vms.h */
1137: #else /* Internet */
1138: typedef struct sockaddr_in SockA; /* See netinet/in.h */
1139: #endif
1140: </PRE>
2.95 frystyk 1141: <H2>
1142: Default Values of Network Access
1143: </H2>
2.37 frystyk 1144: <PRE>
1145: #ifndef NETCLOSE
1146: #define NETCLOSE close /* Routine to close a TCP-IP socket */
1147: #endif
1148:
1149: #ifndef NETREAD
1150: #define NETREAD read /* Routine to read from a TCP-IP socket */
1151: #endif
1152:
1153: #ifndef NETWRITE
1154: #define NETWRITE write /* Routine to write to a TCP-IP socket */
1155: #endif
2.101 frystyk 1156:
1157: #ifndef NETWRITEV
1158: #define NETWRITEV writev
1159: #endif
2.37 frystyk 1160: </PRE>
2.95 frystyk 1161: <H2>
1162: Definition of errno and Return Code
1163: </H2>
1164: <P>
1165: This is the definition of error codes and the corresponding string constants.
1166: If we do not have the <CODE>strerror</CODE> function then try the error list
1167: table.
2.37 frystyk 1168: <PRE>
1169: #ifndef ERRNO_DONE
1170: extern int errno;
1171: #define socerrno errno
1172: #endif
2.41 frystyk 1173:
1174: #ifndef HAVE_STRERROR /* Otherwise use the table */
1175: extern char *sys_errlist[];
1176: extern int sys_nerr;
1177: #endif
2.37 frystyk 1178: </PRE>
2.95 frystyk 1179: <H2>
1180: Definition of Socket Desrciptores
1181: </H2>
1182: <P>
2.37 frystyk 1183: This is necessary in order to support Windows NT...
1184: <PRE>
2.79 frystyk 1185: #ifndef SOCKET
1186: #define SOCKET int /* Unix like socket descriptor */
1187: #define INVSOC (-1) /* Unix invalid socket */
2.37 frystyk 1188: #endif
2.79 frystyk 1189:
1190: #ifdef __svr4__
1191: #define HT_BACKLOG 32 /* Number of pending connect requests (TCP) */
1192: #else
1193: #define HT_BACKLOG 5 /* Number of pending connect requests (TCP) */
1194: #endif /* __svr4__ */
2.26 frystyk 1195: </PRE>
2.95 frystyk 1196: <H2>
1197: Additional Network variables for SOCKET, file access bits
1198: </H2>
2.59 frystyk 1199: <PRE>
2.101 frystyk 1200: #if 0
2.66 frystyk 1201: #ifndef _WINSOCKAPI_
2.59 frystyk 1202: #define FD_READ 0x01
1203: #define FD_WRITE 0x02
1204: #define FD_OOB 0x04
1205: #define FD_ACCEPT 0x08
1206: #define FD_CONNECT 0x10
1207: #define FD_CLOSE 0x20
1208: #endif /* _WINSOCKAPI_ */
2.101 frystyk 1209: #endif
2.59 frystyk 1210: </PRE>
2.95 frystyk 1211: <H2>
1212: Rough estimate of max path length
1213: </H2>
2.26 frystyk 1214: <PRE>
1215: #ifndef HT_MAX_PATH
1216: #ifdef MAXPATHLEN
1217: #define HT_MAX_PATH MAXPATHLEN
1218: #else
1219: #ifdef PATH_MAX
1220: #define HT_MAX_PATH PATH_MAX
1221: #else
1222: #define HT_MAX_PATH 1024 /* Any better ideas? */
1223: #endif
1224: #endif
1225: #endif /* HT_MAX_PATH */
2.99 frystyk 1226:
1227: #ifndef HT_MAX_TMPNAM
1228: #ifdef L_tmpnam
1229: #define HT_MAX_TMPNAM L_tmpnam
1230: #else
1231: #define HT_MAX_TMPNAM 128
1232: #endif
1233: #endif
2.26 frystyk 1234: </PRE>
2.95 frystyk 1235: <H2>
1236: Definition of NGROUPS
1237: </H2>
2.26 frystyk 1238: <PRE>
2.94 frystyk 1239: #ifdef GETGROUPS_T
2.26 frystyk 1240: #ifndef NGROUPS
1241: #ifdef NGROUPS_MAX
2.94 frystyk 1242: #define NGROUPS NGROUPS_MAX
2.26 frystyk 1243: #else
2.94 frystyk 1244: #define NGROUPS 20 /* Any better ideas? */
2.26 frystyk 1245: #endif
2.37 frystyk 1246: #endif
2.34 frystyk 1247: #endif
1248: </PRE>
2.95 frystyk 1249: <H2>
1250: Definition of Max Domain Name Length
1251: </H2>
2.29 frystyk 1252: <PRE>
1253: #ifndef MAXHOSTNAMELEN
1254: #define MAXHOSTNAMELEN 64 /* Any better ideas? */
1255: #endif
1256: </PRE>
2.95 frystyk 1257: <H2>
1258: File/Directory Management
1259: </H2>
2.41 frystyk 1260: <PRE>
1261: #ifndef MKDIR
1262: #define MKDIR(a,b) mkdir((a), (b))
1263: #endif
1264:
2.56 frystyk 1265: #ifndef RMDIR
1266: #define RMDIR(a) rmdir((a))
1267: #endif
1268:
1269: #ifndef REMOVE
1270: #define REMOVE(a) unlink((a))
2.47 frystyk 1271: #endif
1272:
1273: #ifndef DEFAULT_SUFFIXES
1274: #define DEFAULT_SUFFIXES ".,_"
2.41 frystyk 1275: #endif
2.100 frystyk 1276:
1277: #ifndef F_OK
1278: #define R_OK 4
1279: #define W_OK 2
1280: #define X_OK 1
1281: #define F_OK 0
1282: #endif
2.41 frystyk 1283: </PRE>
2.95 frystyk 1284: <H2>
1285: Macros for manipulating masks for select()
1286: </H2>
2.26 frystyk 1287: <PRE>
2.1 timbl 1288: #ifndef FD_SET
2.88 frystyk 1289: #define FD_SET(fd, m) (*(unsigned*)(m) |= (1 << (fd)))
1290: #endif
1291:
1292: #ifndef FD_CLR
1293: #define FD_CLR(fd, m) (*(unsigned*)(m) &= ~(1 << (fd)))
1294: #endif
1295:
1296: #ifndef FD_ZERO
1297: #define FD_ZERO(m) (*(unsigned*)(m)) = 0
1298: #endif
1299:
1300: #ifndef FD_ISSET
1301: #define FD_ISSET(fd, m) (*(unsigned*)(m) & (1 << (fd)))
1302: #endif
2.26 frystyk 1303: </PRE>
2.95 frystyk 1304: <H2>
1305: Macros for converting characters
1306: </H2>
2.26 frystyk 1307: <PRE>
1308: #ifndef TOASCII
2.1 timbl 1309: #define TOASCII(c) (c)
1310: #define FROMASCII(c) (c)
2.5 timbl 1311: #endif
2.26 frystyk 1312: </PRE>
2.95 frystyk 1313: <H2>
1314: Cache file prefix
1315: </H2>
1316: <P>
2.26 frystyk 1317: This is something onto which we tag something meaningful to make a cache
2.95 frystyk 1318: file name. used in HTWSRC.c at least. If it is not defined at all, caching
2.5 timbl 1319: is turned off.
2.26 frystyk 1320: <PRE>
1321: #ifndef CACHE_FILE_PREFIX
2.88 frystyk 1322: #ifdef unix
2.6 timbl 1323: #define CACHE_FILE_PREFIX "/usr/wsrc/"
2.5 timbl 1324: #endif
2.60 frystyk 1325: #endif
1326: </PRE>
2.95 frystyk 1327: <H2>
1328: Thread Safe Setup
1329: </H2>
1330: <P>
1331: These are some constants setting the size of buffers used by thread safe
1332: versions of some system calls.
2.60 frystyk 1333: <PRE>
1334: #ifdef HT_REENTRANT
1335: #define HOSTENT_MAX 128
1336: #define CTIME_MAX 26
2.101 frystyk 1337: #endif /* HT_REENTRANT */
2.17 luotonen 1338: </PRE>
2.102 frystyk 1339: <H2>
1340: Types
1341: </H2>
1342: <P>
1343: We define some types here so we son't have to worry about it later
1344: <PRE>
1345: typedef unsigned long ms_t;
1346: </PRE>
2.17 luotonen 1347: <PRE>
1348: #endif
1349: </PRE>
2.95 frystyk 1350: <P>
1351: <HR>
2.94 frystyk 1352: <ADDRESS>
2.118 ! frystyk 1353: @(#) $Id: wwwsys.html,v 2.117 1998/07/17 17:01:01 frystyk Exp $
2.94 frystyk 1354: </ADDRESS>
2.95 frystyk 1355: </BODY></HTML>
Webmaster