home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / bts314b4 / btconfig.c < prev    next >
C/C++ Source or Header  |  1994-09-17  |  44KB  |  1,724 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                            */
  3. /*                                                                            */
  4. /*        ------------         Bit-Bucket Software, Co.                        */
  5. /*        \ 10001101 /         Writers and Distributors of                    */
  6. /*         \ 011110 /          Freely Available<tm> Software.                 */
  7. /*          \ 1011 /                                                            */
  8. /*           ------                                                            */
  9. /*                                                                            */
  10. /*    (C) Copyright 1987-90, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                            */
  12. /*                                                                            */
  13. /*                 This module was written by Vince Perriello                 */
  14. /*                                                                            */
  15. /*                                                                            */
  16. /*                    BinkleyTerm Configuration File Parser                    */
  17. /*                                                                            */
  18. /*                                                                            */
  19. /*      For complete    details  of the licensing restrictions, please refer    */
  20. /*      to the License  agreement,  which  is published in its entirety in    */
  21. /*      the MAKEFILE and BT.C, and also contained in the file LICENSE.240.    */
  22. /*                                                                            */
  23. /*      USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*      BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*      THIS    AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,    OR IF YOU DO    */
  26. /*      NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  27. /*      SOFTWARE CO.    AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  28. /*      SHOULD YOU  PROCEED TO USE THIS FILE    WITHOUT HAVING    ACCEPTED THE    */
  29. /*      TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  30. /*      AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.        */
  31. /*                                                                            */
  32. /*                                                                            */
  33. /* You can contact Bit Bucket Software Co. at any one of the following        */
  34. /* addresses:                                                                */
  35. /*                                                                            */
  36. /* Bit Bucket Software Co.          FidoNet  1:104/501, 1:132/491, 1:141/491    */
  37. /* P.O. Box 460398                  AlterNet 7:491/0                            */
  38. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  39. /*                                  Internet f491.n132.z1.fidonet.org         */
  40. /*                                                                            */
  41. /* Please feel free to contact us at any time to share your comments about    */
  42. /* our software and/or licensing policies.                                    */
  43. /*                                                                            */
  44. /*--------------------------------------------------------------------------*/
  45.  
  46. #include <stdio.h>
  47. #include <signal.h>
  48. #include <ctype.h>
  49. #include <stdlib.h>
  50. #include <string.h>
  51.  
  52. #ifndef LATTICE
  53. #include <io.h>
  54. #endif
  55.  
  56. #ifdef __TOS__
  57. #include <conio.h>
  58. #include <ext.h>
  59. #else
  60. #include <dos.h>
  61. #include <sys\types.h>
  62. #include <sys\stat.h>
  63. #endif
  64.  
  65. #include "bink.h"
  66. #include "msgs.h"
  67. #include "keybd.h"
  68. #include "com.h"
  69. #include "sbuf.h"
  70. #include "vfossil.h"
  71. #include "config.h"
  72. #include "nodeproc.h"
  73.  
  74. /* Change values in externs.h when adding or removing entries */
  75. struct parse_list config_lines[] = {
  76.                                     {8,  "SameRing"},
  77.                                     {10, "Answerback"},
  78.                                     {5,  "Macro"},
  79.                                     {5,  "Shell"},
  80.                                     {4,  "Dial"},
  81.                                     {5,  "Event"},
  82.                                     {4,  "Zone"},
  83.                                     {6,  "MaxReq"},
  84.                                     {8,  "LogLevel"},
  85.                                     {4,  "Baud"},
  86.                                     {7,  "MaxPort"},
  87.                                     {4,  "Port"},
  88.                                     {9,  "ResetPort"},
  89.                                     {7,  "Carrier"},
  90.                                     {9,  "StatusLog"},
  91.                                     {6,  "Reader"},
  92.                                     {9,  "BossPhone"},
  93.                                     {7,  "BossPwd"},
  94.                                     {8,  "Protocol"},
  95.                                     {6,  "System"},
  96.                                     {5,  "Sysop"},
  97.                                     {4,  "Boss"},
  98.                                     {5,  "Point"},
  99.                                     {3,  "Aka"},
  100.                                     {4,  "Hold"},
  101.                                     {9,  "DownLoads"},
  102.                                     {7,  "NetFile"},
  103.                                     {9,  "FirstInit"},
  104.                                     {4,  "Init"},
  105.                                     {5,  "Reset"},
  106.                                     {4,  "Busy"},
  107.                                     {6,  "Prefix"},
  108.                                     {8,  "NodeList"},
  109.                                     {3,  "Fax"},
  110.                                     {10, "FaxInbound"},
  111.                                     {8,  "AfterFax"},
  112.                                     {10, "FaxConnect"},
  113.                                     {4,  "BTNC" },
  114.                                     {9,  "NodeCache" },
  115.                                     {5,  "Avail"},
  116.                                     {6,  "OKFile"},
  117.                                     {5,  "About"},
  118.                                     {8,  "MailNote"},
  119.                                     {6,  "Banner"},
  120.                                     {10, "UnAttended"},
  121.                                     {9,  "OverWrite"},
  122.                                     {7,  "ReqOnUs"},
  123.                                     {8,  "LockBaud"},
  124.                                     {7,  "TimeOut"},
  125.                                     {5,  "NoSLO"},
  126.                                     {9,  "SlowModem"},
  127.                                     {11, "SmallWindow"},
  128.                                     {8,  "NoPickup"},
  129.                                     {10, "NoRequests"},
  130.                                     {7,  "NetMail"},
  131.                                     {6,  "Suffix"},
  132.                                     {12, "NoFullScreen"},
  133.                                     {13, "SignalHandler"},
  134.                                     {8,  "AutoBaud"},
  135.                                     {4,  "Gong"},
  136.                                     {9,  "NoCollide"},
  137.                                     {9,  "ExtrnMail"},
  138.                                     {7,  "BBSNote"},
  139.                                     {3,  "BBS"},
  140.                                     {10, "ScriptPath"},
  141.                                     {7,  "BoxType"},
  142.                                     {7,  "Include"},
  143.                                     {11, "CaptureFile"},
  144.                                     {9,  "CursorCol"},
  145.                                     {9,  "CursorRow"},
  146.                                     {9,  "DoingMail"},
  147.                                     {8,  "EnterBBS"},
  148.                                     {10, "PrivateNet"},
  149.                                     {6,  "Packer"},
  150.                                     {7,  "Cleanup"},
  151.                                     {9,  "AfterMail"},
  152.                                     {6,  "Colors"},
  153.                                     {9,  "JanusBaud"},
  154.                                     {11, "ReqTemplate"},
  155.                                     {10, "KnownAvail"},
  156.                                     {12, "KnownReqList"},
  157.                                     {10, "KnownAbout"},
  158.                                     {12, "KnownInbound"},
  159.                                     {11, "KnownReqLim"},
  160.                                     {11, "KnownReqTpl"},
  161.                                     {9,  "ProtAvail"},
  162.                                     {11, "ProtReqList"},
  163.                                     {9,  "ProtAbout"},
  164.                                     {11, "ProtInbound"},
  165.                                     {10, "ProtReqLim"},
  166.                                     {10, "ProtReqTpl"},
  167.                                     {11, "Application"},
  168.                                     {7,  "NoZones" },
  169.                                     {6,  "Answer"},
  170.                                     {9,  "PollTries"},
  171.                                     { 9, "PollDelay" },
  172.                                     {7,  "Address"},
  173.                                     {3,  "Key" },
  174.                                     {10, "CurMudgeon"},
  175.                                     {7,  "NoWaZOO"},
  176.                                     { 6, "NoEMSI" },
  177.                                     { 9, "NoRequest" },
  178.                                     { 7, "NoJanus" },
  179.                                     { 3, "IOS" },
  180.                                     { 6, "Hold4D" },
  181.                                     {11, "ScreenBlank"},
  182.                                     {10, "Mark_Kromm"},
  183.                                     {6,  "Server"},
  184.                                     {10, "ModemTrans"},
  185.                                     {7,  "PreDial"},
  186.                                     {7,  "PreInit"},
  187.                                     {7,  "DTRHigh"},
  188.                                     {5,  "Debug"},
  189.                                     {8,  "NoZedZap"},
  190.                                     {8,  "NoResync"},
  191.                                     {9,  "NoSEAlink"},
  192.                                     {8,  "FTS_0001"},
  193.                                     {10, "LineUpdate"},
  194.                                     {7,  "JanusOK" },
  195.                                     {8,  "TermInit" },
  196.                                     {6,  "Domain" },
  197.                                     {5,  "Flags" },
  198.                                     {10, "TaskNumber"},
  199.                                     {8,  "MaxBytes"},
  200.                                     {13, "KnownMaxBytes"},
  201.                                     {12, "ProtMaxBytes"},
  202.                                     {7,  "MaxTime"},
  203.                                     {12, "KnownMaxTime"},
  204.                                     {11, "ProtMaxTime"},
  205.                                     {7,  "NoLineA" },
  206. #ifdef BIOSDISPLAY
  207.                                     {11, "BIOSdisplay" },
  208. #endif                                    
  209.                                     {9,  "UseColors" },
  210.                                     {9,  "IKBDclock" },
  211.                                     {5,  "NoCTS" },
  212.                                     {7,  "HardCTS" },
  213.                                     {10, "STlockBaud" },
  214.                                     {9,  "SlowJanus" },
  215.                                     {9,  "Hard38400" },
  216.                                     {9,  "RSVEBoard" },
  217.                                     {4,  "Rbuf" },
  218.                                     {4,  "Tbuf" },
  219.                                     {8,  "TimeZone" },
  220.                                     {12, "NiceOutbound"},
  221.                                     {10, "ReInitTime"},
  222.                                     {12, "ReadHoldTime"},
  223.                                     { 8, "HoldOnUs" },
  224.                                     { 7, "SendRSP" },
  225.                                     {12, "UseCallSlots"},
  226.                                     { 8, "FDBugfix"},
  227. #if defined(__PUREC__) || defined(__TURBOC__)
  228.                                     { 10, "CLIcommand" },
  229. #endif
  230. #if 0
  231.                                     {7,  "CostLog"},
  232.                                     {11, "NoWildcards"},
  233.                                     {11, "SuckerLimit"},
  234.                                     {10, "HstLs2400c"},
  235.                                     {8,  "CostUnit"},
  236. #endif
  237.                                     { 8, "NLsystem" },
  238.                                     { 5, "Phone" },
  239.                                     { 4, "City" },
  240.                                     { 7, "NLflags" },
  241.                                     { 6, "NLbaud" },
  242.                                     { 5, "Tranx" },
  243.                                     {0, NULL}
  244. };
  245.  
  246.  
  247. static char *ctl_slash_string (char *source);
  248.  
  249. int ST_altport = 0;
  250.  
  251. void parse_config( char *config_file )
  252. {
  253.    FILE *stream;
  254.    char temp[256];
  255.    char *c;
  256.    int i,ST_port;
  257.    unsigned long temp_num;
  258.    char *p, *p1, *p2;
  259.    PN_TRNS *tpn;
  260.    MDM_TRNS *tmm;
  261.    J_TYPES *tjt;
  262.  
  263.    (void) sprintf (temp, "%s%s", BINKpath, config_file);
  264.    if ((stream = fopen (temp, read_ascii)) == NULL)     /* OK, let's open the file     */
  265.       return;                                     /* no file, no work to do      */
  266.  
  267.    while ((fgets (temp, 255, stream)) != NULL)     /* Now we parse the file ... */
  268.       {
  269.       c = temp;                                  /* Check out the first char  */
  270.       if ((*c == '%') || (*c == ';'))             /* See if it's a comment
  271.                                                   * line */
  272.          continue;
  273.  
  274.       i = (int) strlen (temp);                           /* how long this line is     */
  275.  
  276.       if (i < 3)
  277.          continue;                                 /* If too short, ignore it   */
  278.  
  279.       c = &temp[--i];                             /* point at last character   */
  280.       if (*c == '\n')                             /* if it's a newline,          */
  281.          *c = '\0';                              /* strip it off              */
  282.  
  283.       switch (parse (temp, config_lines))
  284.          {
  285.          case C_SameRing:                                 /* "SameRing"        */
  286.             modemring = 1;
  287.             break;
  288.  
  289.          case C_Answerback:                                /* "Answerback"    */
  290.             answerback = ctl_string (&temp[10]);
  291.             break;
  292.  
  293.          case C_Macro:                                  /* "Macro"         */
  294.             c = skip_blanks (&temp[5]);
  295.             i = atoi (c);
  296.             if ((i <= 0) || (i > N_SHELLS))
  297.                {
  298.                (void) printf ("%s %d %s\n", msgtxt[M_MACRO_NUMBER], i, msgtxt[M_OUT_OF_RANGE]);
  299.                break;
  300.                }
  301.             c = skip_to_blank (c);
  302.             c = skip_blanks (c);
  303.             p = keys[i - 1] = (char *) malloc (strlen (c) + 1);
  304.             while (*c && (*c != '\n'))
  305.                {
  306.                if (*c == '|')
  307.                   *p++ = '\r';
  308.                else *p++ = *c;
  309.                ++c;
  310.                }
  311.             *p = '\0';
  312.             break;
  313.  
  314.          case C_Shell:                                  /* "Shell"        */
  315.             c = skip_blanks (&temp[5]);
  316.             i = atoi (c);
  317.             if ((i <= 0) || (i > N_SHELLS))
  318.                {
  319.                (void) printf ("%s %d %s\n", msgtxt[M_SHELL_NUMBER], i, msgtxt[M_OUT_OF_RANGE]);
  320.                break;
  321.                }
  322.             c = skip_to_blank (c);
  323.             c = skip_blanks (c);
  324.             shells[i-1] = strdup(c);
  325.             break;
  326.  
  327.          case C_Dial:                                 /* "Dial"           */
  328.             p = &temp[4];
  329.             while ((*p) && (isspace (*p)))
  330.                ++p;
  331.  
  332.             if ((*p == ';') || (*p == '\0'))
  333.                {
  334.                break;
  335.                }
  336.  
  337.             tpn = (PN_TRNS *) malloc (sizeof (PN_TRNS));
  338.  
  339.             p1 = tpn->prenum;
  340.             while ((*p) && (*p != '/') && (!isspace (*p)))
  341.                {
  342.                *p1++ = *p++;
  343.                }
  344.             *p1 = '\0';
  345.  
  346.             p1 = tpn->sufnum;
  347.             if ((*p == '\0') || (isspace (*p)))
  348.                {
  349.                *p1 = '\0';
  350.                }
  351.             else
  352.                {
  353.                ++p;
  354.  
  355.                while ((*p) && (!isspace (*p)))
  356.                   {
  357.                   *p1++ = *p++;
  358.                   }
  359.                *p1 = '\0';
  360.                }
  361.  
  362.             while ((*p) && (isspace (*p)))
  363.                ++p;
  364.  
  365.             p1 = tpn->prematch;
  366.             while ((*p) && (*p != '/') && (!isspace (*p)))
  367.                {
  368.                *p1++ = *p++;
  369.                }
  370.             *p1 = '\0';
  371.  
  372.             p1 = tpn->sufmatch;
  373.             if ((*p == '\0') || (isspace (*p)))
  374.                {
  375.                *p1 = '\0';
  376.                }
  377.             else
  378.                {
  379.                ++p;
  380.  
  381.                while ((*p) && (!isspace (*p)))
  382.                   {
  383.                   *p1++ = *p++;
  384.                   }
  385.                *p1 = '\0';
  386.                }
  387.  
  388.             tpn->prelen = (int) strlen (tpn->prenum);
  389.             tpn->suflen = (int) strlen (tpn->sufnum);
  390.             tpn->next = NULL;
  391.             if (pn_head == NULL)
  392.                {
  393.                pn_head = tpn;
  394.                }
  395.             else
  396.                {
  397.                pn->next = tpn;
  398.                }
  399.             pn = tpn;
  400.             break;
  401.  
  402.          case C_Event:                                  /* "Event"        */
  403.             c = skip_blanks (&temp[5]);
  404.             (void) parse_event (c);
  405.             break;
  406.  
  407.          case C_Zone:                                 /* "Zone"           */
  408.             c = skip_blanks (&temp[4]);
  409.             Zone = atoi (c);
  410.             if (!Zone)                            /* if we didn't find a zone  */
  411.                (void) printf (msgtxt[M_ILLEGAL_ZONE], &temp[4]);
  412.             break;
  413.  
  414.          case C_MaxReq:                               /* "MaxReq"        */
  415.             c = skip_blanks (&temp[6]);
  416.             DEFAULT.rq_Limit = atoi (c);
  417.             if (!DEFAULT.rq_Limit)                /* No requests??? */
  418.                (void) printf ("0 %s\n", msgtxt[M_REQUESTS_ALLOWED]);
  419.             break;
  420.  
  421.          case C_LogLevel:                                /* "LogLevel"      */
  422.             c = skip_blanks (&temp[8]);
  423.             i = atoi (c);
  424.             if ((i <= 5) && (i > 0))
  425.                {
  426.                loglevel = i;
  427.                }
  428.             else
  429.                {
  430.                (void) printf (msgtxt[M_BAD_LOGLEVEL], &temp[8]);
  431.                }
  432.             break;
  433.  
  434.          case C_Baud:                                /* "Baud"          */
  435.             c = skip_blanks (&temp[4]);
  436.             temp_num = (unsigned long) atoi (c);
  437.             max_baud.rate_value = 0;
  438.             for (i = 0; btypes[i].rate_value; i++)
  439.                {
  440.                if (btypes[i].rate_value == temp_num)
  441.                   {
  442.                   max_baud.rate_mask = btypes[i].rate_mask;
  443.                   max_baud.rate_value = temp_num;
  444.                   break;
  445.                   }
  446.                }
  447.             if (!max_baud.rate_value)
  448.                goto bad_line;
  449.             break;
  450.  
  451.          case C_ResetPort:                               /* "ResetPort"      */
  452.              reset_port = TRUE;
  453.             break;
  454.  
  455.          case C_MaxPort:                               /* "MaxPort"      */
  456.             c = skip_blanks (&temp[7]);
  457.             i = atoi (c);                         /* make it binary              */
  458.             if ((i > 0) && (i < 33))             /* if range is reasonable,   */
  459.                MAXport = i;                      /* Make it the max value      */
  460.             else
  461.                (void) printf (msgtxt[M_BAD_MAXPORT], &temp[7]);
  462.             break;
  463.  
  464.          case C_Port:                             /* "Port"          */
  465.             c = skip_blanks (&temp[4]);
  466.             i = atoi (c);                         /* make it binary              */
  467.             if ((i > 0) || (i < 33))             /* see if it's OK              */
  468.             {
  469.                port_ptr = i - 1;                 /* store it if so              */
  470.                if (MAXport < i)                  /* See if MAXport is less      */
  471.                   MAXport = i;                     /* If so, increase MAXport   */
  472.                original_port = port_ptr;
  473.  
  474.  
  475.                 ST_port = (int) Bconmap( -1);        /* ask for active PortNo */
  476.                 if ((ST_port < 0) || (ST_port > 9)) /* wenn Bconmap nicht unterstützt */
  477.                     ST_altport = ST_port = 1;
  478.                 else
  479.                 {
  480.                     ST_altport = ST_port;
  481.                     set_new_port(port_ptr+1);
  482.                 }
  483.             }
  484.             else
  485.                (void) printf (msgtxt[M_ILLEGAL_PORT], &temp[4]);
  486.             break;
  487.  
  488.          case C_Carrier:                               /* "Carrier"      */
  489.             c = skip_blanks (&temp[7]);
  490.             i = 0;
  491.             (void) sscanf (c, "%x", &i);                /* convert it to binary      */
  492.             if (i != 0)                          /* if we got anything          */
  493.                carrier_mask = (unsigned int) i;
  494.             else
  495.                (void) printf (msgtxt[M_ILLEGAL_CARRIER], &temp[7]);
  496.             break;
  497.  
  498.          case C_StatusLog:                                 /* "StatusLog"    */
  499.             c = strtok(&temp[9], seperators);
  500.             if(c)
  501.             {
  502.                 long length = 0;
  503.                 
  504.                 p = strtok(NULL, seperators);    /* Optional length */
  505.                 if(p && isdigit(*p))
  506.                     length = atol(p);
  507.                 init_log(c, length);
  508.             }
  509.             break;
  510.  
  511.          case C_Reader:                               /* "Reader"        */
  512.             BBSreader = ctl_string (&temp[6]);
  513.             break;
  514.  
  515.          case C_BossPhone:                                 /* "BossPhone"    */
  516.             BOSSphone = ctl_string (&temp[9]);
  517.             break;
  518.  
  519.          case C_BossPwd:                               /* "BossPwd"      */
  520.             break;
  521.  
  522.          case C_Protocol:                                /* "Protocol"      */
  523.             if (extern_index == 5)
  524.                break;
  525.             protocols[extern_index++] = ctl_string (&temp[8]);
  526.             break;
  527.  
  528.          case C_System:                               /* "System"        */
  529.             system_name = ctl_string (&temp[6]);
  530.             break;
  531.  
  532.          case C_Sysop:                                 /* "Sysop"        */
  533.             sysop = ctl_string (&temp[5]);
  534.             break;
  535.  
  536.         case C_NLsystem:                            /* NLsystem */
  537.             NL_System = ctl_string(&temp[8]);
  538.             break;
  539.  
  540.         case C_Phone:                                /* "Phone" */
  541.             NL_Phone = ctl_string(&temp[5]);
  542.             break;
  543.             
  544.         case C_City:                                /* "City" */
  545.             NL_City = ctl_string(&temp[4]);
  546.             break;
  547.             
  548.         case C_NLfLags:                                /* "NLflags" */
  549.             NL_Flags = ctl_string(&temp[7]);
  550.             break;
  551.             
  552.         case C_NLbaud:                                /* "NLbaud" */
  553.             NL_Baud = ctl_string(&temp[6]);
  554.             break;
  555.  
  556.  
  557.          case C_Boss:                                /* "Boss"          */
  558.             break;
  559.  
  560.          case C_Point:                                 /* "Point"        */
  561.             i = 5;
  562.             goto address;
  563.  
  564.          case C_Aka:                               /* "Aka"          */
  565.             i = 3;
  566.             goto address;
  567.  
  568.          case C_Address:                               /* "Address"      */
  569.             i = 7;
  570. address:
  571.  
  572.             /* extended Address similar to The Box
  573.              *    address zone:net/node.point[@domain] [fakenet] [flag] [bossphone]
  574.              *
  575.              * flag is:
  576.              *    + : Use 4D Addressing
  577.              *    * : Use FakeNet for our net
  578.              *
  579.              * This isn't very well error trapped, but neither is the
  580.              * rest of the stuff in here!!!
  581.              *
  582.              * Note that the address must be a single word i.e. dont leave
  583.              * any spaces between the "@domain"
  584.              */
  585.             
  586.             {    /* Give me some local variables */
  587.  
  588.                 ADDRESS *ad = &alias[num_addrs];
  589.  
  590.                 /* Set up default values */
  591.  
  592.                 ad->ad.Zone = Zone;        /* or alias[0].ad.Zone */
  593.                 ad->fakenet = pvtnet;    /* or alias[0].fakenet */
  594.                 ad->phone = BOSSphone;    /* or alias[0].phone */
  595.  
  596.                 /* Get the address zone:net/node.point@domain */
  597.  
  598.                 p = strtok(&temp[i], seperators);
  599.                 if(p)
  600.                 {
  601.                     parse_address(p, &ad->ad);
  602.                     if(!num_addrs && !Zone)            /* Make default zone */
  603.                         Zone = ad->ad.Zone;
  604.                     p = strtok(NULL, seperators);
  605.                 }
  606.                 else
  607.                     break;
  608.                     
  609.                 /* Optional Fakenet */
  610.                 
  611.                 if(p && isdigit(*p))
  612.                 {                        /* If there is any more */
  613.                     ad->fakenet = atoi(p);
  614.                     if(!num_addrs && (pvtnet != -1))    /* If this is the 1st pvtnet */
  615.                         pvtnet = ad->fakenet;            /* Then make it the default */
  616.                     p = strtok(NULL, seperators);        /* Get next word */
  617.                 }
  618.  
  619.                 /* Optional flag */
  620.                 
  621.                 if(p && (*p == '+'))                /* 4D character */
  622.                 {
  623.                     ad->flags.use4d = TRUE;
  624.                     p = strtok(NULL, seperators);
  625.                 }
  626.                 else if(p && (*p == '*'))            /* Use 2D for out net */
  627.                 {
  628.                     ad->flags.usenet = TRUE;
  629.                     p = strtok(NULL, seperators);
  630.                 }
  631.  
  632.                 /* Optional Boss address */
  633.                 
  634.                 if(p)
  635.                 {
  636.                     ad->phone = strdup(p);
  637.                     if(!BOSSphone && !num_addrs)        /* Make it the default */
  638.                         BOSSphone = ad->phone;
  639.                 }
  640. #ifdef DEBUG
  641.                 /* this will only get printed if debug is set first */
  642.                    sprintf(junk, ">Address: %s", Pretty_Addr_Str(&ad->ad));
  643.                 if(ad->fakenet != -1U)
  644.                     sprintf(&junk[strlen(junk)], ", Fakenet: %d", ad->fakenet);
  645.                 if(ad->phone)
  646.                     sprintf(&junk[strlen(junk)], ", BOSSphone: %s", ad->phone);
  647.                 status_line(junk);
  648. #endif                
  649.             }
  650.             ++num_addrs;
  651.             break;
  652.  
  653.         case C_Key:        /* Key [#alias] [%phone] [!password] [&poll_slot] address */
  654.             /*
  655.              * Note that the address statement with the
  656.              * alias must be defined first!
  657.              */
  658.  
  659.             {    /* Need local variables */
  660.  
  661.                 ADKEY *new = NULL;
  662.                 ADKEY newkey;    /* Temporary ADKEY */
  663.  
  664.                 memset(&newkey, 0, sizeof(ADKEY));    /* Initialise newkey */
  665.  
  666.                 
  667.                 for(p = strtok(&temp[3], seperators); p != NULL; p = strtok(NULL, seperators))
  668.                 {
  669.                   switch(*p)
  670.                   {
  671.                      case '#':    /* Our alias */
  672.                           {
  673.                             ADDR ad;
  674.                             ADDRESS *fullad;
  675.                     
  676.                             /* Search alias list for it! */
  677.                     
  678.                             if(!find_address(&p[1], &ad))    /* error */
  679.                                 break;
  680.                         
  681.                             fullad = alias;
  682.                              i = 0;
  683.                              while(i < num_addrs)
  684.                              {
  685.                                  if( (fullad->ad.Zone   == ad.Zone  ) &&
  686.                                      (fullad->ad.Net    == ad.Net   ) &&
  687.                                      (fullad->ad.Node   == ad.Node  ) &&
  688.                                      (fullad->ad.Point  == ad.Point ) &&
  689.                                      (fullad->ad.Domain == ad.Domain) )
  690.                                  {
  691.                                      newkey.alias = fullad;
  692.                                     break;
  693.                                  }
  694.                                  i++;
  695.                                  fullad++;
  696.                              }
  697.                              if(i == num_addrs)    /* Address was not found! */
  698.                              {
  699.                                 status_line(msgtxt[M_KEYWARN1], Pretty_Addr_Str(&ad));
  700.                                 status_line(msgtxt[M_KEYWARN2]);
  701.                                 break;
  702.                              }
  703.                            }
  704.                            break;
  705.                      
  706.  
  707.                     /*
  708.                       * Phone number:
  709.                      *
  710.                      * Format is: %[prefix/][number]
  711.                      *
  712.                      * e.g. %ATB1DT/012-345-67     ; prefix=ATB1DT, number=012-345-67
  713.                      *      %ATB1DT/            ; prefix=ATB1DT, number=default
  714.                      *      %012-345-67            ; prefix=default, number=012-345-67
  715.                      */
  716.  
  717.                     case '%':    /* prefix/number */
  718.                         p++;
  719.                         p1 = strchr(p, '/');    /* Seperator */
  720.                         if(p1)
  721.                         {
  722.                             *p1 = 0;
  723.                             newkey.prefix = ctl_string(p);
  724.                             p = p1+1;
  725.                         }
  726.                         if(*p)
  727.                             newkey.phone = ctl_string(p);
  728.                         break;
  729.  
  730.                     case '!':    /* Password */
  731.                         newkey.password = ctl_string(&p[1]);
  732.                         break;
  733.                     
  734.                     case '&':    /* Pollslot    */
  735.                         newkey.call_slot = p[1];
  736.                         break;
  737.                         
  738.                     default:    /* Node (with wildcards) */
  739.                         if(read_wild_ad(p, &newkey))
  740.                         {
  741.                             new = (ADKEY *) malloc(sizeof(ADKEY));    /* Make new structure */
  742.                             if(new)
  743.                             {
  744.                                 memcpy (new, &newkey, sizeof(ADKEY));
  745.                                 if(adkeys)
  746.                                 {
  747.                                     ADKEY *list = adkeys;    /* Tag it onto end of list */
  748.                                     while(list->next)
  749.                                         list = list->next;
  750.                                     list->next = new;
  751.                                 }
  752.                                 else
  753.                                     adkeys = new;
  754.                             }
  755.                         }
  756.                         break;
  757.                   }
  758.                 }
  759. #ifdef DEBUG
  760.                 sprintf(junk, ">KEY");
  761.                 if(newkey.alias)
  762.                     sprintf(&junk[strlen(junk)], " #%s", Pretty_Addr_Str(&newkey.alias->ad));
  763.                 if(newkey.prefix)
  764.                     sprintf(&junk[strlen(junk)], " prefix:%s,", newkey.prefix);
  765.                 if(newkey.phone)
  766.                     sprintf(&junk[strlen(junk)], " phone:%s,", newkey.phone);
  767.                 if(newkey.password)
  768.                     sprintf(&junk[strlen(junk)], " !%s", newkey.password);
  769.                 if(new)
  770.                     sprintf(&junk[strlen(junk)], " %s", Pretty_Addr_Str(&new->ad));
  771.                 else
  772.                     sprintf(&junk[strlen(junk)], "No address was specified!");
  773.                 status_line(junk);
  774. #endif
  775.             }
  776.  
  777.             break;
  778.  
  779.          case C_Hold:                                /* "Hold"          */
  780.             hold_area = ctl_slash_string (&temp[4]);
  781.             if(hold_area)    /* SWG: 20 July 1991 : Stop it bombing! */
  782.             {
  783.                 domain_area = strdup (hold_area);
  784.  
  785.                 domain_area[strlen (domain_area) - 1] = '\0';
  786.                 p = strrchr (domain_area, '\\');
  787.                 if (p == NULL)
  788.                 {
  789.                     p = strrchr (domain_area, '/');
  790.                        if (p == NULL)
  791.                     {
  792.                         p = strrchr (domain_area, ':');
  793.                           if(p == NULL)
  794.                             p = domain_area;
  795.                     }
  796.                 }
  797.                 if (p != domain_area)
  798.                     ++p;
  799.  
  800.                 domain_loc = p;
  801.                 *p = '\0';
  802.             }
  803.             break;
  804.  
  805.          case C_DownLoads:                                 /* "DownLoads"    */
  806.             download_path = ctl_slash_string (&temp[9]);
  807.             break;
  808.  
  809.          case C_NetFile:                               /* "NetFile"      */
  810.             DEFAULT.sc_Inbound = ctl_slash_string (&temp[7]);
  811.             break;
  812.  
  813.          case C_FirstInit:                                /* "FirstInit"          */
  814.             modem_firstinit = ctl_string (&temp[9]);
  815.             break;
  816.  
  817.          case C_Init:                                /* "Init"          */
  818.             modem_init = ctl_string (&temp[4]);
  819.             break;
  820.  
  821.          case C_Reset:                                /* "Reset"          */
  822.             modem_reset = ctl_string (&temp[5]);
  823.             break;
  824.  
  825.          case C_Busy:                                /* "Busy"          */
  826.             modem_busy = ctl_string (&temp[4]);
  827.             break;
  828.  
  829.          case C_Prefix:                               /* "Prefix"        */
  830.             predial = ctl_string (&temp[6]);
  831.             normprefix = predial;
  832.             break;
  833.  
  834.          case C_NodeList:                                /* "NodeList"      */
  835.             net_info = ctl_slash_string (&temp[8]);
  836.             break;
  837.  
  838.          case C_Fax:                                    /* "Fax"      */
  839.             fax_prg = ctl_string (&temp[3]);
  840.             break;
  841.  
  842.          case C_FaxInbound:                                /* "FaxInBound"      */
  843.             fax_inbound = ctl_slash_string (&temp[10]);
  844.             break;
  845.  
  846.          case C_AfterFax:                                /* "AfterFax"      */
  847.             afterfax_prg = ctl_string (&temp[8]);
  848.             break;
  849.  
  850.          case C_FaxConnect:                                /* "FaxConnect"      */
  851.             fax_connect = ctl_string (&temp[10]);
  852.             break;
  853.  
  854.          case C_BTNC:
  855.              nodeListType = BTNC;
  856.              break;
  857.              
  858.          case C_NodeCache:
  859.             c = skip_blanks (&temp[9]);
  860.             cacheSize = atoi(c);
  861.             break;
  862.  
  863.          case C_Avail:                                 /* "Avail"        */
  864.             DEFAULT.rq_FILES = ctl_string (&temp[5]);
  865.             break;
  866.  
  867.          case C_OKFile:                               /* "OKFile"        */
  868.             DEFAULT.rq_OKFile = ctl_string (&temp[6]);
  869.             break;
  870.  
  871.          case C_About:                                 /* "About"        */
  872.             DEFAULT.rq_About = ctl_string (&temp[5]);
  873.             break;
  874.  
  875.          case C_MailNote:                                /* "MAILnote"      */
  876.             MAILnote = ctl_string (&temp[8]);
  877.             break;
  878.  
  879.          case C_Banner:                               /* "Banner"        */
  880.             BBSbanner = ctl_string (&temp[6]);
  881.             break;
  882.  
  883.          case C_UnAttended:                               /* "UnAttended"    */
  884.             un_attended = 1;
  885.             command_line_un = 1;
  886.             break;
  887.  
  888.          case C_OverWrite:                                 /* "OverWrite"    */
  889.             overwrite = 1;
  890.             break;
  891.  
  892.          case C_ReqOnUs:                               /* "ReqOnUs"      */
  893.             on_our_nickel = 1;
  894.             c = skip_blanks(&temp[7]);
  895.             if(*c)
  896.                 add_to_strlist(&reqonus_list, c);
  897.             break;
  898.  
  899.          case C_LockBaud:                                /* "LockBaud"      */
  900.             c = skip_blanks (&temp[8]);         /* Skip to baud   */
  901.             if (*c)
  902.                lock_baud = (unsigned) (atoi (c));
  903.             if (!lock_baud)                     /* If none,       */
  904.                lock_baud = 1;                    /* Use a small no.*/
  905.  
  906.             break;
  907.  
  908.          case C_TimeOut:                               /* "TimeOut"      */
  909.             c = skip_blanks (&temp[7]);
  910.             BBStimeout = (unsigned) (atoi (c) * 100);
  911.             if (BBStimeout < 2000)
  912.                BBStimeout = 2000;
  913.             break;
  914.  
  915.          case C_NoSLO:                                 /* "NoSLO"        */
  916.             no_overdrive = 1;
  917.             break;
  918.  
  919.          case C_SlowModem:                                 /* "SlowModem"    */
  920.             slowmodem = 1;
  921.             break;
  922.  
  923.          case C_SmallWindow:                               /* "SmallWindow"  */
  924.             small_window = 1;
  925.             break;
  926.  
  927.          case C_NoPickup:                                /* "NoPickup"      */
  928.             no_pickup = 1;
  929.             break;
  930.  
  931.          case C_NoRequests:                               /* "NoRequests"    */
  932.             no_requests = 1;
  933.             break;
  934.  
  935.          case C_NetMail:                               /* "NetMail"      */
  936.             break;                                 /* for BTCTL & MAIL.SYS      */
  937.  
  938.          case C_Suffix:                               /* "Suffix"        */
  939.             postdial = ctl_string (&temp[6]);
  940.             normsuffix = postdial;
  941.             break;
  942.  
  943.          case C_NoFullScreen:                                /* "NoFullScreen" */
  944.             fullscreen = 0;
  945.             break;
  946.  
  947.          case C_SignalHandler:                            /* Install SignalHandler */
  948.              signalhandler = 1;
  949.              break;
  950.              
  951.          case C_AutoBaud:                                /* "AutoBaud"      */
  952.             autobaud = 1;
  953.             break;
  954.  
  955.          case C_Gong:                                /* "Gong"          */
  956.             gong_allowed = 1;
  957.             break;
  958.  
  959.          case C_NoCollide:                                 /* "NoCollide"    */
  960.             no_collide = 1;
  961.             break;
  962.  
  963.          case C_ExtrnMail:                                 /* "ExtrnMail"    */
  964.             c = skip_blanks (&temp[9]);
  965.             if (isdigit (*c))
  966.                {
  967.                lev_ext_mail[num_ext_mail] = atoi (c);
  968.                while ((*c) && (!isspace (*c)))
  969.                   ++c;
  970.                }
  971.             else
  972.                {
  973.                lev_ext_mail[num_ext_mail] = 99;
  974.                }
  975.             c = ctl_string(c);
  976.             if(c)
  977.             {
  978.                 ext_mail_string[num_ext_mail++] = c;
  979.                 while(*c)
  980.                     *c++ &= 0x7f;
  981.             }
  982.             break;
  983.  
  984.          case C_BBSNote:                               /* "BBSnote"      */
  985.             BBSnote = ctl_string (&temp[7]);
  986.             break;
  987.  
  988.          case C_BBS:                               /* "BBS"          */
  989.             BBSopt = ctl_string (&temp[3]);
  990.             break;
  991.  
  992.          case C_ScriptPath:                               /* "ScriptPath"    */
  993.             script_path = ctl_slash_string (&temp[10]);
  994.             break;
  995.  
  996.          case C_BoxType:                               /* "BoxType"      */
  997.             c = skip_blanks (&temp[7]);
  998.             boxtype = atoi (c);
  999.             if ((boxtype > 4) || (boxtype < 0))
  1000.                boxtype = 1;
  1001.             break;
  1002.  
  1003.          case C_Include:                               /* "Include"      */
  1004.             c = skip_blanks (&temp[7]);
  1005.             parse_config (c);
  1006.             break;
  1007.  
  1008.          case C_CaptureFile:                               /* "CaptureFile"  */
  1009.             logptr = ctl_string (&temp[11]);
  1010.             break;
  1011.  
  1012.          case C_CursorCol:                                 /* "CursorCol"    */
  1013.             c = skip_blanks (&temp[9]);
  1014.             cursor_col = atoi (c) - 1;
  1015.             if ((cursor_col < 0) || (cursor_col > 79))
  1016.                cursor_col = 79;
  1017.             break;
  1018.  
  1019.          case C_CursorRow:                                 /* "CursorRow"    */
  1020.             c = skip_blanks (&temp[9]);
  1021.             cursor_row = atoi (c) - 1;
  1022.             if ((cursor_row < 0) || (cursor_row > 23))
  1023.                cursor_row = 22;
  1024.             break;
  1025.  
  1026.          case C_DoingMail:                                 /* "DoingMail"    */
  1027.             c = skip_blanks (&temp[9]);
  1028.             noBBS = (char *) malloc(strlen(c) + 5);
  1029.             if(noBBS)
  1030.                 sprintf(noBBS, "\r\r%s\r\r", c);
  1031.             break;
  1032.  
  1033.          case C_EnterBBS:                                /* "EnterBBS"      */
  1034.             c = skip_blanks (&temp[8]);
  1035.             BBSesc = (char *) malloc(strlen(c) + 3);
  1036.             if(BBSesc)
  1037.                 sprintf(BBSesc, "\r%s\r", c);
  1038.             break;
  1039.  
  1040.          case C_PrivateNet:                               /* "PrivateNet"    */
  1041.             c = skip_blanks (&temp[10]);
  1042.             pvtnet = atoi (c);
  1043.             break;
  1044.  
  1045.          case C_Packer:                               /* "Packer"        */
  1046.             packer = ctl_string (&temp[6]);
  1047.             break;
  1048.  
  1049.          case C_Cleanup:                               /* "Cleanup"      */
  1050.             cleanup = ctl_string (&temp[7]);
  1051.             break;
  1052.  
  1053.          case C_AfterMail:                                 /* "AfterMail"    */
  1054.             aftermail = ctl_string (&temp[9]);
  1055.             break;
  1056.  
  1057.          case C_Colors:                               /* "Colors"        */
  1058.             c = skip_blanks (&temp[6]);
  1059.             colors.background = (unsigned char) (atoi (c) & 0xff);
  1060.             c = skip_to_blank (c);
  1061.             c = skip_blanks (c);
  1062.             colors.settings = (unsigned char) (atoi (c) & 0xff);
  1063.             c = skip_to_blank (c);
  1064.             c = skip_blanks (c);
  1065.             colors.history    = (unsigned char) (atoi (c) & 0xff);
  1066.             c = skip_to_blank (c);
  1067.             c = skip_blanks (c);
  1068.             colors.hold     = (unsigned char) (atoi (c) & 0xff);
  1069.             c = skip_to_blank (c);
  1070.             c = skip_blanks (c);
  1071.             colors.call     = (unsigned char) (atoi (c) & 0xff);
  1072.             c = skip_to_blank (c);
  1073.             c = skip_blanks (c);
  1074.             colors.file     = (unsigned char) (atoi (c) & 0xff);
  1075.             c = skip_to_blank (c);
  1076.             c = skip_blanks (c);
  1077.             colors.calling    = (unsigned char) (atoi (c) & 0xff);
  1078.             c = skip_to_blank (c);
  1079.             c = skip_blanks (c);
  1080.             colors.popup    = (unsigned char) (atoi (c) & 0xff);
  1081. #ifdef NEW /* COLORS  22.09.1989 */
  1082.             c = skip_blanks (c);
  1083.             c = skip_to_blank (c);
  1084.             colors.headers    = (unsigned char) (atoi (c) & 0xff);
  1085.             c = skip_blanks (c);
  1086.             c = skip_to_blank (c);
  1087.             colors.borders    = (unsigned char) (atoi (c) & 0xff);
  1088. #endif
  1089.             UseColors = TRUE;
  1090.             break;
  1091.  
  1092.          case C_JanusBaud:                                 /* "JanusBaud"    */
  1093.             c = skip_blanks (&temp[9]);
  1094.             janus_baud = (unsigned) atoi(c);
  1095.             break;
  1096.  
  1097.          case C_ReqTemplate:                               /* "ReqTemplate"  */
  1098.             DEFAULT.rq_Template = ctl_string (&temp[11]);
  1099.             break;
  1100.  
  1101.          case C_KnownAvail:                               /* "KnownAvail"    */
  1102.             KNOWN.rq_FILES = ctl_string(&temp[10]);
  1103.             break;
  1104.  
  1105.          case C_KnownReqList:                                /* "KnownReqList" */
  1106.             KNOWN.rq_OKFile = ctl_string(&temp[12]);
  1107.             break;
  1108.  
  1109.          case C_KnownAbout:                               /* "KnownAbout"    */
  1110.             KNOWN.rq_About = ctl_string (&temp[10]);
  1111.             break;
  1112.  
  1113.          case C_KnownInbound:                                /* "KnownInbound" */
  1114.             KNOWN.sc_Inbound = ctl_slash_string (&temp[12]);
  1115.             break;
  1116.  
  1117.          case C_KnownReqLim:                               /* "KnownReqLim"  */
  1118.             c = skip_blanks (&temp[11]);
  1119.             KNOWN.rq_Limit = atoi (c);
  1120.             break;           
  1121.  
  1122.          case C_KnownReqTpl:                               /* "KnownReqTpl"  */
  1123.             KNOWN.rq_Template = ctl_string (&temp[11]);
  1124.             break;
  1125.  
  1126.          case C_ProtAvail:                                 /* "ProtAvail"   */
  1127.             PROT.rq_FILES = ctl_string(&temp[9]);
  1128.             break;
  1129.  
  1130.          case C_ProtReqList:                               /* "ProtReqList" */
  1131.             PROT.rq_OKFile = ctl_string(&temp[11]);
  1132.             break;
  1133.  
  1134.          case C_ProtAbout:                                 /* "ProtAbout"   */
  1135.             PROT.rq_About = ctl_string (&temp[9]);
  1136.             break;
  1137.  
  1138.          case C_ProtInbound:                               /* "ProtInbound" */
  1139.             PROT.sc_Inbound = ctl_slash_string (&temp[11]);
  1140.             break;
  1141.  
  1142.          case C_ProtReqLim:                               /* "ProtReqLim"  */
  1143.             c = skip_blanks (&temp[10]);
  1144.             PROT.rq_Limit = atoi (c);
  1145.             break;           
  1146.  
  1147.          case C_ProtReqTpl:                               /* "ProtReqTpl"  */
  1148.             PROT.rq_Template = ctl_string (&temp[10]);
  1149.             break;
  1150.  
  1151.          case C_Application:                               /* "Application" */
  1152.             break;
  1153.  
  1154.          case C_NoZones:                               /* "NoZones"     */
  1155.             no_zones = 1;
  1156.             break;
  1157.  
  1158.          case C_Answer:                               /* "Answer"         */
  1159.             ans_str = ctl_string (&temp[6]);
  1160.             break;
  1161.  
  1162.          case C_PollTries:                                 /* "PollTries"   */
  1163.             c = skip_blanks (&temp[9]);
  1164.             poll_tries = atoi (c);
  1165.             break;
  1166.  
  1167.         case C_PollDelay:                            /* PollDelay */
  1168.             c = skip_blanks(&temp[9]);
  1169.             poll_delay = atoi(c);                /* Specify in 10th of a second */
  1170.             break;
  1171.  
  1172.          case C_CurMudgeon:                               /* "Curmudgeon"  */
  1173.             ++curmudgeon;                        /* Do it like Randy */
  1174.             break;
  1175.  
  1176.          case C_NoWaZOO:                               /* "NoWaZOO"     */
  1177.             ++no_WaZOO;                         /* FTSC sessions */
  1178.             break;
  1179.  
  1180.         case C_NoEMSI:
  1181.             no_EMSI = TRUE;
  1182.             c = skip_blanks(&temp[6]);
  1183.             if(*c)
  1184.                 add_to_strlist(&emsi_list, c);
  1185.             break;
  1186.  
  1187.         case C_NoRequest:
  1188.             no_REQUEST = TRUE;
  1189.             c = skip_blanks(&temp[6]);
  1190.             if(*c)
  1191.                 add_to_strlist(&request_list, c);
  1192.             break;
  1193.             
  1194.         case C_NoJanus:
  1195.             no_JANUS = TRUE;
  1196.             c = skip_blanks(&temp[7]);
  1197.             if(*c)
  1198.                 add_to_strlist(&janus_list, c);
  1199.             break;
  1200.         case C_IOS:
  1201.         case C_Hold4D:
  1202.             iosmode = TRUE;
  1203.             break;
  1204.         case C_UseCallSlots:                                /* If true, then use CallSlots instead of Cost */
  1205.             usecallslots = TRUE;
  1206.             break;
  1207.         case C_FDBugfix:
  1208.             FDBugfix = TRUE;
  1209.             break;
  1210.          case C_ScreenBlank:                               /* "ScreenBlank" */
  1211.             do_screen_blank = 1;
  1212.             p = skip_blanks (&temp[11]);
  1213.             if (strnicmp (p, msgtxt[M_KEY], 3) == 0)
  1214.                {
  1215.                blank_on_key = 1;
  1216.                }
  1217.             else if (strnicmp (p, msgtxt[M_CALL], 4) == 0)
  1218.                {
  1219.                blank_on_key = 0;
  1220.                }
  1221.             break;
  1222.  
  1223.          case C_Mark_Kromm:                               /* "Mark_Kromm"  */
  1224.  
  1225.             /* These colors from Mark Kromm, Fidonet 1:261/1034  */
  1226.  
  1227.             colors.background = 112;            /* The             */
  1228.             colors.settings   =   9;            /* Great         */
  1229.             colors.history      =  10;            /* BinkleyTerm     */
  1230.             colors.hold       =  11;            /* Colors         */
  1231.             colors.call       =  14;            /* Contest         */
  1232.             colors.file       =  12;            /* Winner!!!!     */
  1233.             colors.calling      =  56;
  1234.             colors.popup      =  15;
  1235.             UseColors = TRUE;
  1236.             break;
  1237.  
  1238.          case C_Server:                               /* "Server"       */
  1239.             server_mode = 1;
  1240.             break;
  1241.  
  1242.          case C_ModemTrans:                              /* "ModemTrans"  */
  1243.             p = &temp[10];
  1244.             while ((*p) && (isspace (*p)))
  1245.                ++p;
  1246.  
  1247.             if ((*p == ';') || (*p == '\0'))
  1248.                {
  1249.                break;
  1250.                }
  1251.  
  1252.             tmm = (MDM_TRNS *) malloc (sizeof (MDM_TRNS));
  1253.  
  1254.             tmm->mdm = (byte) atoi (p);
  1255.             while ((*p) && (!isspace (*p)))
  1256.                {
  1257.                p++;
  1258.                }
  1259.  
  1260.             while ((*p) && (isspace (*p)))
  1261.                {
  1262.                ++p;
  1263.                }
  1264.  
  1265.             p1 = tmm->pre;
  1266.             while ((*p) && (*p != '/') && (!isspace (*p)))
  1267.                {
  1268.                *p1++ = *p++;
  1269.                }
  1270.             *p1 = '\0';
  1271.  
  1272.             p1 = tmm->suf;
  1273.             if ((*p == '\0') || (isspace (*p)))
  1274.                {
  1275.                *p1 = '\0';
  1276.                }
  1277.             else
  1278.                {
  1279.                ++p;
  1280.  
  1281.                while ((*p) && (!isspace (*p)))
  1282.                   {
  1283.                   *p1++ = *p++;
  1284.                   }
  1285.                *p1 = '\0';
  1286.                }
  1287.  
  1288.             tmm->next = NULL;
  1289.             if (mm_head == NULL)
  1290.                {
  1291.                mm_head = tmm;
  1292.                }
  1293.             else
  1294.                {
  1295.                mm->next = tmm;
  1296.                }
  1297.             mm = tmm;
  1298.             break;
  1299.  
  1300.          case C_PreDial:                              /* "PreDial" */
  1301.             dial_setup = ctl_string (&temp[7]);
  1302.             break;
  1303.  
  1304.          case C_PreInit:                              /* "PreInit" */
  1305.             init_setup = ctl_string (&temp[7]);
  1306.             break;
  1307.  
  1308.          case C_DTRHigh:                              /* "DTRHigh" */
  1309.             leave_dtr_high = 1;
  1310.             break;
  1311.  
  1312.          case C_Debug:                                /* "Debug" */
  1313.             debugging_log = 1;      /* !debugging_log; */
  1314.             break;
  1315.  
  1316.          case C_NoZedZap:                               /* "NoZedZap" */
  1317.             no_zapzed = !no_zapzed;
  1318.             break;
  1319.  
  1320.          case C_NoResync:                               /* "NoResync" */
  1321.             no_resync = !no_resync;
  1322.             break;
  1323.  
  1324.          case C_NoSEAlink:                                /* "NoSEAlink" */
  1325.             no_sealink = !no_sealink;
  1326.             break;
  1327.  
  1328.          case C_FTS_0001:                               /* "FTS-0001" */
  1329.             no_sealink = 1;
  1330.             no_resync = 1;
  1331.             no_overdrive = 1;
  1332.             ++no_WaZOO;                         /* FTSC sessions */
  1333.             no_EMSI = TRUE;
  1334.             break;
  1335.  
  1336.          case C_LineUpdate:                              /* "LineUpdate" */
  1337.             immed_update = !immed_update;
  1338.             break;
  1339.  
  1340.          case C_JanusOK:                              /* "JanusOK"        */
  1341.             p = &temp[7];
  1342.             while ((*p) && (isspace (*p)))
  1343.                ++p;
  1344.  
  1345.             if ((*p == ';') || (*p == '\0'))
  1346.                {
  1347.                break;
  1348.                }
  1349.  
  1350.             tjt = (J_TYPES *) malloc (sizeof (J_TYPES));
  1351.  
  1352.             p1 = tjt->j_match;
  1353.             while ((*p) && (!isspace (*p)))
  1354.                {
  1355.                *p1++ = *p++;
  1356.                }
  1357.             *p1 = '\0';
  1358.  
  1359.             tjt->next = NULL;
  1360.             if (j_top == NULL)
  1361.                {
  1362.                j_top = tjt;
  1363.                }
  1364.             else
  1365.                {
  1366.                j_next->next = tjt;
  1367.                }
  1368.             j_next = tjt;
  1369.             break;
  1370.  
  1371.          case C_TermInit:                               /* "TermInit"     */
  1372.             term_init = ctl_string (&temp[8]);
  1373.             break;
  1374.  
  1375.         case C_Domain:                              /* "Domain"       */
  1376.             p = skip_blanks (&temp[6]);
  1377.             p = strtok (p, seperators);
  1378.             if (p != NULL)
  1379.             {
  1380.                 /* Have the domain name, now get the abbreviated name */
  1381.                    p2 = strtok (NULL, seperators);
  1382.                 if(p2)
  1383.                    {
  1384.  
  1385.                        if (strlen (p2) > 8)        /* Limit it to 8 characters */
  1386.                           p2[8] = '\0';
  1387.  
  1388.                       /* Have the domain name and abbreviated, now get the list name */
  1389.  
  1390.                       p1 = strtok (NULL, seperators);
  1391.                       if (p1 == NULL)
  1392.                         p1 = p2;
  1393.  
  1394.                     {
  1395.                         char *d = find_domain(p);
  1396.                         
  1397.                         for(i = 0; domain_name[i]; i++)
  1398.                         {
  1399.                             if(d && (d == domain_name[i]))
  1400.                                 break;
  1401.                         }
  1402.                         if(i < (MAXDOMAIN-1))
  1403.                         {
  1404.                             if(!domain_name[i])
  1405.                                 domain_name[i] = strlwr(strdup(p));
  1406.                             domain_nodelist[i] = strlwr(strdup(p1));
  1407.                             domain_abbrev[i] = strlwr(strdup(p2));
  1408.                         }
  1409.                     }
  1410.  
  1411.                }
  1412.  
  1413.             }
  1414.             break;
  1415.  
  1416.          case C_Flags:                                 /* "Flags"        */
  1417.             flag_dir = ctl_slash_string (&temp[5]);
  1418.             break;
  1419.  
  1420.          case C_TaskNumber:                               /* "Tasknumber"    */
  1421.             c = skip_blanks (&temp[10]);
  1422.             TaskNumber = atoi (c);
  1423.             break;
  1424.  
  1425.          case C_MaxBytes:                                /* "MaxBytes"      */
  1426.             c = skip_blanks (&temp[8]);
  1427.             DEFAULT.byte_Limit = atol (c);
  1428.             break;
  1429.  
  1430.          case C_KnownMaxBytes:                                 /* "KnownMaxBytes"*/
  1431.             c = skip_blanks (&temp[13]);
  1432.             KNOWN.byte_Limit = atol (c);
  1433.             break;
  1434.  
  1435.          case C_ProtMaxBytes:                                /* "ProtMaxBytes" */
  1436.             c = skip_blanks (&temp[12]);
  1437.             PROT.byte_Limit = atol (c);
  1438.             break;
  1439.  
  1440.          case C_MaxTime:                                    /* "MaxTime"      */
  1441.             c = skip_blanks (&temp[8]);
  1442.             DEFAULT.time_Limit = atoi (c);
  1443.             break;
  1444.  
  1445.          case C_KnownMaxTime:                                /* "KnownMaxTime"*/
  1446.             c = skip_blanks (&temp[13]);
  1447.             KNOWN.time_Limit = atoi (c);
  1448.             break;
  1449.  
  1450.          case C_ProtMaxTime:                                /* "ProtMaxTime" */
  1451.             c = skip_blanks (&temp[12]);
  1452.             PROT.time_Limit = atoi (c);
  1453.             break;
  1454.  
  1455.         case C_NoLineA:                                /* NoLineA, force use of VT52 */
  1456.             nolinea = TRUE;
  1457.             break;
  1458. #ifdef BIOSDISPLAY
  1459.         case C_BIOSdisplay:
  1460.             BIOSdisplay = TRUE;
  1461.             break;
  1462. #endif
  1463.         case C_UseColors:
  1464.             UseColors = TRUE;
  1465.             break;
  1466.         case C_IKBDclock:                                /* ikbdclock, enable IKBD update */
  1467.             ikbdclock = TRUE;
  1468.             break;
  1469.         case C_NoCTS:                                /* nocts */
  1470.             ctsflow = 0;
  1471.             break;
  1472.         case C_HardCTS:                                /* USe hardware CTS control */
  1473.             HardCTS = TRUE;
  1474.             break;
  1475.         case C_STlockBaud:                                /* STlockBaud */
  1476.             c = skip_blanks (&temp[10]);        /* Skip to baud   */
  1477.             if (*c)
  1478.                st_lock_baud = (unsigned) (atoi (c));
  1479.             if (!st_lock_baud)                     /* If none,       */
  1480.                st_lock_baud = 1;                 /* Use a small no.*/
  1481.             break;
  1482.         case C_SlowJanus:                                /* SlowJanus */
  1483.             slowjanus = TRUE;
  1484.             break;
  1485.         case C_Hard38400:
  1486.             hard_38400 = TRUE;
  1487.             break;
  1488.         case C_RSVEBoard:
  1489.             rsve_board = TRUE;
  1490.             break;
  1491.         case C_Rbuf:
  1492.             c = skip_blanks(&temp[4]);
  1493.             if(*c)
  1494.                 rBufSize = atoi(c);
  1495.             break;
  1496.         case C_Tbuf:
  1497.             c = skip_blanks(&temp[4]);
  1498.             if(*c)
  1499.                 tBufSize = atoi(c);
  1500.             break;
  1501.         case C_TZ:                                            /* Timezone */
  1502.             time_zone = ctl_string (&temp[8]);
  1503.             break;
  1504.          case C_NiceOutbound: /* 09.09.1990 */                /* "NiceOutbound" */
  1505.             niceoutbound = 1;            /* not niceoutbound++  !!! */
  1506.             break;
  1507.          case C_ReInitTime:   /* 14.11.89 */              /* "ReInitTime"  */
  1508.             c = skip_blanks (&temp[10]);
  1509.             reinit_time = atoi (c);
  1510.             if ((reinit_time <= 0) || (reinit_time > 15))
  1511.                reinit_time = 10;
  1512.             reinit_ctr = reinit_time;
  1513.             break;
  1514.          case C_ReadHoldTime: /* 10.11.89 */                /* "ReadHoldTime" */
  1515.             c = skip_blanks (&temp[12]);
  1516.             readhold_time = atoi (c);
  1517.             if ((readhold_time <= 0) || (readhold_time> 1440))
  1518.                readhold_time = 30;
  1519.             readhold_ctr = readhold_time;
  1520.             break;
  1521.         case C_HoldsOnUs:    /* SWG 5th August */        /* "HoldsOnUs */
  1522.             HoldsOnUs = TRUE;
  1523.             c = skip_blanks(&temp[9]);
  1524.             if(*c)
  1525.                 add_to_strlist(&hold_list, c);
  1526.             break;
  1527.         case C_SendRSP:        /* SWG 10th August */        /* SendRSP */
  1528.             SendRSP = TRUE;
  1529.             break;
  1530. #if defined(__PUREC__) || defined(__TURBOC__)
  1531.         case C_CLIcommand:    /* SWG 12th November 1991 */
  1532.             c = skip_blanks(&temp[10]);
  1533.             useCLIcommand = TRUE;
  1534.             if(*c)
  1535.                 CLIcommand = strdup(c);
  1536.             break;
  1537. #endif
  1538. #if 0
  1539.          case C_CostLog:                               /* "CostLog"    */
  1540.             cost_log_name = ctl_string (&temp[7]);
  1541.             if ((cost_log = fopen (cost_log_name, "a")) == NULL)
  1542.                {
  1543.                free (cost_log_name);
  1544.                cost_log_name = NULL;
  1545.                }
  1546.             break;
  1547.  
  1548.          case C_NoWildcards:   /* 12.11.89 */               /* "NoWildcards" */
  1549.             no_wildcards++;
  1550.             break;
  1551.  
  1552.          case C_SuckerLimit:   /* 11.12.89 */               /* "SuckerLimit" */
  1553.             c = skip_blanks (&temp[11]);
  1554.         if ((toupper(*c) >= 'A') && (toupper(*c) <= 'F'))
  1555.            SuckerFlag = 1 << (toupper(*c) - 55);
  1556.             c = skip_to_blank (c);
  1557.             SuckerTimeLimit = atoi (c);
  1558.             if ((SuckerTimeLimit <= 0) || (SuckerTimeLimit > 1439))
  1559.                SuckerTimeLimit = 1439;
  1560.             break;
  1561.  
  1562.          case C_hstls2400c: /* 22.11.89 */                  /* "hstls2400c" */
  1563.             hstls2400c++;
  1564.             break;
  1565.  
  1566.          case C_CostUnit: /* 28.01.90 */                /* "CostUnit" */
  1567.             c = skip_blanks (&temp[8]);
  1568.             cost_unit = atoi (c);
  1569.             break;
  1570.  
  1571. #endif    /* 0 */
  1572.  
  1573.          case C_Tranx:                                    /* Tranx node */
  1574.             c = skip_blanks(&temp[5]);
  1575.             if(*c)
  1576.                 add_to_strlist(&tranx_list, c);
  1577.             break;
  1578.  
  1579. bad_line:
  1580.          default:
  1581.             (void) printf (msgtxt[M_UNKNOWN_LINE], temp);
  1582.          }
  1583.       }
  1584.    (void) fclose (stream);                                /* close input file          */
  1585.  
  1586.    if (debugging_log)
  1587.       loglevel = 6;
  1588. }
  1589.  
  1590. char *ctl_string( char *source )                         /* malloc & copy to ctl      */
  1591. {
  1592.    char *c;
  1593.  
  1594.    c = skip_blanks (source);                     /* get over the blanks       */
  1595.     if(*c)    /* Avoid 0 length strings */
  1596.         return strdup(c);
  1597.     else
  1598.         return NULL;
  1599. }
  1600.  
  1601. static char *ctl_slash_string( char *source )             /* malloc & copy to ctl      */
  1602. {
  1603.    char *dest, *c;
  1604.    size_t i;
  1605.    struct stat buffer;
  1606.     int val;
  1607.  
  1608.    c = skip_blanks (source);                     /* get over the blanks       */
  1609.    i = strlen (c);                                 /* get length of remainder   */
  1610.    if (i < 1)                                     /* must have at least 1      */
  1611.       return (NULL);                             /* if not, return NULL       */
  1612.    dest = (char *) malloc (i + 2);                 /* allocate space for string */
  1613.    if (dest == NULL)                             /* If we failed to get it,   */
  1614.       return (NULL);                             /* Just return NULL          */
  1615.    strcpy (dest, c);                             /* copy the stuff over       */
  1616.    delete_backslash (dest);                      /* get rid of trailing stuff */
  1617.  
  1618.    /* See if its a root directory, e.g. m: */
  1619.  
  1620.    if((strlen(dest) == 3) && (dest[2] == '\\') && (dest[1] == ':'))
  1621.    {
  1622.      long map;
  1623.      int drv;
  1624.      
  1625.      map = Dsetdrv(Dgetdrv());
  1626.      drv = toupper(dest[0]) - 'A';
  1627.      if((drv < 0) || (drv >= 16) || !(map & (1 << drv)))
  1628.         goto error;
  1629.    }
  1630.    else
  1631.    {
  1632.        /* Check to see if the directory exists */
  1633.  
  1634.        val = stat (dest, &buffer);
  1635.  
  1636.         if(val)
  1637.         {
  1638.             /* Try and create a directory */
  1639.         
  1640.             if(mkdir(dest) == 0)
  1641.             {
  1642.                 printf(msgtxt[M_CREATED_DIR], dest);
  1643.                   printf("\n");
  1644.             }
  1645.             else
  1646.             {
  1647.                   printf (msgtxt[M_BAD_DIR], dest);
  1648.                 printf ("\n%s\n", msgtxt[M_NO_CREATE_DIR]);
  1649.                   printf (msgtxt[M_FAIL_EXEC]);
  1650.                   return(NULL);
  1651.             }
  1652.         }
  1653.         else
  1654.         if(!(buffer.st_mode & S_IFDIR))        /* We found it but it wasnt a directory */
  1655.        {
  1656.        error:
  1657.               printf (msgtxt[M_BAD_DIR], dest);
  1658.               printf ("\n%s", msgtxt[M_FAIL_EXEC]);
  1659.               return(NULL);
  1660.        }
  1661.     }
  1662.    (void) add_backslash (dest);                         /* add the backslash         */
  1663.    return (dest);                                 /* return the directory name */
  1664. }
  1665.  
  1666.  
  1667. char *add_backslash( char *str )
  1668. {
  1669.    char           *p;
  1670.  
  1671.    p = str + strlen (str) - 1;
  1672.  
  1673.    if (p >= str)
  1674.       {
  1675.       /* Strip off the trailing blanks */
  1676.       while ((p >= str) && *p && (isspace (*p)))
  1677.          {
  1678.          *p = '\0';
  1679.          --p;
  1680.          }
  1681.  
  1682.       /* Put a backslash if there isn't one */
  1683.       if ((p >=str) && (*p != '\\') && (*p != '/'))
  1684.          {
  1685.          *(++p) = '\\';
  1686.          *(++p) = '\0';
  1687.          }
  1688.       }
  1689.  
  1690.    return (fancy_str (str));
  1691. }
  1692.  
  1693. char *delete_backslash (char *str)
  1694. {
  1695.    char           *p;
  1696.  
  1697.    p = str + strlen (str) - 1;
  1698.  
  1699.    if (p >= str)
  1700.       {
  1701.       /* Strip off the trailing blanks */
  1702.       while ((p >= str) && *p && (isspace (*p)))
  1703.          {
  1704.          *p = '\0';
  1705.          --p;
  1706.          }
  1707.  
  1708.       /* Get rid of backslash if there is one */
  1709.       if ((p >=str) && ((*p == '\\') || (*p == '/')))
  1710.          {
  1711.          if ((p > str) && (*(p-1) != ':'))        /* Don't delete on root */
  1712.             *p = '\0';
  1713.          }
  1714.       }
  1715.  
  1716.    return (fancy_str (str));
  1717. }
  1718.  
  1719. void exit_port(void)
  1720. {
  1721.     if (ST_altport>=6 && ST_altport<=9)
  1722.         Bconmap (ST_altport);
  1723. }
  1724.