From: bill@concept.viewlogic.com (Bill Crooke)
Subject: Problem with getservbyname () and NIS.
Date: 19 May 92 14:22:47 GMT [thread overview]
Message-ID: <1992May19.142247.1955@viewlogic.com> (raw)
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 <stdio.h>
#include <netdb.h>
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
reply other threads:[~1992-05-19 14:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox