Annotation of 42BSD/lib/libc/inet/inet_netof.c, revision 1.1

1.1     ! root        1: /*     inet_netof.c    4.3     82/11/14        */
        !             2: 
        !             3: #include <sys/types.h>
        !             4: #include <netinet/in.h>
        !             5: 
        !             6: /*
        !             7:  * Return the network number from an internet
        !             8:  * address; handles class a/b/c network #'s.
        !             9:  */
        !            10: inet_netof(in)
        !            11:        struct in_addr in;
        !            12: {
        !            13:        register u_long i = ntohl(in.s_addr);
        !            14: 
        !            15:        if (IN_CLASSA(i))
        !            16:                return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
        !            17:        else if (IN_CLASSB(i))
        !            18:                return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT);
        !            19:        else
        !            20:                return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT);
        !            21: }

unix.superglobalmegacorp.com

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