/*--------------------------------------------------------------------------*/ /* */ /* */ /* ------------ Bit-Bucket Software, Co. */ /* \ 10001101 / Writers and Distributors of */ /* \ 011110 / Freely Available Software. */ /* \ 1011 / */ /* ------ */ /* */ /* (C) Copyright 1987-96, Bit Bucket Software Co. */ /* */ /* This module was written by Vince Perriello */ /* */ /* BinkleyTerm Configuration File Parser */ /* */ /* */ /* For complete details of the licensing restrictions, please refer */ /* to the License agreement, which is published in its entirety in */ /* the MAKEFILE and BT.C, and also contained in the file LICENSE.260. */ /* */ /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */ /* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */ /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */ /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */ /* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */ /* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */ /* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */ /* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */ /* */ /* */ /* You can contact Bit Bucket Software Co. at any one of the following */ /* addresses: */ /* */ /* Bit Bucket Software Co. FidoNet 1:104/501, 1:343/491 */ /* P.O. Box 460398 AlterNet 7:42/1491 */ /* Aurora, CO 80046 BBS-Net 86:2030/1 */ /* Internet f491.n343.z1.fidonet.org */ /* */ /* Please feel free to contact us at any time to share your comments about */ /* our software and/or licensing policies. */ /* */ /*--------------------------------------------------------------------------*/ /* Include this file before any other includes or defines! */ #include "includes.h" char *ctl_slash_string (char *); static word Zone = 1; void cfg_macro (char *); void cfg_dial_string (char *); void cfg_alt_num (char *); void cfg_mdm_trans (char *); void cfg_domain (char *); void cfg_Janus (char *); void cfg_domain_kludge (char *); #ifdef BINKLEY_SOUNDS char *cfg_sound (char *); #endif void parse_config (char *config_file) { FILE *stream; char temp[256]; char *c; int i; long ltemp; char *p; ADDR temp_addr; /* Used to get address */ (void) sprintf (temp, "%s%s", BINKpath, config_file); if ((stream = share_fopen (temp, read_ascii, DENY_WRITE)) == NULL) /* OK, let's open the file */ return; /* no file, no work to do */ while ((fgets (temp, 255, stream)) != NULL) /* Now we parse the file ... */ { c = temp; /* Check out the first char */ if ((*c == '%') || (*c == ';')) /* See if it's a comment * line */ continue; i = (int) strlen (temp);/* how long this line is */ if (i < 3) continue; /* If too short, ignore it */ c = &temp[--i]; /* point at last character */ if (*c == '\n') /* if it's a newline, */ *c = '\0'; /* strip it off */ if ((i = parse (temp, config_lines)) != 0) { c = &temp[(config_lines[i - 1]).p_length]; } switch (i) { case 1: /* "SameRing" */ /* This modem doesn't differentiate between RING and RINGING */ def_mdm_resps[2].disp = IGNORE; break; case 2: /* "NewNodeList" */ case 129: /* "Version6" */ newnodelist = 1; break; case 3: /* "QuickNodeList" */ #ifdef QUICK_LIST nodefunc = QuickLookup; newnodelist = 0; #endif break; case 4: /* "Answerback" */ answerback = ctl_string (c); break; case 5: /* "Macro" */ cfg_macro (c); break; case 6: /* "Shell" */ c = skip_blanks (c); i = atoi (c); if ((i <= 0) || (i > 9)) { (void) printf ("%s %d %s\n", MSG_TXT (M_SHELL_NUMBER), i, MSG_TXT (M_OUT_OF_RANGE)); break; } c = skip_to_blank (c); c = skip_blanks (c); shells[i - 1] = calloc (1, strlen (c) + 1); (void) strcpy (shells[i - 1], c); (void) strupr (shells[i - 1]); break; case 7: /* "Dial" */ cfg_dial_string (c); break; case 8: /* "Event" */ c = skip_blanks (c); (void) parse_event (c); break; case 9: /* "Zone" */ c = skip_blanks (c); Zone = (word) atoi (c); if (!Zone) /* if we didn't find a zone */ (void) printf (MSG_TXT (M_ILLEGAL_ZONE), &temp[4]); break; case 10: /* "MaxReq" */ (void) sscanf (c, "%d %d", &DEFAULT.rq_Limit, &DEFAULT.rq_Cum_Limit); if (!DEFAULT.rq_Limit) /* No requests??? */ (void) printf ("0 %s\n", MSG_TXT (M_REQUESTS_ALLOWED)); break; case 11: /* "LogLevel" */ c = skip_blanks (c); i = atoi (c); if ((i <= 5) && (i > 0)) { loglevel = i; } else { (void) printf (MSG_TXT (M_BAD_LOGLEVEL), &temp[8]); } break; case 12: /* "Baud" */ ltemp = atol (c); max_baud.rate_value = 0; for (i = 0; pbtypes[i].rate_value; i++) { if (pbtypes[i].rate_value == (unsigned long)ltemp) { max_baud.rate_mask = pbtypes[i].rate_mask; max_baud.rate_value = ltemp; break; } } if (!max_baud.rate_value) goto bad_line; break; case 13: /* "MaxPort" */ c = skip_blanks (c); i = atoi (c); /* make it binary */ if ((i > 0) && (i < 33)) /* if range is reasonable, */ MAXport = i; /* Make it the max value */ else (void) printf (MSG_TXT (M_BAD_MAXPORT), &temp[7]); break; case 14: /* "Port" */ c = skip_blanks (c); i = atoi (c); /* make it binary */ if ((i > 0) || (i < 33)) /* see if it's OK */ { port_ptr = i - 1; /* store it if so */ if (MAXport < i) /* See if MAXport is less */ MAXport = i; /* If so, increase MAXport */ original_port = port_ptr; } else (void) printf (MSG_TXT (M_ILLEGAL_PORT), &temp[4]); break; case 15: /* "Carrier" */ c = skip_blanks (c); i = 0; (void) sscanf (c, "%x", &i);/* convert it to binary */ if (i != 0) /* if we got anything */ carrier_mask = (unsigned int) i; else (void) printf (MSG_TXT (M_ILLEGAL_CARRIER), &temp[7]); break; case 16: /* "StatusLog" */ log_name = ctl_string (c); if ((status_log = share_fopen (log_name, append_ascii, DENY_WRITE)) == NULL) { free (log_name); log_name = NULL; } else { (void) fprintf (status_log, "\n"); (void) fflush (status_log); (void) real_flush (fileno (status_log)); } break; case 17: /* "Reader" */ BBSreader = ctl_string (c); break; case 18: /* "BossPhone" */ BOSSphone = ctl_string (c); break; case 19: /* "BossPwd" */ BOSSpwd = ctl_string (c); break; case 20: /* "Protocol" */ if (extern_index == 5) break; protocols[extern_index++] = ctl_string (c); break; case 21: /* "System" */ system_name = ctl_string (c); break; case 22: /* "Sysop" */ sysop = ctl_string (c); break; case 23: /* "Boss" */ c = skip_blanks (c); (void) parse_address (c, &boss_addr); break; case 24: /* "Point" */ case 25: /* "Aka" */ case 94: /* "Address" */ c = skip_blanks (c); if (num_addrs == 0) alias[0].Zone = Zone; (void) parse_address (c, &temp_addr); alias[num_addrs] = temp_addr; Zone = alias[0].Zone; /* First is real default */ ++num_addrs; break; case 26: /* "Hold" */ hold_area = ctl_slash_string (c); if (hold_area == NULL) break; domain_area = strdup (hold_area); domain_area[strlen (domain_area) - 1] = '\0'; p = strrchr (domain_area, '\\'); if (p == NULL) { p = strrchr (domain_area, '/'); if (p == NULL) { p = strrchr (domain_area, ':'); if (p == NULL) p = domain_area; } } if (p != domain_area) ++p; domain_loc = p; *p = '\0'; break; case 27: /* "DownLoads" */ download_path = ctl_slash_string (c); break; case 28: /* "NetFile" */ DEFAULT.sc_Inbound = ctl_slash_string (c); break; case 29: /* "Init" */ modem_init = ctl_string (c); break; case 30: /* "Busy" */ modem_busy = ctl_string (c); break; case 31: /* "Prefix" */ predial = ctl_string (c); normprefix = predial; break; case 32: /* "NodeList" */ net_info = ctl_slash_string (c); break; case 33: /* "Avail" */ DEFAULT.rq_FILES = ctl_string (c); break; case 34: /* "OKFile" */ DEFAULT.rq_OKFile = ctl_string (c); break; case 35: /* "About" */ DEFAULT.rq_About = ctl_string (c); break; case 36: /* "MAILnote" */ MAILnote = ctl_string (c); break; case 37: /* "Banner" */ BBSbanner = ctl_string (c); break; case 38: /* "UnAttended" */ un_attended = 1; command_line_un = 1; break; case 39: /* "OverWrite" */ overwrite = 1; break; case 40: /* "Rev3" */ rev3 = 1; break; case 41: /* "ReqOnUs" */ on_our_nickel = 1; break; case 42: /* "LockBaud" */ c = skip_blanks (c);/* Skip to baud */ if (*c == '\0') /* Case 1: no arg */ { lock_baud = 1; /* Always lock */ break; } if (isdigit (*c)) /* Case 2: baud */ { lock_baud = atol (c); /* Lock at >= baud*/ break; } i = 1 + strlen (c); /* Case 3: ARQ */ if (ARQs > 16) /* Only 16 allowed*/ break; p = calloc (1, i); /* Allocate space */ if (p == NULL) /* Give up if none*/ break; (void) strcpy (p, c); /* Copy ARQ string*/ ARQ[ARQs++] = p; /* Update array */ break; case 43: /* "TimeOut" */ c = skip_blanks (c); BBStimeout = (unsigned) (atoi (c) * 100); if (BBStimeout < 2000) BBStimeout = 2000; break; case 44: /* "NoSLO" */ no_overdrive = 1; break; case 45: /* "SlowModem" */ slowmodem = 1; break; case 46: /* "SmallWindow" */ small_window = 1; break; case 47: /* "NoPickup" */ no_pickup = 1; break; case 48: /* "NoRequests" */ no_requests = 1; break; case 49: /* "NetMail" */ c = skip_blanks (c); if (*c != '$') netmail = ctl_slash_string (c); else netmail = ctl_string (c); break; case 50: /* "Suffix" */ postdial = ctl_string (c); normsuffix = postdial; break; case 51: /* "NoFullScreen" */ fullscreen = 0; break; case 52: /* "AutoBaud" */ autobaud = 1; break; case 53: /* "Gong" */ gong_allowed = 1; break; case 54: /* "NoCollide" */ no_collide = 1; break; case 55: /* "TBBSlist" */ #ifdef OLDTBBSLIST nodefunc = TBBSLookup; newnodelist = 0; #endif break; case 56: /* "TaskView" */ case 57: /* "TopView" */ have_tv = 1; break; case 58: /* "ExtrnMail" */ c = skip_blanks (c); if (isdigit (*c)) { lev_ext_mail[num_ext_mail] = atoi (c); while ((*c) && (!isspace (*c))) ++c; } else { lev_ext_mail[num_ext_mail] = 99; } ext_mail_string[num_ext_mail++] = ctl_string (c); break; case 59: /* "BBSnote" */ BBSnote = ctl_string (c); break; case 60: /* "BBS" */ BBSopt = ctl_string (c); break; case 61: /* "ScriptPath" */ script_path = ctl_slash_string (c); break; case 62: /* "BoxType" */ c = skip_blanks (c); boxtype = (short) atoi (c); if ((boxtype > 4) || (boxtype < 0)) boxtype = 1; break; case 63: /* "MultiLink" */ have_ml = 1; break; case 64: /* "Include" */ c = skip_blanks (c); parse_config (c); break; case 65: /* "CaptureFile" */ logptr = ctl_string (c); break; case 66: /* "CursorCol" */ c = skip_blanks (c); cursor_col = atoi (c) - 1; break; case 67: /* "CursorRow" */ c = skip_blanks (c); cursor_row = atoi (c) - 1; break; case 68: /* "DoingMail" */ c = skip_blanks (c); (void) sprintf (junk, "\r\r%s\r\r", c); noBBS = calloc (1, strlen (junk) + 1); (void) strcpy (noBBS, junk); break; case 69: /* "EnterBBS" */ c = skip_blanks (c); (void) sprintf (junk, "\r%s\r", c); BBSesc = calloc (1, strlen (junk) + 1); (void) strcpy (BBSesc, junk); break; case 70: /* "PrivateNet" */ c = skip_blanks (c); pvtnet = atoi (c); break; case 71: /* "Packer" */ packer = ctl_string (c); break; case 72: /* "Cleanup" */ cleanup = ctl_string (c); break; case 73: /* "AfterMail" */ aftermail = ctl_string (c); break; case 74: /* "Colors" */ sscanf (c, "%hd %hd %hd %hd %hd %hd %hd %hd", &colors.background, &colors.settings, &colors.history, &colors.hold, &colors.call, &colors.file, &colors.calling, &colors.popup); break; case 163: /* "BiDiBaud" */ case 75: /* "JanusBaud" */ c = skip_blanks (c); janus_baud = atol (c); break; case 76: /* "ReqTemplate" */ DEFAULT.rq_Template = ctl_string (c); break; case 77: /* "KnownAvail" */ KNOWN.rq_FILES = ctl_string (c); break; case 78: /* "KnownReqList" */ KNOWN.rq_OKFile = ctl_string (c); break; case 79: /* "KnownAbout" */ KNOWN.rq_About = ctl_string (c); break; case 80: /* "KnownInbound" */ KNOWN.sc_Inbound = ctl_slash_string (c); break; case 81: /* "KnownReqLim" */ (void) sscanf (c, "%d %d", &KNOWN.rq_Limit, &KNOWN.rq_Cum_Limit); break; case 82: /* "KnownReqTpl" */ KNOWN.rq_Template = ctl_string (c); break; case 83: /* "ProtAvail" */ PROT.rq_FILES = ctl_string (c); break; case 84: /* "ProtReqList" */ PROT.rq_OKFile = ctl_string (c); break; case 85: /* "ProtAbout" */ PROT.rq_About = ctl_string (c); break; case 86: /* "ProtInbound" */ PROT.sc_Inbound = ctl_slash_string (c); break; case 87: /* "ProtReqLim" */ (void) sscanf (c, "%d %d", &PROT.rq_Limit, &PROT.rq_Cum_Limit); break; case 88: /* "ProtReqTpl" */ PROT.rq_Template = ctl_string (c); break; case 89: /* "Application" */ break; case 90: /* "NoZones" */ no_EMSI++; /* no zones means no EMSI */ no_zones = 1; break; case 91: /* "Answer" */ ans_str = ctl_string (c); break; case 92: /* "PollTries" */ c = skip_blanks (c); poll_tries = atoi (c); break; case 93: /* "SwapDir" */ c = skip_blanks (c); i = (int) strlen (c); swapdir = calloc (1, i + 2); (void) strcpy (swapdir, c); (void) add_backslash (swapdir); break; case 95: /* "Curmudgeon" */ ++curmudgeon; /* Do it like Randy */ break; case 96: /* "NoWaZOO" */ ++no_WaZOO; /* FTSC sessions */ break; case 97: /* "ScreenBlank" */ do_screen_blank = 1; p = skip_blanks (c); if (strnicmp (p, MSG_TXT (M_KEY), 3) == 0) { blank_on_key = 1; } else if (strnicmp (p, MSG_TXT (M_CALL), 4) == 0) { blank_on_key = 0; } break; case 98: /* "Mark_Kromm" */ /* These colors from Mark Kromm, Fidonet 1:261/1034 */ colors.background = 112; /* The */ colors.settings = 9;/* Great */ colors.history = 10;/* BinkleyTerm */ colors.hold = 11; /* Colors */ colors.call = 14; /* Contest */ colors.file = 12; /* Winner!!!! */ colors.calling = 56; colors.popup = 15; break; case 99: /* "Server" */ server_mode = 1; break; case 100: /* "ModemTrans" */ cfg_mdm_trans (c); break; case 101: /* "PreDial" */ dial_setup = ctl_string (c); break; case 102: /* "PreInit" */ init_setup = ctl_string (c); break; case 103: /* "DTRHigh" */ leave_dtr_high = 1; break; case 104: /* "Debug" */ debugging_log = !debugging_log; break; case 105: /* "NoZedZap" */ no_zapzed = !no_zapzed; break; case 106: /* "NoResync" */ no_resync = !no_resync; break; case 107: /* "NoSEAlink" */ no_sealink = !no_sealink; break; case 108: /* "FTS-0001" */ no_sealink = 1; no_resync = 1; no_overdrive = 1; ++no_WaZOO; /* FTSC sessions */ ++no_EMSI; break; case 109: /* "LineUpdate" */ immed_update = !immed_update; break; case 162: /* "BiDiOK" */ case 110: /* "JanusOK" */ cfg_Janus (c); break; case 111: /* "TermInit" */ term_init = ctl_string (c); break; case 112: /* "DomainKludge" */ cfg_domain_kludge (c); break; case 113: /* "Snoop" */ #ifdef Snoop if (getenv ("SNOOPPIPE") == NULL) { strcpy (pipename, skip_blanks (c)); if (pipename[0] != '\0') snoop_open (pipename); } #endif /* Snoop */ break; case 114: /* "Flags" */ flag_dir = ctl_slash_string (c); break; case 115: /* "Tasknumber" */ c = skip_blanks (c); TaskNumber = atoi (c) & 0xFF; break; case 116: /* "MaxBytes" */ (void) sscanf (c, "%ld %ld", &DEFAULT.byte_Limit, &DEFAULT.byte_Cum_Limit); break; case 117: /* "KnownMaxBytes"*/ (void) sscanf (c, "%ld %ld", &KNOWN.byte_Limit, &KNOWN.byte_Cum_Limit); break; case 118: /* "ProtMaxBytes" */ (void) sscanf (c, "%ld %ld", &PROT.byte_Limit, &PROT.byte_Cum_Limit); break; case 119: /* "StartBlkLen" */ c = skip_blanks (c); fstblklen = atoi (c); if ((fstblklen < 64) || (fstblklen > 2048)) fstblklen = 1024; break; case 120: /* "MaxTime" */ (void) sscanf (c, "%d %ld", &DEFAULT.time_Limit, &DEFAULT.time_Cum_Limit); DEFAULT.time_Limit *= 60; DEFAULT.time_Cum_Limit *= 60; break; case 121: /* "KnownMaxTime" */ (void) sscanf (c, "%d %ld", &KNOWN.time_Limit, &KNOWN.time_Cum_Limit); KNOWN.time_Limit *= 60; KNOWN.time_Cum_Limit *= 60; break; case 122: /* "ProtMaxTime" */ (void) sscanf (c, "%d %ld", &PROT.time_Limit, &PROT.time_Cum_Limit); PROT.time_Limit *= 60; PROT.time_Cum_Limit *= 60; break; case 123: /* "RingTries" */ c = skip_blanks (c); ring_tries = atoi (c); break; case 124: /* "NoSharing" */ no_sharing = 1; break; case 125: /* "Version7" */ version7 = 1; nodefunc = ver7find; userfunc = opususer; newnodelist = 0; break; case 126: /* "BlankWait" */ c = skip_blanks (c); blank_time = (unsigned int) 100 *(unsigned int) atoi (c); break; case 127: /* "Serial" */ c = skip_blanks (c); if (isdigit (*c)) serial = atoi (c); break; case 128: /* "NoDietIfna" */ no_dietifna = 1; break; case 130: winslice = 1; /* "WinSlice" */ break; case 131: /* "NoSize" */ no_size = 1; break; case 132: /* "ForcExit" */ c = skip_blanks (c); forcexit = atoi (c); break; case 133: /* "Extern" */ c = skip_blanks (c); EXTopt = ctl_string (c); break; case 134: /* "NoEMSI" */ no_EMSI = ++no_EMSI; break; case 135: /* "MyLocation" */ location = ctl_string (c); break; case 136: /* "MyPhone" */ myphone = ctl_string (c); break; case 137: /* "MyListFlags" */ myflags = ctl_string (c); break; case 138: /* "MyMaxbaud" */ mymaxbaud = ctl_string (c); break; case 139: /* "PickupALL" */ pickup_all = 1; break; case 140: /* "FileSec" */ (void) sscanf (c, "%d", &DEFAULT.security); break; case 141: /* "KnownSec" */ (void) sscanf (c, "%d", &KNOWN.security); break; case 142: /* "ProtSec" */ (void) sscanf (c, "%d", &PROT.security); break; case 143: /* "MaxAreas" */ max_areadat = ctl_string (c); break; case 144: /* "Domain" */ cfg_domain (c); break; case 145: /* "MailSound" */ #ifdef BINKLEY_SOUNDS fnMailSound = cfg_sound (c); #endif break; case 146: /* "FileSound" */ #ifdef BINKLEY_SOUNDS fnFileSound = cfg_sound (c); #endif break; case 147: /* "BBSSound" */ #ifdef BINKLEY_SOUNDS fnBBSSound = cfg_sound (c); #endif break; case 148: /* "EXTSound" */ #ifdef BINKLEY_SOUNDS fnEXTSound = cfg_sound (c); #endif break; case 149: /* "StartSound" */ #ifdef BINKLEY_SOUNDS fnStartSound = cfg_sound (c); #endif break; case 150: /* "FaxSound" */ #ifdef BINKLEY_SOUNDS fnFAXSound = cfg_sound (c); #endif break; case 151: /* "FaxInDir" */ fax_in = ctl_slash_string (c); break; case 152: /* "ModemFailure" */ i = FAILURE; goto add_mdm_response; case 153: /* "ModemIgnore" */ i = IGNORE; goto add_mdm_response; case 154: /* "ModemConnect" */ i = CONNECTED; goto add_mdm_response; case 155: /* "ModemRinging" */ i = RINGING; goto add_mdm_response; case 156: /* "ModemIncoming"*/ i = INCOMING; goto add_mdm_response; case 157: /* "ModemFax" */ i = FAX; /* goto add_mdm_response; */ add_mdm_response: /* If we have no space, bump the array */ if (resp_count == max_resp_count) { int new_max = max_resp_count + 32; int new_size = new_max * sizeof (struct resp_str); struct resp_str *new_resps; new_resps = (struct resp_str *) realloc (mdm_resps, new_size); if (new_resps == NULL) break; max_resp_count = new_max; mdm_resps = new_resps; } mdm_resps [resp_count].resp = ctl_string (c); mdm_resps [resp_count++].disp = i; break; case 158: /* "CostLog" */ cost_log_name = ctl_string (c); if ((cost_log = share_fopen (cost_log_name, append_ascii, DENY_WRITE)) == NULL) { free (cost_log_name); cost_log_name = NULL; } break; case 159: /* "CostUnit" */ c = skip_blanks (c); if (isdigit (*c)) cost_unit = atoi (c); break; case 160: /* "EuroCost" */ eurocost = 1; break; case 161: /* "NoFilter" */ c = skip_blanks (c); if (!*c) goto bad_line; if (cMNP > 16) /* Only 16 allowed */ break; /* Allocate space to copy the result code */ i = 1 + strlen (c); p = calloc (1, i); if (p == NULL) break; /* Copy the result code and store the pointer */ (void) strcpy (p, c); pchMNP[cMNP++] = p; break; case 164: /* "NoHydra" */ no_hydra = 1; break; case 165: /* "NoJanus" */ no_janus = 1; break; case 166: /* "ExtBaudRates" */ #ifdef EXTENDED_BAUDRATES extend_rates = 1; pbtypes = exttypes; #endif break; case 167: /* "AfterCall" *//* MB 93-12-12 AFTERCALL */ c = skip_blanks (c); if (isdigit (*c)) { lines_aftercall = atoi (c); c = skip_to_blank (c); } modem_aftercall = ctl_string (c); break; case 168: /* "PktRsp" *//* MB 93-12-12 PKTRSP */ pktrsp = 1; break; case 169: /* "ExtSession" */ c = skip_blanks (c); if (!isxdigit (*c)) goto bad_line; sscanf (c, "%x", &i); ExtMailMask = (word) i; if (!ExtMailMask) goto bad_line; c = skip_to_blank (c); ExtMailAgent = ctl_string (c); break; case 170: /* "FaxBaud" */ ltemp = atol (c); fax_baud = -1; for (i = 0; pbtypes[i].rate_value; i++) { if (pbtypes[i].rate_value == (unsigned long)ltemp) { fax_baud = i; break; } } if (fax_baud == -1) goto bad_line; break; case 171: /* "ErrLevelShell" */ c = skip_blanks (c); i = atoi (c); if ((i <= 0) || (i > 255)) { (void) printf (MSG_TXT (M_BAD_ERRLEVELSHELLNUM), i); break; } c = skip_to_blank (c); c = skip_blanks (c); if (c) { strupr (c); errlvlshell[i-1] = ctl_string (c); } break; case 172: /* AltNumber */ cfg_alt_num (c); break; case 173: /* ModemRetry */ i = DIALRETRY; goto add_mdm_response; case 174: /* RecentActivityLines */ c = skip_to_blank (c); c = skip_blanks (c); i = atoi (c) ; if (i > 0) scrllines = i; break; case 175: /* "RingWait" */ c = skip_blanks (c); ring_wait = atoi (c); break; case 176: /* "WinFOSSIL" */ #ifdef _WIN32 use_winfossil = 1; #endif break; default: bad_line: (void) printf (MSG_TXT (M_UNKNOWN_LINE), temp); } } (void) fclose (stream); /* close input file */ if (debugging_log) loglevel = 6; } char * ctl_string (char *source) /* malloc & copy to ctl */ { char *dest, *c; int i; c = skip_blanks (source); /* get over the blanks */ i = (int) strlen (c); /* get length of remainder */ if (i < 1) /* must have at least 1 */ return (NULL); /* if not, return NULL */ dest = calloc (1, (unsigned int) (++i)); /* allocate space for string */ if (dest == NULL) /* If we failed to get it, */ return (NULL); /* Just return NULL */ (void) strcpy (dest, c); /* copy the stuff over */ return (dest); /* and return the address */ } char * ctl_slash_string (char *source) /* malloc & copy to ctl */ { char *dest, *c; int i; struct stat buffer; c = skip_blanks (source); /* get over the blanks */ i = (int) strlen (c); /* get length of remainder */ if (i < 1) /* must have at least 1 */ return (NULL); /* if not, return NULL */ dest = calloc (1, (unsigned int) (i + 2)); /* allocate space for string */ if (dest == NULL) /* If we failed to get it, */ return (NULL); /* Just return NULL */ (void) strcpy (dest, c); /* copy the stuff over */ (void) delete_backslash (dest); /* get rid of trailing stuff */ /* Check to see if the directory exists */ i = stat (dest, &buffer); if (i || (!(buffer.st_mode & S_IFDIR))) { (void) printf (MSG_TXT (M_BAD_DIR), dest); (void) printf (MSG_TXT (M_FAIL_EXEC)); free (dest); return (NULL); } (void) add_backslash (dest);/* add the backslash */ return (dest); /* return the directory name */ } char * add_backslash (char *str) { char *p; p = str + strlen (str) - 1; if (p >= str) { /* Strip off the trailing blanks */ while ((p >= str) && (isspace (*p))) { *p = '\0'; --p; } /* Put a backslash if there isn't one */ if ((p >= str) && (*p != '\\') && (*p != '/')) { *(++p) = '\\'; *(++p) = '\0'; } } return (fancy_str (str)); } char * delete_backslash (char *str) { char *p; p = str + strlen (str) - 1; if (p >= str) { /* Strip off the trailing blanks */ while ((p >= str) && (isspace (*p))) { *p = '\0'; --p; } /* Get rid of backslash if there is one */ if ((p >= str) && ((*p == '\\') || (*p == '/'))) { if ((p > str) && (*(p - 1) != ':')) /* Don't delete on root */ *p = '\0'; } } return (fancy_str (str)); } #ifdef BINKLEY_SOUNDS char * cfg_sound (char *source) /* malloc & copy to ctl */ { char *dest, *c; int i; c = skip_blanks (source); /* get over the blanks */ i = (int) strlen (c); /* get length of remainder */ if (i < 1) /* must have at least 1 */ return (NULL); /* if not, return NULL */ if (!dexists (c)) /* Is the file there? */ return (NULL); /* No, return NULL */ dest = calloc (1, (unsigned int) (i + 1)); /* allocate space for string */ if (dest == NULL) /* If we failed to get it, */ return (NULL); /* Just return NULL */ (void) strcpy (dest, c); /* copy the stuff over */ return (dest); /* return the directory name */ } #endif void cfg_macro (char *c) { int i; char *p; c = skip_blanks (c); i = atoi (c); if ((i <= 0) || (i > 9)) { (void) printf ("%s %d %s\n", MSG_TXT (M_MACRO_NUMBER), i, MSG_TXT (M_OUT_OF_RANGE)); return; } c = skip_to_blank (c); c = skip_blanks (c); keys[i - 1] = calloc (1, strlen (c) + 1); p = keys[i - 1]; while (*c && (*c != '\n')) { if (*c == '|') *p++ = '\r'; else *p++ = *c; ++c; } *p = '\0'; } void cfg_dial_string (char *c) { char *p, *p1; PN_TRNS *tpn; p = c; while ((*p) && (isspace (*p))) ++p; if ((*p == ';') || (*p == '\0')) { return; } tpn = (PN_TRNS *) calloc (1, sizeof (PN_TRNS)); p1 = tpn->num; while ((*p) && (!isspace (*p))) { *p1++ = *p++; } *p1 = '\0'; while ((*p) && (isspace (*p))) { ++p; } p1 = tpn->pre; while ((*p) && (*p != '/') && (!isspace (*p))) { *p1++ = *p++; } *p1 = '\0'; p1 = tpn->suf; if ((*p == '\0') || (isspace (*p))) { *p1 = '\0'; } else { ++p; while ((*p) && (!isspace (*p))) { *p1++ = *p++; } *p1 = '\0'; } tpn->len = (short) strlen (tpn->num); tpn->next = NULL; if (pn_head == NULL) { pn_head = tpn; } else { pn->next = tpn; } pn = tpn; } void cfg_mdm_trans (char *c) { char *p, *p1; MDM_TRNS *tmm; p = c; while ((*p) && (isspace (*p))) ++p; if ((*p == ';') || (*p == '\0')) { return; } tmm = (MDM_TRNS *) calloc (1, sizeof (MDM_TRNS)); tmm->mdm = (byte) atoi (p); while ((*p) && (!isspace (*p))) { p++; } while ((*p) && (isspace (*p))) { ++p; } p1 = tmm->pre; while ((*p) && (*p != '/') && (!isspace (*p))) { *p1++ = *p++; } *p1 = '\0'; p1 = tmm->suf; if ((*p == '\0') || (isspace (*p))) { *p1 = '\0'; } else { ++p; while ((*p) && (!isspace (*p))) { *p1++ = *p++; } *p1 = '\0'; } tmm->next = NULL; if (mm_head == NULL) { mm_head = tmm; } else { mm->next = tmm; } mm = tmm; } void cfg_domain (char *c) { char *p, *p1, *p2; int i; p = skip_blanks (c); p = strtok (p, "; \t\r\n"); if (p != NULL) { /* Have the domain name, now get the abbreviated name */ p2 = strtok (NULL, "; \t\r\n"); if (strlen (p2) > 8) *(p2 + 8) = '\0'; if (p2 != NULL) { /* Have the domain name and abbreviated, now get the list name */ p1 = strtok (NULL, "; \t\r\n"); if (p1 == NULL) p1 = p2; /* Have the list name and the domain name, now use them */ for (i = 0; domain_name[i] != NULL; i++) { if (strnicmp (domain_name[i], p, strlen (domain_name[i])) == 0) { domain_nodelist[i] = strdup (p1); domain_abbrev[i] = strdup (p2); break; } } if ((domain_name[i] == NULL) && (i < 49)) { domain_name[i] = strdup (p); domain_abbrev[i] = strdup (p2); domain_nodelist[i] = strdup (p1); } } } } void cfg_domain_kludge (char *c) { char *p; word i; p = c; while ((*p) && (isspace (*p))) ++p; if (isdigit (*p)) { if (num_domain_kludge == size_domain_kludge) { size_domain_kludge += 16; if (!num_domain_kludge) domainkludge = (DOMAINKLUDGE *) malloc (size_domain_kludge * sizeof (DOMAINKLUDGE)); else domainkludge = (DOMAINKLUDGE *) realloc ((void *) domainkludge, size_domain_kludge * sizeof (DOMAINKLUDGE)); } domainkludge[num_domain_kludge].zone = (word) atoi (p); while ((*p) && (!isspace (*p))) ++p; } else return; p = skip_blanks (p); p = strtok (p, "; \t\r\n"); if (p != NULL) { for (i = 0; domain_name[i] != NULL; i++) { if (strnicmp (domain_name[i], p, strlen (domain_name[i])) == 0) { domainkludge[num_domain_kludge++].domain = i; break; } } } return; } void cfg_Janus (char *c) { J_TYPES *tjt; char *p, *p1; p = c; while ((*p) && (isspace (*p))) ++p; if ((*p == ';') || (*p == '\0')) { return; } tjt = (J_TYPES *) calloc (1, sizeof (J_TYPES)); p1 = tjt->j_match; while ((*p) && (!isspace (*p))) { *p1++ = *p++; } *p1 = '\0'; tjt->next = NULL; if (j_top == NULL) { j_top = tjt; } else { j_next->next = tjt; } j_next = tjt; } void cfg_alt_num (char *c) { char *n1, *n2, *p; P_ANUMS a1, a2; /* Primary starts at first non-blank, ends at blank */ c = skip_blanks (c); p = skip_to_blank (c); *p++ = '\0'; n1 = ctl_string (c); if (n1 == NULL) { printf (MSG_TXT (M_ALTNUM_NO_PRIMARY)); return; } c = skip_blanks (p); n2 = ctl_string (c); if (n2 == NULL) { printf (MSG_TXT (M_ALTNUM_NO_ALTERNATE)); free (n1); return; } a1 = calloc (1, sizeof(ANUMS)); a1->num = n1; a1->alt = n2; if (anum_head == NULL) { anum_head = a1; return; } else { /* we need to maintain the order they were entered */ a2 = anum_head; while (a2->next != NULL) a2 = a2->next; a2->next = a1; } }