Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / mts / mmdf / RCS / hosts.c,v
1 head    1.3;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.3
9 date    92.12.15.00.20.22;      author jromine; state Exp;
10 branches;
11 next    1.2;
12
13 1.2
14 date    92.12.14.17.47.34;      author jromine; state Exp;
15 branches;
16 next    1.1;
17
18 1.1
19 date    92.12.14.17.44.38;      author jromine; state Exp;
20 branches;
21 next    ;
22
23
24 desc
25 @@
26
27
28 1.3
29 log
30 @endif sugar
31 @
32 text
33 @/* hosts.c - use MMDF to get hostname information */
34 #ifndef lint
35 static char ident[] = "@@(#)$Id: hosts.c,v 1.2 1992/12/14 17:47:34 jromine Exp jromine $";
36 #endif  /* lint */
37
38 /* LINTLIBRARY */
39
40 #include "../h/strings.h"
41 #include "util.h"
42 #include "mmdf.h"
43 #include "ch.h"
44 #ifdef  MMDFII
45 #include "dm.h"
46 #endif  /* MMDFII */
47 #include "../zotnet/mts.h"
48
49 /* 
50  * We really should be careful with the number of fd's that this routine
51  * opens:  the ch_seq ch_table.c module likes to keep 6 (yes, SIX) fds around
52  * to speed-up host lookups in the channel table.  Unfortunately, after all
53  * of them get opened, six are always open (ch_table may close one to open
54  * another).  The bottom line is that if repl calls post, then we get 12
55  * (yes, TWELVE) fds open, with only six usable.
56  *
57  * send will close all fds >= 3 prior to invoking post.  It would be nice
58  * if one could control ch_seq's use of fds for table lookups, but such is
59  * life.
60  *
61  */
62
63 #ifndef MMDFII
64 char   *OfficialName (name)
65 register char   *name;
66 {
67     register Chan *ch;
68     static char buffer[BUFSIZ];
69
70     return ((ch = ch_h2chan (name, buffer)) == (Chan *) (-1) ? NULL
71             : ch == (Chan *) NULL ? LocalName ()
72             : buffer);
73 }
74 #else   /* MMDFII */
75
76 extern char *invo_name;
77
78 extern short ch_yloc;            /* ok to intercept local names        */
79
80 static int      inited = 0;
81
82 char *OfficialName (name)
83 register char  *name;
84 {
85     Dmn_route route;
86     static char buffer[BUFSIZ];
87
88     if (!inited) {
89         mmdf_init (invo_name);
90         inited = 1;
91     }
92     switch (dm_v2route (name, buffer, &route)) {
93         case NOTOK: 
94         case OK: 
95             return ((ch_yloc && lexequ (name, LocalName ())) ? LocalName ()
96                     : NULL);
97
98         default: 
99             return buffer;
100     }
101 }
102 #endif  /* MMDFII */
103 @
104
105
106 1.2
107 log
108 @add id
109 @
110 text
111 @d3 1
112 a3 1
113 static char ident[] = "@@(#)$Id: pidwait.c,v 1.9 1992/12/14 17:10:58 jromine Exp $";
114 d14 1
115 a14 1
116 #endif  MMDFII
117 d42 1
118 a42 1
119 #else   MMDFII
120 d70 1
121 a70 1
122 #endif  MMDFII
123 @
124
125
126 1.1
127 log
128 @Initial revision
129 @
130 text
131 @d2 3
132 @