#include #include /* do we really need all these?? */ static int idx; static const unsigned char protos[] = { "000円ip0円" "001円icmp0円" "002円igmp0円" "003円ggp0円" "004円ipencap0円" "005円st0円" "006円tcp0円" "010円egp0円" "014円pup0円" "021円udp0円" "024円hmp0円" "026円xns-idp0円" "033円rdp0円" "035円iso-tp40円" "044円xtp0円" "045円ddp0円" "046円idpr-cmtp0円" "051円ipv60円" "053円ipv6-route0円" "054円ipv6-frag0円" "055円idrp0円" "056円rsvp0円" "057円gre0円" "062円esp0円" "063円ah0円" "071円skip0円" "072円ipv6-icmp0円" "073円ipv6-nonxt0円" "074円ipv6-opts0円" "111円rspf0円" "121円vmtp0円" "131円ospf0円" "136円ipip0円" "142円encap0円" "147円pim0円" "377円raw" }; void endprotoent(void) { idx = 0; } void setprotoent(int stayopen) { idx = 0; } struct protoent *getprotoent(void) { static struct protoent p; static const char *aliases; if (idx>= sizeof protos) return NULL; p.p_proto = protos[idx]; p.p_name = (char *)&protos[idx+1]; p.p_aliases = (char **)&aliases; idx += strlen(p.p_name) + 2; return &p; } struct protoent *getprotobyname(const char *name) { struct protoent *p; endprotoent(); do p = getprotoent(); while (p && strcmp(name, p->p_name)); return p; } struct protoent *getprotobynumber(int num) { struct protoent *p; endprotoent(); do p = getprotoent(); while (p && p->p_proto != num); return p; }

AltStyle によって変換されたページ (->オリジナル) /