Annotation of researchv10no/cmd/spitbol/cint/gethost.c, revision 1.1

1.1     ! root        1: 
        !             2: 
        !             3: /*
        !             4:        gethost( scptr ) reads the host file and returns its first
        !             5:        line in the scblk.
        !             6: */
        !             7: 
        !             8: #include "spitblks.h"
        !             9: 
        !            10: gethost( scptr,maxlen )
        !            11: 
        !            12: struct scblk   *scptr;
        !            13: int    maxlen;
        !            14: 
        !            15: {
        !            16:        int     cnt = 0, fd, j;
        !            17: 
        !            18:        if ( (fd = open( "/usr/lib/spithost",0 )) >= 0 ) {
        !            19:                cnt     = read( fd,scptr -> str,maxlen );
        !            20:                close( fd );
        !            21:        }
        !            22: 
        !            23:         if (( cnt > 0 ) && ( scptr -> str[cnt - 1] == '\n' ))
        !            24:                --cnt;
        !            25:        scptr -> len = cnt;
        !            26: 
        !            27: }
        !            28: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.