/* * $Source$ * $Header$ */ /* (c) Copyright 1988 by the Massachusetts Institute of Technology. */ /* For copying and distribution information, please see the file */ /* . */ #ifndef lint static char *rcsid_hostname_c = "$Header$"; #endif lint /* PrincipalHostname, borrowed from rcmd.c in Kerberos code */ #include #include #include #include #include #include #include char * PrincipalHostname(alias) char *alias; { struct hostent *h; char *phost = alias; if ((h=gethostbyname(alias)) != (struct hostent *)NULL) { char *p = index(h->h_name, '.'); if (p) *p = NULL; p = phost = h->h_name; do { if (isupper(*p)) *p = tolower(*p); } while (*p++); } return(phost); }