Annotation of libwww/Library/src/wwwsys.html, revision 2.97

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

Webmaster