1 /* 2 * Fetch netdb entry for a host given 3 * its name from /etc/x25hosts 4 * 5 * Frank Pronk 1985 6 */ 7 8 #include <netdb.h> 9 10 struct hostent * 11 getx25hostbyname (name) 12 register char *name; 13 { 14 register struct hostent *p; 15 register char **cp; 16 struct hostent *getx25hostent (); 17 18 setx25hostent (0); 19 while (p = getx25hostent ()) { 20 if (strcmp (p->h_name, name) == 0) 21 break; 22 for (cp = p->h_aliases; *cp != 0; cp++) 23 if (strcmp (*cp, name) == 0) 24 goto found; 25 } 26 found: 27 endx25hostent (); 28 return (p); 29 } 30