|
|
1.1 root 1:
2: /*
3: gethost( scptr ) reads the host file and returns its first
4: line in the scblk.
5: */
6:
7: #include "spitblks.h"
8:
9: gethost( scptr,maxlen )
10:
11: struct scblk *scptr;
12: int maxlen;
13:
14: {
15: int cnt = 0, fd, j;
16:
17: if ( (fd = open( "/usr/lib/spithost",0 )) >= 0 ) {
18: cnt = read( fd,scptr -> str,maxlen );
19: close( fd );
20: }
21:
22: if (( cnt > 0 ) && ( scptr -> str[cnt - 1] == '\n' ))
23: --cnt;
24: scptr -> len = cnt;
25:
26: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.