1: /* bbaka.c - generate an alias list for BBoards */
   2: 
   3: #include "../h/strings.h"
   4: #include "../zotnet/bboards.h"
   5: #include <stdio.h>
   6: #include "../zotnet/mts.h"
   7: 
   8: 
   9: static int  system = 0;
  10: static char domain[BUFSIZ] = "";
  11: 
  12: /*  */
  13: 
  14: /* ARGSUSED */
  15: 
  16: main (argc, argv)
  17: int     argc;
  18: char  **argv;
  19: {
  20:     struct bboard  *bb;
  21: 
  22:     if (argc > 1 && strcmp (argv[1], "system") == 0)
  23:     system++;
  24: 
  25:     mts_init (argv[0]);
  26:     make_lower (domain, bb_domain);
  27: 
  28:     (void) setbbent (SB_STAY);
  29:     while (bb = getbbent ())
  30:     process (bb);
  31:     (void) endbbent ();
  32: 
  33:     exit (0);
  34: }
  35: 
  36: /*  */
  37: 
  38: static  process (bb)
  39: struct bboard  *bb;
  40: {
  41:     char  **ap,
  42:             bbaddr[BUFSIZ],
  43:             buffer[BUFSIZ],
  44:             ldaddr[BUFSIZ],
  45:             result[BUFSIZ];
  46: 
  47:     if (system) {
  48: #ifndef MHMTS
  49:     (void) sprintf (bbaddr, "%s@bboards", bb -> bb_name, LocalName ());
  50: #else   MHMTS
  51:     (void) strcpy (bbaddr, BBOARDS);
  52: #endif	MHMTS
  53: 
  54:     if (strcmp (bb -> bb_name, bb -> bb_addr) == 0)
  55:         aka (bb -> bb_name, bbaddr);
  56:     if (domain[0]) {
  57:         (void) sprintf (buffer, "%s-%s", domain, bb -> bb_name);
  58:         if (bb -> bb_relay && *bb -> bb_relay) {
  59:         (void) sprintf (result, "%s%s@%s", DISTADR, bb -> bb_name,
  60:             bb -> bb_relay);
  61:         aka (buffer, result);
  62:         }
  63:         else
  64:         aka (buffer, bbaddr);
  65:     }
  66:     (void) sprintf (buffer, "%s%s", DISTADR, bb -> bb_name);
  67:     aka (buffer, bbaddr);
  68: 
  69:     (void) sprintf (ldaddr, "%s@%s", *bb -> bb_leader, LocalName ());
  70:     for (ap = bb -> bb_leader, ap++; *ap; ap++)
  71:         (void) sprintf (ldaddr + strlen (ldaddr), ",%s@%s", *ap,
  72:             LocalName ());
  73:     if (domain[0]) {
  74:         if (bb -> bb_relay && *bb -> bb_relay
  75:             && strcmp (*bb -> bb_leader, BBOARDS) == 0
  76:             && --ap == bb -> bb_leader)
  77:         (void) sprintf (ldaddr, "%s-%s-request@%s",
  78:             domain, bb -> bb_name, bb -> bb_relay);
  79:     }
  80:     if (strcmp (bb -> bb_request, *bb -> bb_leader) == 0) {
  81:         (void) sprintf (buffer, "%s-request", bb -> bb_name);
  82:         aka (buffer, ldaddr);
  83:     }
  84:     if (domain[0]) {
  85:         (void) sprintf (buffer, "%s-%s-request", domain, bb -> bb_name);
  86:         if (bb -> bb_relay && *bb -> bb_relay) {
  87:         (void) sprintf (result, "%s@%s", buffer, bb -> bb_relay);
  88:         aka (buffer, result);
  89:         }
  90:         else
  91:         aka (buffer, ldaddr);
  92:     }
  93:     (void) sprintf (buffer, "local-%s-request", bb -> bb_name);
  94:     aka (buffer, ldaddr);
  95:     }
  96:     else {
  97:     if (strcmp (bb -> bb_name, bb -> bb_addr))
  98:         aka (bb -> bb_name, bb -> bb_addr);
  99: 
 100:     (void) sprintf (buffer, "%s-request", bb -> bb_name);
 101:     if (strcmp (bb -> bb_request, *bb -> bb_leader))
 102:         aka (buffer, bb -> bb_request);
 103:     }
 104: }
 105: 
 106: /*  */
 107: 
 108: static  aka (field, value)
 109: char   *field,
 110:        *value;
 111: {
 112: #ifndef MHMTS
 113:     printf ("%s: %s\n", field, value);
 114: #else   MHMTS
 115:     printf ("%s%s %s\n", field, system ? ":" : ";", value);
 116: #endif	MHMTS
 117: }

Defined functions

aka defined in line 108; used 10 times
main defined in line 16; never used
process defined in line 38; used 1 times
  • in line 30

Defined variables

domain defined in line 10; used 7 times
system defined in line 9; used 3 times
Last modified: 1986-04-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1012
Valid CSS Valid XHTML 1.0 Strict