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

2.2       timbl       1: <HEADER>
                      2: <TITLE>System dependencies in the W3 library</TITLE>
                      3: <NEXTID N="4">
                      4: </HEADER>
                      5: <BODY>
                      6: <H1>System Dependencies</H1>System-system differences for TCP
                      7: include files and macros. This file
                      8: includes for each system the files
                      9: necessary for network and file I/O.
                     10: <H3>Authors</H3>
                     11: <DL>
                     12: <DT>TBL
                     13: <DD> Tim Berners-Lee, W3 project,
                     14: CERN, &lt;timbl@info.cern.ch>
                     15: <DT>EvA
                     16: <DD> Eelco van Asperen &lt;evas@cs.few.eur.nl>
                     17: <DT>MA
                     18: <DD> Marc Andreesen NCSA
                     19: <DT>AT
2.4       timbl      20: <DD> Aleksandar Totic &lt;atotic@ncsa.uiuc.edu>
                     21: <DT>SCW
2.5     ! timbl      22: <DD> Susan C. Weber &lt;sweber@kyle.eitech.com>
2.2       timbl      23: </DL>
                     24: 
                     25: <H3>History:</H3>
                     26: <DL>
                     27: <DT>22 Feb 91
                     28: <DD> Written (TBL) as part of
                     29: the WWW library.
                     30: <DT>16 Jan 92
                     31: <DD> PC code from EvA
                     32: <DT>22 Apr 93
                     33: <DD> Merged diffs bits from
                     34: xmosaic release
2.4       timbl      35: <DT>29 Apr 93
2.5     ! timbl      36: <DD> NT code from SCW
2.2       timbl      37: </DL>
                     38: 
2.1       timbl      39: <PRE>
                     40: #ifndef TCP_H
                     41: #define TCP_H
                     42: 
2.2       timbl      43: </PRE>
                     44: <H2>Default values</H2>These values may be reset and altered
                     45: by system-specific sections later
                     46: on.  there are also a bunch of <A
                     47: NAME=z2 HREF="#z1">defaults
2.3       timbl      48: at the end</A> .
2.2       timbl      49: <PRE>/* Default values of those: */
2.1       timbl      50: #define NETCLOSE close     /* Routine to close a TCP-IP socket         */
                     51: #define NETREAD  read      /* Routine to read from a TCP-IP socket     */
                     52: #define NETWRITE write     /* Routine to write to a TCP-IP socket      */
                     53: 
                     54: /* Unless stated otherwise, */
2.2       timbl      55: #define SELECT                 /* Can handle >1 channel.               */
2.1       timbl      56: #define GOT_SYSTEM             /* Can call shell with string           */
                     57: 
                     58: #ifdef unix
                     59: #define GOT_PIPE
                     60: #endif
                     61: #ifdef VM
                     62: #define GOT_PIPE               /* Of sorts */
                     63: #endif
                     64: 
                     65: #ifdef DECNET
                     66: typedef struct sockaddr_dn SockA;  /* See netdnet/dn.h or custom vms.h */
                     67: #else /* Internet */
                     68: typedef struct sockaddr_in SockA;  /* See netinet/in.h */
                     69: #endif
                     70: 
                     71: 
2.2       timbl      72: </PRE>
                     73: <H2>Macintosh - Think-C</H2>Think-C is one development environment
                     74: on the Mac.<P>
                     75: We recommend that you compile with
                     76: 4-byte ints to be compatible with
                     77: MPW C.  We used Tom Milligan's s_socket
                     78: library which was written for 4 byte
                     79: int, and the MacTCP library assumes
                     80: 4-byte int.
                     81: <PRE>#ifdef THINK_C
2.1       timbl      82: #undef GOT_SYSTEM
                     83: #define DEBUG                  /* Can't put it on the CC command line  */
                     84: #define NO_UNIX_IO             /* getuid() missing                     */
                     85: #define NO_GETPID              /* getpid() does not exist              */
                     86: #define NO_GETWD               /* getwd() does not exist               */
                     87: 
                     88: #undef NETCLOSE                    /* Routine to close a TCP-IP socket         */
                     89: #undef NETREAD             /* Routine to read from a TCP-IP socket     */
                     90: #undef NETWRITE            /* Routine to write to a TCP-IP socket      */
                     91: #define NETCLOSE s_close    /* Routine to close a TCP-IP socket                */
                     92: #define NETREAD  s_read            /* Routine to read from a TCP-IP socket     */
                     93: #define NETWRITE s_write    /* Routine to write to a TCP-IP socket     */
                     94: 
                     95: #define bind s_bind        /* Funny names presumably to prevent clashes */
                     96: #define connect s_connect
                     97: #define accept s_accept
                     98: #define listen s_listen
                     99: #define socket s_socket
                    100: #define getsockname s_getsockname
                    101: 
                    102: /* The function prototype checking is better than the include files
                    103: */
                    104: 
                    105: extern s_close(int s);
                    106: extern s_read(int s, char *buffer, int buflen);
                    107: extern s_write(int s, const char *buffer, int buflen);
                    108: 
                    109: extern bind(int s, struct sockaddr *name, int namelen);
                    110: extern accept(int s, struct sockaddr *addr, int *addrlen);
                    111: extern listen(int s, int qlen);
                    112: extern connect(int s, struct sockaddr *addr, int addrlen);
                    113: 
                    114: extern s_socket(int domain, int type, int protocol);
                    115: extern s_getsockname(int s, struct sockaddr *name, int *namelen);
                    116: extern struct hostent *gethostent(const char * name);
                    117: extern unsigned long inet_addr(const char * name);
                    118: 
                    119: #endif /* THINK_C */
                    120: 
                    121: 
2.2       timbl     122: </PRE>
                    123: <H2>Macintosh - MPW</H2>MPW is one development environment
                    124: on the Mac.<P>
                    125: This entry was created by Aleksandar
                    126: Totic (atotic@ncsa.uiuc.edu) this
                    127: file is compatible with sockets package
                    128: released by NCSA.  One major conflict
                    129: is that this library redefines write/read/etc
                    130: as macros.  In some of HTML code
                    131: these macros get executed when they
                    132: should not be. Such files should
                    133: define NO_SOCKET_DEFS on top. This
                    134: is a temporary hack.
                    135: <PRE>#ifdef applec                     /* MPW  */
                    136: #undef GOT_SYSTEM
                    137: #define DEBUG                  /* Can't put it on the CC command line */
                    138: #define NO_UNIX_IO             /* getuid() missing
                    139: */
                    140: #define NO_GETPID              /* getpid() does not exist
                    141: */
                    142: #define NO_GETWD               /* getwd() does not exist
                    143: */
                    144: 
                    145: #undef NETCLOSE                    /* Routine to close a TCP-IP socket */
                    146: #undef NETREAD             /* Routine to read from a TCP-IP socket */
                    147: #undef NETWRITE            /* Routine to write to a TCP-IP socket */
                    148: #define NETCLOSE s_close    /* Routine to close a TCP-IP socket */
                    149: #define NETREAD  s_read            /* Routine to read from a TCP-IP socket */
                    150: #define NETWRITE s_write    /* Routine to write to a TCP-IP socket */
                    151: #define _ANSI_SOURCE
                    152: #define GUI
                    153: #define LINEFEED 10
                    154: #define ANON_FTP_HOSTNAME
                    155: #ifndef NO_SOCKET_DEFS
                    156: #include &lt;MacSockDefs.h>
                    157: #endif
                    158: 
                    159: #include &lt;socket.ext.h>
                    160: #include &lt;string.h>
                    161: 
                    162: #endif                 /* MPW */
                    163: 
                    164: 
                    165: 
2.1       timbl     166: #ifndef STDIO_H
2.2       timbl     167: #include &lt;stdio.h>
2.1       timbl     168: #define STDIO_H
                    169: #endif
                    170: 
2.2       timbl     171: </PRE>
                    172: <H2>IBM RS600</H2>
                    173: <PRE>/*        On the IBM RS-6000, AIX is almost Unix.
2.1       timbl     174: **     But AIX must be defined in the makefile.
                    175: */
2.2       timbl     176: #ifdef _AIX
                    177: #define AIX
                    178: #endif
2.1       timbl     179: #ifdef AIX
                    180: #define unix
                    181: #endif
                    182: 
2.2       timbl     183: /*    AIX 3.2
                    184: **    -------
                    185: */
                    186: 
                    187: #ifdef _IBMR2
                    188: #define USE_DIRENT
                    189: #endif
                    190: 
                    191: 
                    192: </PRE>
2.4       timbl     193: <H2>IBM VM-CMS, VM-XA Mainframes</H2>MVS is compiled as for VM. MVS has
                    194: no unix-style I/O.  The command line
                    195: compile options seem to come across
                    196: in lower case.
                    197: <PRE>#ifdef mvs
2.1       timbl     198: #define MVS
                    199: #endif
                    200: 
                    201: #ifdef MVS
                    202: #define VM
                    203: #endif
                    204: 
                    205: #ifdef NEWLIB
                    206: #pragma linkage(newlib,OS)     /* Enables recursive NEWLIB */
                    207: #endif
                    208: 
                    209: /*     VM doesn't have a built-in predefined token, so we cheat: */
                    210: #ifndef VM
2.2       timbl     211: #include &lt;string.h>         /* For bzero etc - not  VM */
                    212: #endif
                    213: 
                    214: /*     Note:   All include file names must have 8 chars max (+".h")
                    215: **
                    216: **     Under VM, compile with "(DEF=VM,SHORT_NAMES,DEBUG)"
                    217: **
                    218: **     Under MVS, compile with "NOMAR DEF(MVS)" to get rid of 72 char margin
                    219: **       System include files TCPIP and COMMMAC neeed line number removal(!)
                    220: */
                    221: 
                    222: #ifdef VM                      /* or MVS -- see above. */
                    223: #define NOT_ASCII              /* char type is not ASCII */
                    224: #define NO_UNIX_IO             /* Unix I/O routines are not supported */
                    225: #define NO_GETPID              /* getpid() does not exist */
                    226: #define NO_GETWD               /* getwd() does not exist */
                    227: #ifndef SHORT_NAMES
                    228: #define SHORT_NAMES            /* 8 character uniqueness for globals */
                    229: #endif
                    230: #include &lt;manifest.h>                                                           
                    231: #include &lt;bsdtypes.h>                                                           
                    232: #include &lt;stdefs.h>                                                             
                    233: #include &lt;socket.h>                                                             
                    234: #include &lt;in.h>
                    235: #include &lt;inet.h>
                    236: #include &lt;netdb.h>                                                                 
                    237: #include &lt;errno.h>      /* independent */
                    238: extern char asciitoebcdic[], ebcdictoascii[];
                    239: #define TOASCII(c)   (c=='\n' ?  10  : ebcdictoascii[c])
                    240: #define FROMASCII(c) (c== 10  ? '\n' : asciitoebcdic[c])                                   
                    241: #include &lt;bsdtime.h>
                    242: #include &lt;time.h>
                    243: #include &lt;string.h>                                                            
                    244: #define INCLUDES_DONE
                    245: #define TCP_INCLUDES_DONE
2.1       timbl     246: #endif
                    247: 
                    248: 
2.2       timbl     249: </PRE>
                    250: <H2>IBM-PC running MS-DOS with SunNFS
                    251: for TCP/IP</H2>This code thanks to Eelco van Asperen
2.3       timbl     252: &lt;evas@cs.few.eur.nl>
                    253: <PRE>#ifdef PCNFS
                    254: #include &lt;sys/types.h>
2.2       timbl     255: #include &lt;string.h>
                    256: #include &lt;errno.h>      /* independent */
                    257: #include &lt;sys/time.h>           /* independent */
                    258: #include &lt;sys/stat.h>
                    259: #include &lt;fcntl.h>      /* In place of sys/param and sys/file */
                    260: #define INCLUDES_DONE
                    261: #define FD_SET(fd,pmask) (*(unsigned*)(pmask)) |=  (1&lt;&lt;(fd))
                    262: #define FD_CLR(fd,pmask) (*(unsigned*)(pmask)) &amp;= ~(1&lt;&lt;(fd))
                    263: #define FD_ZERO(pmask)   (*(unsigned*)(pmask))=0
                    264: #define FD_ISSET(fd,pmask) (*(unsigned*)(pmask) &amp; (1&lt;&lt;(fd)))
                    265: #endif  /* PCNFS */
                    266: 
2.4       timbl     267: </PRE>
                    268: <H2>IBM-PC running Windows NT</H2>These parameters providede by  Susan
                    269: C. Weber &lt;sweber@kyle.eitech.com>.
                    270: <PRE>#ifdef _WINDOWS
                    271: #include "fcntl.h"                     /* For HTFile.c */
                    272: #include "sys\types.h"                 /* For HTFile.c */
                    273: #include "sys\stat.h"                  /* For HTFile.c */
                    274: 
                    275: #undef NETREAD
                    276: #undef NETWRITE
                    277: #undef NETCLOSE
                    278: #define NETREAD(s,b,l) ((s)>10 ? recv((s),(b),(l),0) : read((s),(b),(l)))
                    279: #define NETWRITE(s,b,l)        ((s)>10 ? send((s),(b),(l),0) : write((s),(b),(l)))
                    280: #define NETCLOSE(s)    ((s)>10 ? closesocket(s) : close(s))
                    281: #include &lt;io.h>
                    282: #include &lt;string.h>
                    283: #include &lt;process.h>
                    284: #include &lt;time.h>
                    285: #include &lt;direct.h>
                    286: #include &lt;stdio.h>
                    287: #include &lt;winsock.h>
                    288: typedef struct sockaddr_in SockA;  /* See netinet/in.h */
                    289: #define INCLUDES_DONE
                    290: #define TCP_INCLUDES_DONE
                    291: #endif  /* WINDOWS */
                    292:  
2.2       timbl     293: 
                    294: 
                    295: </PRE>
2.4       timbl     296: <H2>VAX/VMS</H2>Under VMS, there are many versions
                    297: of TCP-IP. Define one if you do not
                    298: use Digital's UCX product:
                    299: <DL>
                    300: <DT>UCX
2.5     ! timbl     301: <DD> DEC's "Ultrix connection" (default)
2.4       timbl     302: <DT>WIN_TCP
2.5     ! timbl     303: <DD> From Wollongong, now GEC
        !           304: software.
2.4       timbl     305: <DT>MULTINET
2.5     ! timbl     306: <DD> From SRI, now from TGV Inv.
2.4       timbl     307: <DT>DECNET
2.5     ! timbl     308: <DD> Cern's TCP socket emulation
2.4       timbl     309: over DECnet
                    310: </DL>
                    311: The last three do not interfere with
                    312: the unix i/o library, and so they
                    313: need special calls to read, write
                    314: and close sockets. In these cases
                    315: the socket number is a VMS channel
                    316: number, so we make the @@@ HORRIBLE
                    317: @@@ assumption that a channel number
                    318: will be greater than 10 but a unix
                    319: file descriptor less than 10.  It
                    320: works.
                    321: <PRE>#ifdef vms
2.5     ! timbl     322: </PRE>#define CACHE_FILE_PREFIX  "SYS$LOGIN:Z_"
        !           323: <PRE>#ifdef WIN_TCP
2.1       timbl     324: #undef NETREAD
                    325: #undef NETWRITE
                    326: #undef NETCLOSE
2.2       timbl     327: #define NETREAD(s,b,l) ((s)>10 ? netread((s),(b),(l)) : read((s),(b),(l)))
                    328: #define NETWRITE(s,b,l)        ((s)>10 ? netwrite((s),(b),(l)) : write((s),(b),(l)))
                    329: #define NETCLOSE(s)    ((s)>10 ? netclose(s) : close(s))
2.1       timbl     330: #endif
                    331: 
                    332: #ifdef MULTINET
                    333: #undef NETCLOSE
                    334: #undef NETREAD
                    335: #undef NETWRITE
2.2       timbl     336: #define NETREAD(s,b,l) ((s)>10 ? socket_read((s),(b),(l)) : read((s),(b),(l)))
                    337: #define NETWRITE(s,b,l)        ((s)>10 ? socket_write((s),(b),(l)) : \
2.1       timbl     338:                                write((s),(b),(l)))
2.2       timbl     339: #define NETCLOSE(s)    ((s)>10 ? socket_close(s) : close(s))
2.1       timbl     340: #endif
                    341: 
                    342: #ifdef DECNET
                    343: #undef SELECT  /* not supported */
                    344: #undef NETREAD
                    345: #undef NETWRITE
                    346: #undef NETCLOSE
2.2       timbl     347: #define NETREAD(s,b,l) ((s)>10 ? recv((s),(b),(l),0) : read((s),(b),(l)))
                    348: #define NETWRITE(s,b,l)        ((s)>10 ? send((s),(b),(l),0) : write((s),(b),(l)))
                    349: #define NETCLOSE(s)    ((s)>10 ? socket_close(s) : close(s))
2.1       timbl     350: #endif /* Decnet */
                    351: 
                    352: /*     Certainly this works for UCX and Multinet; not tried for Wollongong
                    353: */
                    354: #ifdef MULTINET
                    355: #include "multinet_root:[multinet.include.sys]types.h"
                    356: #include "multinet_root:[multinet.include]errno.h"
                    357: #include "multinet_root:[multinet.include.sys]time.h"
                    358: #else
                    359: #include types
                    360: #include errno
                    361: #include time
                    362: #endif /* multinet */
                    363: 
                    364: #include string
                    365: 
                    366: #ifndef STDIO_H
                    367: #include stdio
                    368: #define STDIO_H
                    369: #endif
                    370: 
                    371: #include file
                    372: 
                    373: #ifndef DECNET  /* Why is it used at all ? Types conflict with "types.h" */
                    374: #include unixio
                    375: #endif
                    376: 
                    377: #define INCLUDES_DONE
                    378: 
                    379: #ifdef MULTINET  /* Include from standard Multinet directories */
                    380: #include "multinet_root:[multinet.include.sys]socket.h"
                    381: #ifdef __TIME_LOADED  /* defined by sys$library:time.h */
                    382: #define __TIME  /* to avoid double definitions in next file */
                    383: #endif
                    384: #include "multinet_root:[multinet.include.netinet]in.h"
                    385: #include "multinet_root:[multinet.include.arpa]inet.h"
                    386: #include "multinet_root:[multinet.include]netdb.h"
                    387: 
                    388: #else  /* not multinet */
                    389: #ifdef DECNET
                    390: #include "types.h"  /* for socket.h */
                    391: #include "socket.h"
                    392: #include "dn"
                    393: #include "dnetdb"
                    394: /* #include "vms.h" */
                    395: 
                    396: #else /* UCX or WIN */
                    397: #include socket
                    398: #include in
                    399: #include inet
                    400: #include netdb
                    401: 
                    402: #endif  /* not DECNET */
                    403: #endif  /* of Multinet or other TCP includes */
                    404: 
                    405: #define TCP_INCLUDES_DONE
                    406: 
                    407: #endif /* vms */
                    408: 
                    409: 
                    410: 
2.2       timbl     411: </PRE>
                    412: <H2>SCO ODT unix version</H2>
                    413: <PRE>
                    414: #ifdef sco
                    415: #include &lt;sys/fcntl.h>
                    416: #define USE_DIRENT
2.1       timbl     417: #endif
                    418: 
2.2       timbl     419: </PRE>
                    420: <H2>MIPS unix</H2>
                    421: <PRE>/* Mips hack (bsd4.3/sysV mixture...) */
2.1       timbl     422: 
                    423: #ifdef mips
                    424: extern int errno;
                    425: #endif
                    426: 
2.2       timbl     427: 
                    428: </PRE>
                    429: <H2>Regular BSD unix versions</H2>These are a default unix where not
                    430: already defined specifically.
                    431: <PRE>#ifndef INCLUDES_DONE
                    432: #include &lt;sys/types.h>
                    433: /* #include &lt;streams/streams.h>                     not ultrix */
                    434: #include &lt;string.h>
                    435: 
                    436: #include &lt;errno.h>      /* independent */
                    437: #include &lt;sys/time.h>           /* independent */
                    438: #include &lt;sys/stat.h>
                    439: #include &lt;sys/param.h>
                    440: #include &lt;sys/file.h>           /* For open() etc */
2.1       timbl     441: #define INCLUDES_DONE
                    442: #endif /* Normal includes */
                    443: 
2.2       timbl     444: /*                     Directory reading stuff - BSD or SYS V
                    445: */
2.1       timbl     446: #ifdef unix                    /* if this is to compile on a UNIX machine */
                    447: #define GOT_READ_DIR 1    /* if directory reading functions are available */
2.2       timbl     448: #ifdef USE_DIRENT             /* sys v version */
                    449: #include &lt;dirent.h>
                    450: #define direct dirent
                    451: #else
                    452: #include &lt;sys/dir.h>
2.1       timbl     453: #endif
2.2       timbl     454: #if defined(sun) &amp;&amp; defined(__svr4__)
                    455: #include &lt;sys/fcntl.h>
                    456: #include &lt;limits.h>
                    457: #endif
                    458: #endif
2.1       timbl     459: 
2.2       timbl     460: </PRE>
                    461: <H2><A
                    462: NAME=z1>Defaults</A></H2>
                    463: <H3>Include files for TCP</H3>
                    464: <PRE>#ifndef TCP_INCLUDES_DONE
                    465: #include &lt;sys/socket.h>
                    466: #include &lt;netinet/in.h>
                    467: #ifndef __hpux /* this may or may not be good -marc */
                    468: #include &lt;arpa/inet.h>          /* Must be after netinet/in.h */
                    469: #endif
                    470: #include &lt;netdb.h>
2.1       timbl     471: #endif /* TCP includes */
                    472: 
                    473: 
2.2       timbl     474: </PRE>
                    475: <H3>Macros for manipulating masks for
                    476: select()</H3>
                    477: <PRE>#ifdef SELECT
2.1       timbl     478: #ifndef FD_SET
                    479: typedef unsigned int fd_set;
2.2       timbl     480: #define FD_SET(fd,pmask) (*(pmask)) |=  (1&lt;&lt;(fd))
                    481: #define FD_CLR(fd,pmask) (*(pmask)) &amp;= ~(1&lt;&lt;(fd))
2.1       timbl     482: #define FD_ZERO(pmask)   (*(pmask))=0
2.2       timbl     483: #define FD_ISSET(fd,pmask) (*(pmask) &amp; (1&lt;&lt;(fd)))
2.1       timbl     484: #endif  /* FD_SET */
                    485: #endif  /* SELECT */
                    486: 
2.2       timbl     487: </PRE>
                    488: <H3><A
2.4       timbl     489: NAME=z0>M</A>acros for converting characters</H3>
2.2       timbl     490: <PRE>#ifndef TOASCII
2.1       timbl     491: #define TOASCII(c) (c)
                    492: #define FROMASCII(c) (c)                                   
2.5     ! timbl     493: #endif
        !           494: 
        !           495: </PRE>
        !           496: <H3>Cache file prefix</H3>This is something onto which we tag
        !           497: something meaningful to make a cache
        !           498: file name.  used in HTWSRC.c at least.
        !           499:   If it is nor defined at all, caching
        !           500: is turned off.
        !           501: <PRE>#ifndef CACHE_FILE_PREFIX
        !           502: #ifdef unix
        !           503: #define CACHE_FILE_PREFIX  "/tmp/."
        !           504: #endif
2.1       timbl     505: #endif
                    506: 
2.2       timbl     507: #endif /* TCP_H */
                    508: 
                    509: 
2.1       timbl     510: 
2.3       timbl     511: </PRE>end of system-specific file</BODY>

Webmaster