/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that excerpt counts the number of service entries. */
#include <stdio.h>
#include <netdb.h>

int main() {
    int count = 0;
    struct servent servbuf;
    struct servent_data sdbuf;

    sdbuf.serv_fp = NULL;
    setservent_r(0, &sdbuf);
    while (getservent_r(&servbuf, &sdbuf) != -1)
          count++;
    printf(" the number of service entries is %d\n",count);          
    endservent_r(&sdbuf);
}


           
