|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T h
Length: 1163 (0x48b)
Types: TextFile
Names: »hosts.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
└─⟦3658e588a⟧ »EurOpenD3/mail/mh/mh-6.7.tar.Z«
└─⟦c75e36ecb⟧
└─⟦this⟧ »mh-6.7/mts/mh/hosts.c«
/* hosts.c - find out the official name of a host */
/* LINTLIBRARY */
#undef NETWORK
#if defined(BSD41A) || defined(BSD42) || defined(SOCKETS)
#define NETWORK
#endif not (defined(BSD41A) || defined(BSD42) || defined(SOCKETS))
#include "../h/strings.h"
#include <stdio.h>
#include "../zotnet/mts.h"
#include <ctype.h>
#if defined(BSD42) || defined(SOCKETS)
#include <netdb.h>
#endif BSD42 or SOCKETS
#define NOTOK (-1)
/* \f
*/
char *OfficialName (name)
char *name;
{
register char *p;
char *q,
site[BUFSIZ];
#ifdef NETWORK
static char buffer[BUFSIZ];
#if defined(BSD42) || defined(SOCKETS)
register struct hostent *hp;
#endif BSD42 or SOCKETS
#endif NETWORK
for (p = name, q = site; *p; p++, q++)
*q = isupper (*p) ? tolower (*p) : *p;
*q = NULL;
q = site;
if (uleq (LocalName (), site))
return LocalName ();
#ifdef BSD41A
if (rhost (&q) != NOTOK) {
(void) strcpy (buffer, q);
free (q);
return buffer;
}
#endif BSD41A
#if defined(BSD42) || defined(SOCKETS)
if (hp = gethostbyname (q)) {
(void) strcpy (buffer, hp -> h_name);
return buffer;
}
#endif BSD42 or SOCKETS
return NULL;
}