/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that prints the name of host. */
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>

int main() {
    struct protoent result;
    char * name = "udp";
    char buffer[128];

    getprotobyname_r(name,&result,buffer,128);
    printf("%s\n",result.p_name); /* protocol name */
    printf("%d\n",result.p_proto);  /*protocol number */
    printf("%s\n",result.p_aliases[0]); /*protocol aliases */
}
