]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/mts/mh/RCS/hosts.c,v
sbr/mts.c: Delete mmdlm2; use same-valued mmdlm1 instead.
[nmh] / docs / historical / mh-6.8.5 / mts / mh / RCS / hosts.c,v
1 head 1.6;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.6
9 date 92.12.15.00.20.22; author jromine; state Exp;
10 branches;
11 next 1.5;
12
13 1.5
14 date 92.01.31.21.37.07; author jromine; state Exp;
15 branches;
16 next 1.4;
17
18 1.4
19 date 90.04.05.15.30.01; author sources; state Exp;
20 branches;
21 next 1.3;
22
23 1.3
24 date 90.04.05.14.43.18; author sources; state Exp;
25 branches;
26 next 1.2;
27
28 1.2
29 date 90.02.05.14.51.51; author sources; state Exp;
30 branches;
31 next 1.1;
32
33 1.1
34 date 90.02.05.14.51.25; author sources; state Exp;
35 branches;
36 next ;
37
38
39 desc
40 @@
41
42
43 1.6
44 log
45 @endif sugar
46 @
47 text
48 @/* hosts.c - find out the official name of a host */
49 #ifndef lint
50 static char ident[] = "@@(#)$Id: hosts.c,v 1.5 1992/01/31 21:37:07 jromine Exp jromine $";
51 #endif /* lint */
52
53 /* LINTLIBRARY */
54
55 #undef NETWORK
56 #if defined(BSD41A) || defined(BSD42) || defined(SOCKETS)
57 #define NETWORK
58 #endif /* not (defined(BSD41A) || defined(BSD42) || defined(SOCKETS)) */
59
60 #include "../h/strings.h"
61 #include <stdio.h>
62 #include "../zotnet/mts.h"
63 #include <ctype.h>
64 #if defined(BSD42) || defined(SOCKETS)
65 #include <netdb.h>
66 #endif /* BSD42 or SOCKETS */
67
68
69 #define NOTOK (-1)
70
71 /* \f */
72
73 char *OfficialName (name)
74 char *name;
75 {
76 register char *p;
77 char *q,
78 site[BUFSIZ];
79 #ifdef NETWORK
80 static char buffer[BUFSIZ];
81 #if defined(BSD42) || defined(SOCKETS)
82 register struct hostent *hp;
83 #endif /* BSD42 or SOCKETS */
84 #endif /* NETWORK */
85
86 for (p = name, q = site; *p; p++, q++)
87 *q = isupper (*p) ? tolower (*p) : *p;
88 *q = 0;
89 q = site;
90
91 if (uleq (LocalName (), site))
92 return LocalName ();
93
94 #ifdef BSD41A
95 if (rhost (&q) != NOTOK) {
96 (void) strcpy (buffer, q);
97 free (q);
98 return buffer;
99 }
100 #endif /* BSD41A */
101 #if defined(BSD42) || defined(SOCKETS)
102 if (hp = gethostbyname (q)) {
103 (void) strcpy (buffer, hp -> h_name);
104 return buffer;
105 }
106 #endif /* BSD42 or SOCKETS */
107
108 return NULL;
109 }
110 @
111
112
113 1.5
114 log
115 @kerberos
116 @
117 text
118 @d3 2
119 a4 2
120 static char ident[] = "@@(#)$Id: hosts.c,v 1.4 1990/04/05 15:30:01 sources Exp jromine $";
121 #endif lint
122 d11 1
123 a11 1
124 #endif not (defined(BSD41A) || defined(BSD42) || defined(SOCKETS))
125 d19 1
126 a19 1
127 #endif BSD42 or SOCKETS
128 d36 2
129 a37 2
130 #endif BSD42 or SOCKETS
131 #endif NETWORK
132 d53 1
133 a53 1
134 #endif BSD41A
135 d59 1
136 a59 1
137 #endif BSD42 or SOCKETS
138 @
139
140
141 1.4
142 log
143 @add ID
144 @
145 text
146 @d3 1
147 a3 1
148 static char ident[] = "@@(#)$Id:$";
149 d41 1
150 a41 1
151 *q = NULL;
152 @
153
154
155 1.3
156 log
157 @add ID
158 @
159 text
160 @d3 1
161 a3 1
162 static char ident[] = "$Id:";
163 @
164
165
166 1.2
167 log
168 @SOCKETS
169 @
170 text
171 @d2 3
172 @
173
174
175 1.1
176 log
177 @Initial revision
178 @
179 text
180 @d6 1
181 a6 1
182 #if defined(BSD41A) || defined(BSD42)
183 d8 1
184 a8 1
185 #endif not (defined(BSD41A) || defined(BSD42))
186 d14 1
187 a14 1
188 #ifdef BSD42
189 d16 1
190 a16 1
191 #endif BSD42
192 d31 1
193 a31 1
194 #ifdef BSD42
195 d33 1
196 a33 1
197 #endif BSD42
198 d51 1
199 a51 1
200 #ifdef BSD42
201 d56 1
202 a56 1
203 #endif BSD42
204 @