]> andersk Git - moira.git/blame - update/hostname.c
eliminate use of the `register' keyword: let the compiler decide
[moira.git] / update / hostname.c
CommitLineData
de56407f 1/*
2 * $Source$
3 * $Header$
4 */
546bc43b 5/* (c) Copyright 1988 by the Massachusetts Institute of Technology. */
6/* For copying and distribution information, please see the file */
7/* <mit-copyright.h>. */
de56407f 8
9#ifndef lint
10static char *rcsid_hostname_c = "$Header$";
11#endif lint
12
13/* PrincipalHostname, borrowed from rcmd.c in Kerberos code */
546bc43b 14#include <mit-copyright.h>
de56407f 15#include <stdio.h>
16#include <sys/types.h>
17#include <netinet/in.h>
18#include <netdb.h>
19#include <ctype.h>
8617eaf2 20#include <string.h>
5eaef520 21
22char *PrincipalHostname(char *alias)
de56407f 23{
5eaef520 24 struct hostent *h;
25 char *phost = alias;
26 if ((h = gethostbyname(alias)))
27 {
28 char *p = strchr(h->h_name, '.');
29 if (p)
30 *p = NULL;
31 p = phost = h->h_name;
32 do
33 {
34 if (isupper(*p))
35 *p = tolower(*p);
36 }
37 while (*p++);
38 }
39 return phost;
de56407f 40}
This page took 0.082789 seconds and 5 git commands to generate.