/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that prints the names  of  all  the
   services and their port number. */
#include <stdio.h>
#include <netdb.h>

int main() {
    struct servent *sp;

    setservent(0);
    while ( (sp = getservent()) != NULL ) {
        printf("Service:%s", sp->s_name);
        printf("  Port:%d\n",sp->s_port);
    }    
    endservent();
}
