#include "nist.h"

void init_sockaddr (struct sockaddr_in *name,
     char const *hostname, unsigned short int port)
{
    struct hostent
        *hostinfo;

    name->sin_family = AF_INET;
    name->sin_port = htons(port);
    
    if (!(hostinfo = gethostbyname(hostname)))
        error("Unknown host %s.\n", hostname);

    name->sin_addr = *(struct in_addr *) hostinfo->h_addr;
}

