/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that gets the ftp/tcp port number. */
#include <stdlib.h>
#include <netdb.h>

int main() {
    struct servent result;
    char buffer[128];
    
    getservbyname_r("ftp","tcp",&result,buffer, sizeof(buffer));
    printf("%s\n",result.s_name);  /* service name */
    printf("%d\n",result.s_port);  /* port number */
}
