Annotation of 42BSD/lib/libc/net/getservbyname.c, revision 1.1

1.1     ! root        1: /*     getservbyname.c 4.2     82/10/05        */
        !             2: 
        !             3: #include <netdb.h>
        !             4: 
        !             5: struct servent *
        !             6: getservbyname(name, proto)
        !             7:        char *name, *proto;
        !             8: {
        !             9:        register struct servent *p;
        !            10:        register char **cp;
        !            11: 
        !            12:        setservent(0);
        !            13:        while (p = getservent()) {
        !            14:                if (strcmp(name, p->s_name) == 0)
        !            15:                        goto gotname;
        !            16:                for (cp = p->s_aliases; *cp; cp++)
        !            17:                        if (strcmp(name, *cp) == 0)
        !            18:                                goto gotname;
        !            19:                continue;
        !            20: gotname:
        !            21:                if (proto == 0 || strcmp(p->s_proto, proto) == 0)
        !            22:                        break;
        !            23:        }
        !            24:        endservent();
        !            25:        return (p);
        !            26: }

unix.superglobalmegacorp.com

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