From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,915c5f32c3cf36f7,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1992-05-19 02:24:08 PST Path: sparky!uunet!olivea!samsung!viewlog.viewlogic.com!bill From: bill@concept.viewlogic.com (Bill Crooke) Newsgroups: comp.sys.dec Subject: Problem with getservbyname () and NIS. Message-ID: <1992May19.142247.1955@viewlogic.com> Date: 19 May 92 14:22:47 GMT Sender: bill@concept (Bill Crooke) Followup-To: bcrooke@viewlogic.com Organization: Viewlogic Systems, Inc. Originator: bill@concept Nntp-Posting-Host: concept Hi, I am having a problem with getservbyname () on a DECstation 3100 running Ultrix 4.1. I have edited /etc/svc.conf to include the line "services=local,yp". When I run "ypcat services | grep vnsd I get the following string vnsd 2713/tcp vnsd Yet when I run the program below the error message "error: service not in /etc/services" is printed out. The only way to get this program to do what I would like is to edit the /etc/services file, while I would prefer to manage this with NIS. Am I doing something wrong ? Is there some way I could get around this ? If anyone has any advice I would be very grateful. Thanks Bill Crooke bcrooke@viewlogic.com Viewlogic Systems, Inc. 293 Boston Post Rd West Marlboro, MA 01752-4615 508-480-0881 Ext 421 ___________________________________________________________________________ #include #include main (argc, argv) int argc; char **argv; { struct servent *serv; /* Service entity */ serv = getservbyname ("vnsd", "udp"); if (serv != NULL) { printf ("%s\n", serv->s_name); printf ("%d\n", serv->s_port); printf ("%s\n", serv->s_proto); } else { printf ("error: service not in /etc/services\n"); } } -- Bill Crooke bcrooke@viewlogic.com Viewlogic Systems, Inc. 293 Boston Post Rd West Marlboro, MA 01752-4615 508-480-0881 Ext 421