1: /* hosts.c - use MMDF to get hostname information */
   2: 
   3: /* LINTLIBRARY */
   4: 
   5: #include "../h/strings.h"
   6: #include "util.h"
   7: #include "mmdf.h"
   8: #include "ch.h"
   9: #ifdef  MMDFII
  10: #include "dm.h"
  11: #endif	MMDFII
  12: #include "../zotnet/mts.h"
  13: 
  14: /*
  15:  * We really should be careful with the number of fd's that this routine
  16:  * opens:  the ch_seq ch_table.c module likes to keep 6 (yes, SIX) fds around
  17:  * to speed-up host lookups in the channel table.  Unfortunately, after all
  18:  * of them get opened, six are always open (ch_table may close one to open
  19:  * another).  The bottom line is that if repl calls post, then we get 12
  20:  * (yes, TWELVE) fds open, with only six usable.
  21:  *
  22:  * send will close all fds >= 3 prior to invoking post.  It would be nice
  23:  * if one could control ch_seq's use of fds for table lookups, but such is
  24:  * life.
  25:  *
  26:  */
  27: 
  28: #ifndef MMDFII
  29: char   *OfficialName (name)
  30: register char   *name;
  31: {
  32:     register Chan *ch;
  33:     static char buffer[BUFSIZ];
  34: 
  35:     return ((ch = ch_h2chan (name, buffer)) == (Chan *) (-1) ? NULL
  36:         : ch == (Chan *) NULL ? LocalName ()
  37:         : buffer);
  38: }
  39: #else   MMDFII
  40: 
  41: extern char *invo_name;
  42: 
  43: extern short ch_yloc;            /* ok to intercept local names        */
  44: 
  45: static int  inited = 0;
  46: 
  47: char *OfficialName (name)
  48: register char  *name;
  49: {
  50:     Dmn_route route;
  51:     static char buffer[BUFSIZ];
  52: 
  53:     if (!inited) {
  54:     mmdf_init (invo_name);
  55:     inited = 1;
  56:     }
  57:     switch (dm_v2route (name, buffer, &route)) {
  58:     case NOTOK:
  59:     case OK:
  60:         return ((ch_yloc && lexequ (name, LocalName ())) ? LocalName ()
  61:             : NULL);
  62: 
  63:     default:
  64:         return buffer;
  65:     }
  66: }
  67: #endif	MMDFII

Defined functions

OfficialName defined in line 47; never used

Defined variables

inited defined in line 45; used 2 times
Last modified: 1986-04-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 516
Valid CSS Valid XHTML 1.0 Strict