|
|
1.1 ! root 1: #include <ctype.h> ! 2: #include <sys/inet/in.h> ! 3: ! 4: /* Get the next token in a string, returning a pointer the the byte ! 5: * following the token. ! 6: */ ! 7: char * ! 8: in_getw(buf, w) ! 9: char *buf, *w; ! 10: { ! 11: *w = 0; ! 12: while(isspace(*buf)) buf++; ! 13: if(*buf == '\0') ! 14: return(0); ! 15: while(!isspace(*buf) && *buf) ! 16: *w++ = *buf++; ! 17: *w = 0; ! 18: return(buf); ! 19: } ! 20: ! 21: /* get the network that a host is on */ ! 22: in_addr ! 23: in_netof(x) ! 24: in_addr x; ! 25: { ! 26: if(IN_CLASSC(x)) ! 27: return(x&IN_CLASSC_NET); ! 28: else if(IN_CLASSB(x)) ! 29: return(x&IN_CLASSB_NET); ! 30: else ! 31: return(x&IN_CLASSA_NET); ! 32: } ! 33:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.