/* 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 netent result;
    char * name = "arpanet";
    char buffer[128];  

    getnetbyname_r(name,&result,buffer,128);
    printf("%s\n",result.n_name); /* net name */
    printf("%d\n",result.n_net);  /* net number */
    printf("%s\n",result.n_aliases[0]); /* net aliases */
    printf("%d\n",result.n_addrtype); /* the type of network number */
}
