#include <netdb.h>
#include <ctype.h>
#include <string.h>
-char *
-PrincipalHostname(alias)
- char *alias;
+
+char *PrincipalHostname(char *alias)
{
- struct hostent *h;
- char *phost = alias;
- if ((h=gethostbyname(alias)) != (struct hostent *)NULL) {
- char *p = strchr(h->h_name, '.');
- if (p)
- *p = NULL;
- p = phost = h->h_name;
- do {
- if (isupper(*p))
- *p = tolower(*p);
- } while (*p++);
- }
- return(phost);
+ struct hostent *h;
+ char *phost = alias;
+ if ((h = gethostbyname(alias)))
+ {
+ char *p = strchr(h->h_name, '.');
+ if (p)
+ *p = NULL;
+ p = phost = h->h_name;
+ do
+ {
+ if (isupper(*p))
+ *p = tolower(*p);
+ }
+ while (*p++);
+ }
+ return phost;
}