1 /* hosts.c - find out the official name of a host */
3 static char ident[] = "@(#)$Id: hosts.c,v 1.6 1992/12/15 00:20:22 jromine Exp $";
9 #if defined(BSD41A) || defined(BSD42) || defined(SOCKETS)
11 #endif /* not (defined(BSD41A) || defined(BSD42) || defined(SOCKETS)) */
13 #include "../h/strings.h"
15 #include "../zotnet/mts.h"
17 #if defined(BSD42) || defined(SOCKETS)
19 #endif /* BSD42 or SOCKETS */
26 char *OfficialName (name)
33 static char buffer[BUFSIZ];
34 #if defined(BSD42) || defined(SOCKETS)
35 register struct hostent *hp;
36 #endif /* BSD42 or SOCKETS */
39 for (p = name, q = site; *p; p++, q++)
40 *q = isupper (*p) ? tolower (*p) : *p;
44 if (uleq (LocalName (), site))
48 if (rhost (&q) != NOTOK) {
49 (void) strcpy (buffer, q);
54 #if defined(BSD42) || defined(SOCKETS)
55 if (hp = gethostbyname (q)) {
56 (void) strcpy (buffer, hp -> h_name);
59 #endif /* BSD42 or SOCKETS */