source: trunk/athena/bin/discuss/libds/host.c @ 12459

Revision 12459, 1.5 KB checked in by danw, 26 years ago (diff)
comment out text after #else and #endif
Line 
1/*
2 *
3 *      Copyright (C) 1988, 1989 by the Massachusetts Institute of Technology
4 *      Developed by the MIT Student Information Processing Board (SIPB).
5 *      For copying information, see the file mit-copyright.h in this release.
6 *
7 */
8/*
9 *
10 *      $Id: host.c,v 1.8 1999-02-08 14:47:09 danw Exp $
11 *
12 * host.c () -- Program to return the default hostname, internet style. 
13 *              Placed here because UNIX is too brain-damaged to have this
14 *              routine (gethostname is doesn't return unique names.  This
15 *              caches the result.
16 *
17 */
18#ifndef lint
19static char *rcsid_host_c = "$Id: host.c,v 1.8 1999-02-08 14:47:09 danw Exp $";
20#endif /* lint */
21
22#include <string.h>
23#include <netdb.h>
24#include <ctype.h>
25
26char *
27local_host_name ()
28{
29     static char myhostname [100];
30     struct hostent *hp;
31
32     if (myhostname [0] != '\0')
33          return (myhostname);
34
35     gethostname (myhostname, sizeof (myhostname));
36
37     hp = gethostbyname (myhostname);
38     if (hp == 0)
39          return(myhostname);
40
41     strcpy (myhostname, hp -> h_name);
42     return (myhostname);
43}
44
45int namcmp(str1, str2)
46register char *str1, *str2;
47{
48     register char c1,c2;
49
50     while (*str1 && *str2) {
51          if (*str1 == *str2) {
52                  str1++;
53                  str2++;
54          } else if (isalpha (*str1)) {
55               c1 = *str1++;
56               c2 = *str2++;
57               if (islower (c1))
58                    c1 = toupper (c1);
59               if (islower (c2))
60                    c2 = toupper (c2);
61               if (c1 == c2)
62                    continue;
63               return(1);
64          } else
65               return (1);
66     }
67
68     return (*str1 || *str2);
69}
70
Note: See TracBrowser for help on using the repository browser.