download btconfig.cpp
Language: C++
LOC: 3378
Project Info
BinkleyTerm XE(btxe)
Server: SourceForge
Type: cvs
...e\b\btxe\btxe\btnt\sources\
   Addr.cpp
   Addr.h
   aglcrc.cpp
   aglcrc.h
   asyn_lnx.cpp
   asyn_os2.cpp
   asyn_w32.cpp
   async.h
   asyos2v1.h
   b_banner.cpp
   b_bbs.cpp
   b_faxrcv.cpp
   b_flofil.cpp
   b_frproc.cpp
   b_help.cpp
   b_initva.cpp
   b_logs.cpp
   b_passwo.cpp
   b_proto.cpp
   b_rspfil.cpp
   b_sbinit.cpp
   b_script.cpp
   b_search.cpp
   b_sessio.cpp
   b_spawn.cpp
   b_term.cpp
   b_termov.cpp
   b_today.cpp
   b_wazoo.cpp
   b_whack.cpp
   b_wzsend.cpp
   banner.cpp
   banner.h
   BasicString.h
   bbs_ctra.cpp
   bbs_data.cpp
   bbs_incl.h
   bbs_io.cpp
   bink.h
   bink_asm.cpp
   binkdlg.cpp
   binkpipe.h
   box.h
   brec.cpp
   bsend.cpp
   bt.cpp
   btconfig.cpp
   btutil.cpp
   buffer.h
   cache.cpp
   cache.h
   callback.cpp
   callerid.cpp
   callwin.cpp
   callwin.h
   capi.cpp
   cfosline.cpp
   chat.cpp
   com.h
   com_dos.h
   com_lnx.h
   com_os2.h
   com_w32.h
   common.cpp
   cpuload.cpp
   css.cpp
   css.h
   data.cpp
   debug.cpp
   debug.h
   defines.h
   dosfuncs.cpp
   emsi.cpp
   emxmxcom.cpp
   evtparse.cpp
   evtsetup.cpp
   exceptio.cpp
   exceptio.h
   Exceptions.cpp
   Exceptions.h
   externs.h
   faxproto.h
   fcfgread.cpp
   fidomail.h
   file_all.cpp
   file_dos.cpp
   file_io.h
   file_lnx.cpp
   file_os2.cpp
   file_w32.cpp
   foffsets.h
   fossil.cpp
   freepoll.cpp
   ftsc.cpp
   gethcomm.h
   heap.cpp
   history.cpp
   history.h
   hydra.cpp
   hydra.h
   includes.cpp
   includes.h
   janus.cpp
   janus.h
   keybd.h
   keyfncs.h
   keymap.cpp
   langload.cpp
   language.h
   lngmagic.h
   m7rec.cpp
   m7send.cpp
   mailer.cpp
   mailovly.cpp
   mailroot.cpp
   maxcomm.h
   maxmcp.cpp
   maxmcp.h
   maxprm.cpp
   mdm_proc.cpp
   misc.cpp
   msgs.h
   Node.cpp
   Node.h
   NodeList.cpp
   NodeList.h
   nodeproc.cpp
   os2_pm.cpp
   outbound.cpp
   pipe.cpp
   pktmsgs.cpp
   pktmsgs.h
   protcomm.cpp
   prototyp.h
   recvbark.cpp
   recvsync.cpp
   sbuf.cpp
   sbuf.h
   sched.cpp
   sched.h
   script2.cpp
   SelfTest.cpp
   SelfTest.h
   sendbark.cpp
   sendsync.cpp
   squish.cpp
   squish.h
   srif.cpp
   statetbl.cpp
   stats.cpp
   stdafx.cpp
   stdafx.h
   timer.cpp
   timer.h
   times.cpp
   types.h
   v7debug.cpp
   version.cpp
   version7.cpp
   version7.h
   vfos_dos.cpp
   vfos_lnx.cpp
   vfos_os2.cpp
   vfos_qnx.cpp
   vfos_w32.cpp
   vfossil.h
   video.h
   vt100.cpp
   vt100.h
   xfer.h
   xmrec.cpp
   xmsend.cpp
   xstring.h
   yoohoo.cpp
   zmodem.cpp
   zmodem.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
//* Description : BinkleyTerm Configuration File Parser

/* Include this file before any other includes or defines! */

#include "includes.h"

#ifdef OS_2                     /* SM 961105 */
#ifdef PORTACCESS
#include "portio.h"
#endif
#endif

void killblanks (char *s);      /* MR 970113 see misc.c */

static KWD_ERR LOCALFUNC parse_keyword (int, char *); /* TS 970328  */
KWD_ERR cfg_CopyString (int, char **, char *);
static KWD_ERR cfg_CopySlashString (int, char **, char *);
static KWD_ERR cfg_macro (char *);
static void cfg_dial_string (char *);
static KWD_ERR cfg_alt_num (char *);
static KWD_ERR cfg_mdm_response (char *c, int);
static void cfg_mdm_trans (char *);
static void cfg_domain (char *);
static KWD_ERR cfg_domain_kludge (char *);
static KWD_ERR cfg_override (char *);
static KWD_ERR cfg_hidden (char *); /* VRP 990830 */
static KWD_ERR cfg_insert_AKA (char *); /* r. hoerner */
static KWD_ERR cfg_set_nodeflag (int *, unsigned long, char *);
static KWD_ERR cfg_set_callerid (char *, ADDR*); /* MR 970414  */
static KWD_ERR cfg_condpoll (char *); /* MR 970327  */
static void cfg_Janus (char *);
static void bad_line (int, char *); /* MR 970321  */
static word LOCALFUNC SetFidoFlag (char *, ADDR*);
static word LOCALFUNC SetModemFlag (char *);
static KWD_ERR LOCALFUNC SetOnLineTime (char *); /* VRP 990820 */
static char *cfgfgets (char *, FILE *); /* MMP 960419 / TJW 960928 */
static KWD_ERR cfg_set_chatlogdir (char *c);
static KWD_ERR cfg_set_nodeextradir (char *c);
static KWD_ERR cfg_set_nodeinbounddir (char *c);
static KWD_ERR cfg_set_SyncHydraSessions (char *c);
static KWD_ERR cfg_set_randomsystem (char *c);
static KWD_ERR cfg_set_randomsysop (char *c);
static KWD_ERR cfg_set_randomlocation (char *c);
static KWD_ERR cfg_set_nodetimezone (char *c);
static KWD_ERR cfg_parse_pktstats (char *c, PKTREP * PKTStats);
static KWD_ERR cfg_parse_online_time (char *, short *, short *, short *); /* VRP 990830 */
static KWD_ERR cfg_parse_aftercall (char *c); /*** VRP 20000616 ***/
static KWD_ERR cfg_statsdef (char *c);
static void LOCALFUNC cfg_insert_region (word Zone, char *Region);


#ifdef BINKLEY_SOUNDS

static char *cfg_sound (char *);

#endif

#define CFGLINEBUFSIZE 3072

#ifdef __IBMC__
#pragma pack(1)
#endif

static char far *config_lines[] = {
                                      "SameRing",
                                      "NewNodeList",                /* obsolete! HJK - 99/02/28 */
                                      "QuickNodeList",              /* obsolete! HJK - 99/02/28 */
                                      "Answerback",
                                      "Macro",
                                      "Shell",
                                      "Dial",
                                      "Event",
                                      "Zone",                       /* obsolete! TJW970202 */
                                      "MaxReq",
                                      "LogLevel",
                                      "Baud",
                                      "MaxPort",
                                      "Port",
                                      "Carrier",
                                      "StatusLog",
                                      "Reader",
                                      "BossPhone",
                                      "BossPwd",
                                      "Protocol",
                                      "System",
                                      "Sysop",
                                      "Boss",
                                      "Point",                      /* obsolete! TJW970202 */
                                      "Aka",                        /* obsolete! TJW970202 */
                                      "Hold",
                                      "Downloads",
                                      "NetFile",
                                      "Init",
                                      "Busy",
                                      "Prefix",
                                      "NodeList",
                                      "Avail",
                                      "OKFile",
                                      "About",
                                      "MailNote",
                                      "Banner",
                                      "Unattended",
                                      "Overwrite",
                                      "NoOKCheck",                  /* MR 970720  40 */
                                      "ReqOnUs",
                                      "LockBaud",
                                      "TimeOut",
                                      "NoSLO",
                                      "SlowModem",
                                      "SmallWindow",
                                      "NoPickup",
                                      "NoRequests",
                                      "NetMail",
                                      "Suffix",
                                      "SysopNDX",
                                      "AutoBaud",
                                      "Gong",
                                      "NoCollide",
                                      "NoDirZap",
                                      "DebugFlags",
                                      "Outbound",
                                      "ExtrnMail",
                                      "BBSNote",
                                      "BBS",
                                      "ScriptPath",
                                      "BoxType",
                                      "Inbound",
                                      "Include",
                                      "CaptureFile",
                                      "CursorCol",
                                      "CursorRow",
                                      "DoingMail",
                                      "EnterBBS",
                                      "PrivateNet",
                                      "Packer",
                                      "Cleanup",
                                      "AfterMail",
                                      "Colors",
                                      "JanusBaud",
                                      "ReqTemplate",
                                      "KnownAvail",
                                      "KnownReqList",
                                      "KnownAbout",
                                      "KnownInbound",
                                      "KnownReqLim",
                                      "KnownReqTpl",
                                      "ProtAvail",
                                      "ProtReqList",
                                      "ProtAbout",
                                      "ProtInbound",
                                      "ProtReqLim",
                                      "ProtReqTpl",
                                      "NodeTimeZone",               /* MR 980104 */
                                      "NoZones",                    /* obsolete! TJW970202 */
                                      "Answer",
                                      "PollTries",
                                      "SwapDir",
                                      "Address",
                                      "CurMudgeon",
                                      "NoWaZOO",
                                      "ScreenBlank",
                                      "Mark_Kromm",
                                      "Server",
                                      "ModemTrans",
                                      "PreDial",
                                      "PreInit",
                                      "DTRHigh",
                                      "Debug",
                                      "NoZedZap",
                                      "NoResync",
                                      "NoSEAlink",
                                      "FTS-0001",
                                      "LineUpdate",
                                      "JanusOK",
                                      "TermInit",
                                      "DomainKludge",
                                      "Snoop",
                                      "Flags",
                                      "NoHydraChat",                /* TJW 960804 */
                                      "MaxBytes",
                                      "KnownMaxBytes",
                                      "ProtMaxBytes",
                                      "StartBlkLen",
                                      "MaxTime",
                                      "KnownMaxTime",
                                      "ProtMaxTime",
                                      "RingTries",
                                      "NoSharing",
                                      "Version7",
                                      "BlankWait",
                                      "Serial",
                                      "NoDietIfna",
                                      "Version6",                   /* obsolete! HJK - 99/02/28 */
                                      "WinSlice",
                                      "NoSize",
                                      "ForcExit",
                                      "Extern",
                                      "NoEMSI",
                                      "MyLocation",
                                      "MyPhone",
                                      "MyListFlags",
                                      "MyMaxbaud",
                                      "PickUpAll",
                                      "FileSec",
                                      "KnownSec",
                                      "ProtSec",
                                      "MaxAreas",
                                      "Domain",
                                      "MailSound",
                                      "FileSound",
                                      "BBSSound",
                                      "EXTSound",
                                      "StartSound",
                                      "FaxSound",
                                      "FaxInDir",
                                      "ModemFailure",
                                      "ModemIgnore",
                                      "ModemConnect",
                                      "ModemRinging",
                                      "ModemIncoming",
                                      "ModemFax",
                                      "Costlog",
                                      "CostUnit",
                                      "EuroCost",
                                      "NoFilter",
                                      "BiDiOK",
                                      "BiDiBaud",
                                      "NoHydra",
                                      "NoJanus",
                                      "ExtBaudRates",
                                      "AfterCall",
                                      "PktRsp",
                                      "ExtSession",
                                      "FaxBaud",
                                      "ErrLevelShell",
                                      "AltNumber",
                                      "ModemRetry",
                                      "RecentActivityLines",
                                      "RingWait",
                                      "FreqLongNames",              /* HJK - 99/01/22 */
                                      /* TJW 960414 single config file for n tasks */
                                      "[",                          /* section begin with expression             */

                                      "TaskPath",                   /* TJW 235 178 */
                                      "ShowAlive",                  /* RDH *** 9604 179 */
                                      "ReadHoldTime",               /* mtt 96-04-16 180 */
                                      "ReInitTime",                 /* mtt 96-04-16 181 */
                                      "ConditionalPoll",            /* CE/TJW 960425 182 */
                                      "Reject",                     /* CE/TJW 960425 183 */
                                      "ProtocolPreference",         /* TJW 960719 184 */
                                      "PutEnv",                     /* MMP 185 */
                                      "SpawnInit",                  /* MMP 186 */
                                      "LocalLog",                   /* MMP 187 */
                                      "ShortCostLog",               /* MMP 188 */
                                      "TimeSync",                   /* MMP 189 */
                                      "MailFlag",                   /* MMP 190 */
                                      "MakeDir",                    /* TJW 191 *//* obsolete */
                                      "SRIF",                       /* MTT 192 */
                                      "AfterConnect",               /* PE 193 */
                                      "MaxBusyAge",                 /* MMP 194 */
                                      "SpawnNoOK",                  /* MMP 195 */
                                      "CacheHold",                  /* MMP 196 */
                                      "PBAreas",                    /* TE 960516 197 */
                                      "ModemReject",                /* CE 198 */
                                      "AfterCallOut",               /* CE 199 */
                                      "ChangeMailTo",               /* CE 200 */

                                      "CostTimeCorrection",         /* TJW 201 */
                                      "IPC",                        /* TJW 202 */
                                      "ReadLog",                    /* TJW 203 */
                                      "EMSIbanner",                 /* TJW 204 */
                                      "CostCPS",                    /* TJW 205 */
                                      "MCPpipe",                    /* TJW 206 */

                                      "WindowTitleFmt",             /* TJW 207 */
                                      "OutboundRescanPeriod",       /* TJW 208 */
                                      "OutboundCache",              /* TJW 209 */

                                      "CheckPath",                  /* CE 210 */
                                      "AKAMatching",                /* CE 211 */
                                      "NodeInboundDir",             /* CE 212 */
                                      "SyncHydraSessions",          /* CE 213 */
                                      "NoModem",                    /* CE 214 */

                                      "HydraMsgSend",               /* mtt 215 */
                                      "MTrsrvd216",                 /* mtt 216 */
                                      "MTrsrvd217",                 /* mtt 217 */
                                      "MTrsrvd218",                 /* mtt 218 */
                                      "MTrsrvd219",                 /* mtt 219 */

                                      "SmartBiDi",                  /* R.Hoerner 220 */
                                      "RHrsrvd221",                 /* RH 221 */
                                      "RHrsrvd222",                 /* RH 222 */
                                      "RHrsrvd223",                 /* RH 223 */
                                      "RHrsrvd224",                 /* RH 224 */

                                      "NoRescan",                   /* CE 225 */
                                      "CErsrvd226",                 /* CE 226 */
                                      "CErsrvd227",                 /* CE 227 */
                                      "CErsrvd228",                 /* CE 228 */
                                      "CErsrvd229",                 /* CE 229 */

                                      "NoANSITrash",                /* TS  230 */
                                      "SIOMode",                    /* CFS 231 */
                                      "IPRepChar",                  /* TE 232  */
                                      "TErsrvd233",                 /* TE 233  */
                                      "NoZedZip",                   /* JNK 970615 234 */

                                      "BannerCID",                  /* CFS 235 */
                                      "ModemCID",                   /* CFS 236 */
                                      "StringRep",                  /* CFS 237 */
                                      "Callback",                   /* CFS 238 */
                                      "Nohundredths",               /* CFS 239 */

                                      "Assumebaud",                 /* R.Hoerner 240 */
                                      "Clock",                      /* R.Hoerner 241 */
                                      "BitType",                    /* R.Hoerner 242 */
                                      "ReDialTime",                 /* R.Hoerner 243 */
                                      "EmsiLog",                    /* R.Hoerner 244 */
                                      "NoErrDelay",                 /* R.Hoerner 245 */
                                      "BinkDir",                    /* R.Hoerner 246 */
                                      "ShowDomains",                /* R.Hoerner 247 */
                                      "PassWordFile",               /* R.Hoerner 248 */
                                      "ForcedRescan",               /* R.Hoerner 249 */
                                      "NoFancyStrings",             /* R.Hoerner 250 */
                                      "MaxRingWait",                /* R.Hoerner 251 */
                                      "HoldAfterBadConnect",        /* R.Hoerner 252 - AW obsolete! */
                                      "ShowPassword",               /* R.Hoerner 253 */
                                      "Override",                   /* R.Hoerner 254 */
                                      "NoWildCards",                /* R.Hoerner 255 */
                                      "PipeTo",                     /* R.Hoerner 256 */
                                      "DelBadCall",                 /* R.Hoerner 257 */
                                      "EventFile",                  /* R.Hoerner 258 */
                                      "SharePort",                  /* SM 970102 259 */
                                      "MaxPrm",                     /* AW 980219 260 */
                                      "ModemRing",                  /* SM        261 */
                                      "CfosCost",                   /* R.Hoerner 262 */

                                      "ModemCostReset",             /* CFS       263 */
                                      "StatsToMSG",                 /* CFS       264 */
                                      "UseCompletePaths",           /* MR 970213 265 */
                                      "ShowModemWin",               /* MR 970215 266 */
                                      "NoTranx",                    /* JNK 970312 267 */
                                      "CAPICID",                    /* CFS       268 */
                                      "CFOSLine",                   /* CFS       269 */
                                      "PreAnswer",                  /* MR 970310 270 */
                                      "CallerID",                   /* MR 970324 271 */
                                      "StringRepModem",             /* CFS       272 */
                                      "HangUp",                     /* MR        273 */
                                      "AutoChatOpen",               /* CFS       274 */
                                      "ChatLogDir",                 /* CFS       275 */
                                      "NodeExtraDir",               /* CFS       276 */
                                      "RandomSystem",               /* CFS       277 */
                                      "RandomSysop",                /* CFS       278 */
                                      "RandomMyLocation",           /* CFS       279 */
                                      "ShortHistory",               /* CFS       280 */
                                      "StatsDef",                   /* CFS       281 */
                                      "RejectIgnoreSize",           /* JH        282 */
                                      "ReadFlagTime",               /* CEH       283 */
                                      "LocalInbound",               /* CEH       284 */
                                      "OnLine",                     /* VRP 990820 285 */
                                      "SendHoldIfCaller",           /* VRP 990824 286 */
                                      "RestorePoll",                /* VRP 990826 287 */
                                      "Hidden",                     /* VRP 990830 288 */
                                      "NetMailFlag",                /* VRP 990918 289 */
                                      "ArcMailFlag",                /* VRP 990918 290 */
                                      "TicFlag",                    /* VRP 990918 291 */
                                      "SaveExtSession",             /* VRP 990920 292 */
                                      "CHCP",                       /* SVM 991025 293 */
                                      NULL
                                  };


KWD_ERR parse_config (char *config_file)
{
	nodelist.AddNodesFromFile("Nodelist\\NODELIST.201");

    FILE *stream;
    char *temp;
    char *c = NULL;               /* TS 960620  since maybe uninitialized */
    char tmpfname[PATHLEN];
    char buf[CFGLINEBUFSIZE];
    int i;
    int linecounter = 0;
    int usecfglines = 1;          /* TJW 960414 use config lines for this task ? init: yes */

    if (config_file == NULL)
        return kwd_bad;

    /* MR 961122 do not add BINKpath if config_file has a complete path
     * MR 970617 or if we are using UNCs */
    /* CEH 990110 Only add BINKpath if NO path is in config_file */

    if (strchr (config_file, DIR_SEPC) == NULL)
        sprintf (tmpfname, "%s%s", BINKpath, config_file);
    else
        sprintf (tmpfname, "%s", config_file);

    /* OK, let's open the file */
    if ((stream = share_fopen (tmpfname, read_ascii, DENY_WRITE)) == NULL)
    {
        printf ("ERR: cannot open configuration file %s\n", tmpfname);
        return kwd_bad;             /* no file, no work to do */
    }

    printf ("Reading configuration file %s...\n", tmpfname);

    /* MMP 960419. cfgfgets() substitutes environment variables, removes
     * comments, does conditional inclusion of lines, and truncates long lines */

    /* Now we parse the file ... */

    while ((temp = cfgfgets (buf, stream)) != NULL) /* while not EOF */
    {
        ++linecounter;              /* TJW 960524 */

        if (strlen (temp) < 3)      /* If too short, ignore it */
            continue;

        if ((i = parse (temp, config_lines)) != -1)
        {
            c = &temp[strlen (config_lines[i - 1])];
            c = skip_blanks (c);
        }

        switch (i)                  /* TJW 960414                    */
        {
        case 177:                  /* TJW 960830 [expression]       */
            {                         /* MR  970113 added multiple expressions */
                char *p;
                int use = TRUE;         /* use = -1 if error                     */
                int andop = -1;         /* operator - FALSE = OR, TRUE = AND     */

                killblanks (c);         /* remove blanks, tabs..                 */

                do
                {
                    p = strchr (c, ']');
                    if (p == NULL)
                        use = -1;
                    else
                    {
                        *p = '\0';          /* if there is a ] then kill it          */
                        ++p;                /* save next pos                         */
                        use = eval (c);
                        if (use >= 0)       /* if expr = 1 then use lines            */
                        {
                            if (andop == -1)
                                usecfglines = use; /* first value ok */
                            else if (andop == FALSE)
                                usecfglines = usecfglines || use; /* add use with OR */
                            else
                                usecfglines = usecfglines && use; /* add use with AND */

                            if (*p)           /* still something after ']'?      */
                            {
                                if ((p[0] == '&') && (p[1] == '[')) /* AND */
                                    andop = TRUE;
                                else if ((p[0] == '|') && (p[1] == '[')) /* OR */
                                    andop = FALSE;
                                else
                                    use = -1;
                                c = p + 2;
                            }
                            else
                                c = NULL;
                        }
                    }
                }
                while ((c != NULL) && (use >= 0));

                if (use == -1)
                {
                    printf (MSG_TXT (M_UNKNOWN_LINE), temp);
                    bad_line (linecounter, tmpfname);
                }
            }
            break;

        default:
            if (usecfglines)
            {
                /* MR 970326 split up config parser */
                switch (parse_keyword (i, c))
                {
                case kwd_ok:           /*  TS 970328, this enum was not handled    */
                    break;

                case kwd_bad:
                    printf (MSG_TXT (M_UNKNOWN_LINE), temp);
                    bad_line (linecounter, tmpfname);
                    break;

                case kwd_unknown:
                    printf ("ERR: %s: unsupported in this version\n",
                            config_lines[i - 1]);
                    bad_line (linecounter, tmpfname);
                    break;

                case kwd_nomem:
                    printf ("ERR: %s: cannot allocate memory\n", config_lines[i - 1]);
                    bad_line (linecounter, tmpfname);
                    break;

                case kwd_other_err:
                    bad_line (linecounter, tmpfname);
                    break;

                }
            }
        }
    }

    fclose (stream);              /* close input file */

    if (debugging_log)
        loglevel = loglevel < 6 ? 6 : loglevel; /* allow loglevel 7 AND debug */

    return kwd_ok;
}


static KWD_ERR LOCALFUNC
parse_keyword (int keyword, char *c)
{
    int itemp;
    long ltemp;
    char *p = NULL;
    char *p2 = NULL;

#ifdef OS_2
    char *p3 = NULL;

#endif
    char junk[256];
    KWD_ERR error = kwd_ok;

    switch (keyword)
    {
    case 1:                      /* "SameRing"               */
        def_mdm_resps[1].disp = IGNORE;
        break;


    case 2:                      /* obsolete                 */
        error = kwd_unknown;
        break;


    case 3:                      /* obsolete                 */
        error = kwd_unknown;
        break;


    case 4:                      /* "Answerback"             */
        error = cfg_CopyString (keyword, &answerback, c);
        break;


    case 5:                      /* "Macro"                  */
        cfg_macro (c);
        break;


    case 6:                      /* "Shell"                  */
        itemp = atoi (c);
        if ((itemp <= 0) || (itemp > 9))
        {
            printf ("ERR: Shell: %s %d %s\n", MSG_TXT (M_SHELL_NUMBER),
                    itemp, MSG_TXT (M_OUT_OF_RANGE));
            error = kwd_other_err;
            break;
        }
        c = skip_to_word (c);
        shells[itemp - 1] = (char*)calloc (1, strlen (c) + 1);
        strcpy (shells[itemp - 1], c);
        // strupr (shells[itemp - 1]);
        break;


    case 7:                      /* "Dial"                   */
        cfg_dial_string (c);
        break;


    case 8:                      /* "Event"                  */
        error = parse_event (c);
        break;


    case 9:                      /* obsolete                 */
        error = kwd_unknown;
        break;

    case 10:                     /* "MaxReq"                 */
        sscanf (c, "%d %d", &DEFAULT.rq_Limit, &DEFAULT.rq_Cum_Limit);
        if (!DEFAULT.rq_Limit)      /* No requests???       */
        {
            printf ("Note: MaxReq: 0 %s\n", MSG_TXT (M_REQUESTS_ALLOWED));
            error = kwd_other_err;
        }
        break;


    case 11:                     /* "LogLevel"               */
        itemp = atoi (c);
        if (abs (itemp) <= 7)       /* r.hoerner: allowed LOGLEVEL 0  */
        {
            loglevel = itemp;
        }
        else
        {
            printf ("ERR: LogLevel: %s %s\n", MSG_TXT (M_BAD_LOGLEVEL), c);
            error = kwd_other_err;
        }
        break;


    case 12:                     /* "Baud"                   */
        ltemp = atol (c);
        max_baud.rate_value = 0;
        for (itemp = 0; pbtypes[itemp].rate_value; itemp++)
        {
            if (pbtypes[itemp].rate_value == (unsigned long) ltemp)
            {
                max_baud.rate_mask = pbtypes[itemp].rate_mask;
                max_baud.rate_value = ltemp;
                break;
            }
        }
        if (!max_baud.rate_value)
            error = kwd_bad;
        break;


    case 13:                     /* "MaxPort"                */
#ifndef __unix__
        itemp = atoi (c);           /* make it binary           */
        if ((itemp > 0) && (itemp < 33)) /* if range is reasonable,  */
            MAXport = itemp;          /* Make it the max value    */
        else
        {
            printf ("ERR: MaxPort: %s %s\n", MSG_TXT (M_BAD_MAXPORT), c);
            error = kwd_other_err;
        }
#else
printf ("ERR: MaxPort: ignored in linux-version");
#endif
        break;


    case 14:                     /* "Port"                   */
        itemp = atoi (c);           /* make it binary */

        /* r. hoerner: allow "Port COM3" i.e. "Port <device><number>"       */
        /* you can't use "port \\PIPE\ME", you can use "port \\PIPE\COM2"   */
        /* but it will not work at all ;)                                   */

#ifdef __unix__

        port_ptr = 0;
        original_port = 0;

        error = cfg_CopyString (keyword, &port_device, c);

        p = port_device;
        if (p == NULL)
            break;

        while (*p)
        {
            if (*p == ';' || *p == '%' || *p == ' ')
                *p = 0;
            if (*p)
                p++;
        }

        port_ptr = 0;
        original_port = 0;
        // printf("PORT: Using [%s]\n",port_device);
        break;

#else

if (strlen (c) > 2)
        {
            port_ptr = 0;
            original_port = 0;

            error = cfg_CopyString (keyword, &port_device, c);

            p = port_device;
            if (p == NULL)
                break;

            while (*p)
            {
                if (*p == ';' || *p == '%' || *p == ' ')
                    *p = 0;
                if (*p)
                    p++;
            }

            if (isdigit (port_device[strlen (port_device) - 1]))
            {
                p = port_device;        /* start with "COM12"       */
                while (!isdigit (*p))   /* search the     ^^        */
                    p++;
                itemp = atoi (p);       /* p = "12" -> i = 12       */
                *p = 0;                 /* "COM12" -> "COM"         */
            }
            else
                itemp = 255;            /* force error              */
        }
        else
            port_device = ctl_string ("COM");

        if ((itemp > 0) || (itemp < 33)) /* see if it's OK           */
        {
            port_ptr = itemp - 1;     /* store it if so           */
            if (MAXport < itemp)      /* See if MAXport is less   */
                MAXport = itemp;        /* If so, increase MAXport  */
            original_port = port_ptr;
        }
        else
        {
            printf ("ERR: Port: %s %s\n", MSG_TXT (M_ILLEGAL_PORT), c);
            error = kwd_other_err;
        }
        break;

#endif

    case 15:                     /* "Carrier"                */
        itemp = 0;
        sscanf (c, "%x", &itemp);   /* convert it to binary     */
        if (itemp != 0)             /* if we got anything       */
            carrier_mask = (unsigned int) itemp;
        else
        {
            printf ("ERR: Carrier: %s %s\n", MSG_TXT (M_ILLEGAL_CARRIER), c);
            error = kwd_other_err;
        }
        break;


    case 16:                     /* "StatusLog"              */
        error = cfg_CopyString (keyword, &log_name, c);

        if (binkdir && (log_name != NULL))
        {
            p = log_name;
            p += strlen (log_name);
            while ((p != log_name) && (*p != DIR_SEPC))
                p--;
            if (p == log_name)
                break;
            *p = 0;
            p2 = ctl_slash_string (binkdir, log_name); /* create directory    */
            free (p2);                /* MR 970327 and free  */
            *p = DIR_SEPC;
        }
        break;


    case 17:                     /* "Reader"                 */
        error = cfg_CopyString (keyword, &BBSreader, c);
        break;


    case 18:                     /* "BossPhone"              */
        error = cfg_CopyString (keyword, &BOSSphone, c);
        break;


    case 19:                     /* "BossPwd"                */
        error = cfg_CopyString (keyword, &BOSSpwd, c);
        break;


    case 20:                     /* "Protocol"               */
        if (extern_index == 5)
        {
            printf ("ERR: Protocol: more then 5 protocols, skipped %s\n", c);
            error = kwd_other_err;
            break;
        }

        protocols[extern_index] = ctl_string (c);
        if (protocols[extern_index] != NULL)
            extern_index++;
        break;


    case 21:                     /* "System"                 */
        error = cfg_CopyString (keyword, &def_system_name, c);
        system_name = def_system_name;
        break;


    case 22:                     /* "Sysop"                  */
        error = cfg_CopyString (keyword, &def_sysop, c);
        sysop = def_sysop;
        break;


    case 23:                     /* "Boss"                   */
        parse_address (c, &boss_addr);
        break;


    case 24:                     /* obsolete, was: "Point"   */
    case 25:                     /* obsolete, was: "Aka"     */
        error = kwd_unknown;
        break;


    case 94:                     /* "Address"                */
        error = cfg_insert_AKA (c);
        /* Zone = alias->Zone;    First is real default, removed: TJW970202 */
        break;


    case 26:                     /* "Hold"                   */
    case 57:                     /* "Outbound"               */
        error = cfg_CopySlashString (keyword, &hold_area, c);

        if (hold_area != NULL)
        {
            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 = domain_area;
                /*
                 * CEH 19990514:
                 * domain_area has a '\\' (or '/') at the end (cfg_CopySlashString adds this if
                 * neccessary), so it we don't have to look for ':'
                 *
                 *         {
                 *           p = strrchr (domain_area, ':');
                 *           if (p == NULL)
                 *             p = domain_area;
                 *         }
                 */
            }
            if (p != domain_area)
                ++p;
            /*
             * CEH 19990514: domain_loc is no longer needed.
             *
             *       domain_loc = p;
             */
            *p = '\0';
        }
        break;


    case 27:                     /* "Downloads"              */
        error = cfg_CopySlashString (keyword, &download_path, c);
        break;


    case 28:                     /* "NetFile"                */
    case 63:                     /* "Inbound"                */
        error = cfg_CopySlashString (keyword, &DEFAULT.sc_Inbound, c);
        break;


    case 29:                     /* "Init"                   */
        if (modem.init_cnt < 4)
            modem.init[modem.init_cnt++] = ctl_string (c);
        else
        {
            printf ("ERR: Init: too many init strings, skipped %s\n", c);
            error = kwd_other_err;
        }
        break;


    case 30:                     /* "Busy"                   */
        error = cfg_CopyString (keyword, &modem.busy, c);
        break;


    case 31:                     /* "Prefix"                 */
        error = cfg_CopyString (keyword, &modem.predial, c);
        modem.normprefix = modem.predial;
        break;


    case 32:                     /* "NodeList"               */
        error = cfg_CopySlashString (keyword, &net_info, c);
        break;


    case 33:                     /* "Avail"                  */
#ifdef SPECIALMAGICS
        error = cfg_CopyString (keyword, &DEFAULT.rq_FILES, c);
#else
error = kwd_unknown;
#endif
        break;


    case 34:                     /* "OKFile"                 */
        error = cfg_CopyString (keyword, &DEFAULT.rq_OKFile, c);
        break;


    case 35:                     /* "About"                  */
#ifdef SPECIALMAGICS
        error = cfg_CopyString (keyword, &DEFAULT.rq_About, c);
#else
error = kwd_unknown;
#endif
        break;


    case 36:                     /* "MAILnote"               */
        error = cfg_CopyString (keyword, &MAILnote, c);
        break;


    case 37:                     /* "Banner"                 */
        error = cfg_CopyString (keyword, &BBSbanner, c);
        break;


    case 38:                     /* "UnAttended"             */
        if (!command_line_term)
        {
            un_attended = 1;
            command_line_un = 1;
        }
        break;


    case 39:                     /* "OverWrite"              */
        overwrite = 1;
        break;


    case 40:                     /* MR 970720 "NoOKCheck"    */
        modem.no_okcheck = 1;
        break;


    case 41:                     /* "ReqOnUs"                */
        error = cfg_set_nodeflag (&on_our_nickel, FREEREQ, c); /* r. hoerner */
        break;


    case 42:                     /* "LockBaud"               */
        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;
        }

        if (ARQs > 16)              /* Only 16 allowed          */
            break;

        p = ctl_string (c);         /* Case 3: ARQ              */
        if (p == NULL)              /* Give up if none          */
        {
            error = kwd_nomem;
            break;
        }

        ARQ[ARQs++] = p;            /* Update array            */
        break;


    case 43:                     /* "TimeOut"                */
        BBStimeout = atoi (c);
        if (BBStimeout < 20)
            BBStimeout = 20;
        if (BBStimeout > 655)
            BBStimeout = 655;
        BBStimeout *= PER_SECOND;
        break;


    case 44:                     /* "NoSLO"                  */
        no_overdrive = 1;
        break;


    case 45:                     /* "SlowModem"              */
        slowmodem = 1;
        break;


    case 46:                     /* "SmallWindow"            */
        small_window = 1;
        break;


    case 47:                     /* "NoPickup"               */
        error = cfg_set_nodeflag (&no_pickup, NOPICK, c); /* r. hoerner */
        break;


    case 48:                     /* "NoRequests"             */
        error = cfg_set_nodeflag (&no_requests, NOREQ, c); /* r. hoerner */
        break;


    case 49:                     /* "NetMail"                */
        if (*c != '$')
            error = cfg_CopySlashString (keyword, &netmail, c);
        else
            error = cfg_CopyString (keyword, &netmail, c);
        break;


    case 50:                     /* "Suffix"                 */
        error = cfg_CopyString (keyword, &modem.postdial, c);
        modem.normsuffix = modem.postdial;
        break;


    case 51:                     /* "SysopNDX"               */
        break;


    case 52:                     /* "AutoBaud"               */
        autobaud = 1;
        break;


    case 53:                     /* "Gong"                   */
        error = cfg_set_nodeflag (&gong_allowed, DO_BELL, c); /* r. hoerner */
        break;


    case 54:                     /* "NoCollide"              */
        no_collide = 1;
        break;


    case 55:                     /* TJW970714 "NoDirZap"     */
        no_dirzap = 1;              /* Todo: node dependant switch */
        break;


    case 56:                     /* TJW970715 "DebugFlags"   */
        sscanf (c, "%lx", &debugflags); /* temporary debug bit flags */
        break;


    case 58:                     /* "ExtrnMail <errorlevel> <string>"    */
        if (!isdigit (*c))          /* changed 8/1/97            r. hoerner */
        {
            error = kwd_bad;
            break;
        }

        lev_ext_mail[num_ext_mail] = atoi (c);
        c = skip_to_blank (c);
        ext_mail_string[num_ext_mail] = ctl_string (c);
        if (ext_mail_string[num_ext_mail] != NULL)
            num_ext_mail++;
        break;


    case 59:                     /* "BBSnote"                */
        error = cfg_CopyString (keyword, &BBSnote, c);
        break;


    case 60:                     /* "BBS"                    */
        if (strnicmp (c, "exit", 4) == 0)
            BBSopt = OPT_EXIT;
        else if (strnicmp (c, "batch", 5) == 0)
            BBSopt = OPT_BATCH;
        else if (strnicmp (c, "spawn", 5) == 0)
            BBSopt = OPT_SPAWN;
#ifdef BBS_INTERNAL
        else if (strnicmp (c, "internal", 5) == 0)
            BBSopt = OPT_INTERNAL;
#endif
        else
            error = kwd_bad;
        break;


    case 61:                     /* "ScriptPath"             */
        error = cfg_CopySlashString (keyword, &script_path, c);
        break;


    case 62:                     /* "BoxType"                */
        boxtype = (short) atoi (c);
        if ((boxtype > 4) || (boxtype < 0))
            boxtype = 1;
        break;

    case 64:                     /* "Include"                */
        p = ctl_string (c);         /* TJW 960414 evaluate %xy% */
        error = parse_config (p);   /* in included files        */
        free (p);                   /* MR 970326 added free     */
        break;


    case 65:                     /* "CaptureFile"            */
        error = cfg_CopyString (keyword, &logptr, c);
        break;


    case 66:                     /* "CursorCol"              */
        cursor_col = atoi (c) - 1;
        break;


    case 67:                     /* "CursorRow"              */
        cursor_row = atoi (c) - 1;
#ifdef DOS16                    /*  TS 970602   */
        if ((cursor_row + 1) > getbiosscreenrows ())
            cursor_row = getbiosscreenrows () - 1;
#endif
        break;


    case 68:                     /* "DoingMail"              */
        sprintf (junk, "\r\r%s\r\r", c);
        noBBS = (char*)calloc (1, strlen (junk) + 1);
        strcpy (noBBS, junk);
        break;


    case 69:                     /* "EnterBBS"               */
        sprintf (junk, "\r%s\r", c);
        BBSesc = (char*)calloc (1, strlen (junk) + 1);
        strcpy (BBSesc, junk);
        break;


    case 70:                     /* "PrivateNet"             */
        pvtnet = (short) atoi (c);
        break;


    case 71:                     /* "Packer"                 */
        error = cfg_CopyString (keyword, &packer, c);
        break;


    case 72:                     /* "Cleanup"                */
        error = cfg_CopyString (keyword, &cleanup, c);
        break;


    case 73:                     /* "AfterMail"              */
        if (!memicmp (c, "quick", 5) && (isspace (c[5]) || c[5] == '\0'))
            quickaftermail = 1, c += 5;
        error = cfg_CopyString (keyword, &aftermail, c);
        break;


    case 74:                     /* "Colors"                 */
        sscanf (c, "%hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd",
                &colors.background, &colors.settings, &colors.history,
                &colors.hold, &colors.call, &colors.file,
                &colors.calling, &colors.popup, &colors.headers, &colors.frames, /* TJW 960428 do it like EE */
                &colors.mw_sent, &colors.mw_rcvd /* MR 970310 */
               );
        break;


    case 163:                    /* "BiDiBaud"               */
    case 75:                     /* "JanusBaud"              */
        janus_baud = atol (c);
        break;


    case 76:                     /* "ReqTemplate"            */
        error = cfg_CopyString (keyword, &DEFAULT.rq_Template, c);
        break;


    case 77:                     /* "KnownAvail"             */
#ifdef SPECIALMAGICS
        error = cfg_CopyString (keyword, &KNOWN.rq_FILES, c);
#else
error = kwd_unknown;
#endif
        break;


    case 78:                     /* "KnownReqList"           */
        error = cfg_CopyString (keyword, &KNOWN.rq_OKFile, c);
        break;


    case 79:                     /* "KnownAbout"             */
#ifdef SPECIALMAGICS
        error = cfg_CopyString (keyword, &KNOWN.rq_About, c);
#else
error = kwd_unknown;
#endif
        break;


    case 80:                     /* "KnownInbound"           */
        error = cfg_CopySlashString (keyword, &KNOWN.sc_Inbound, c);
        break;


    case 81:                     /* "KnownReqLim"            */
        sscanf (c, "%d %d", &KNOWN.rq_Limit, &KNOWN.rq_Cum_Limit);
        break;


    case 82:                     /* "KnownReqTpl"            */
        error = cfg_CopyString (keyword, &KNOWN.rq_Template, c);
        break;


    case 83:                     /* "ProtAvail"              */
#ifdef SPECIALMAGICS
        error = cfg_CopyString (keyword, &PROT.rq_FILES, c);
#else
error = kwd_unknown;
#endif
        break;


    case 84:                     /* "ProtReqList"            */
        error = cfg_CopyString (keyword, &PROT.rq_OKFile, c);
        break;


    case 85:                     /* "ProtAbout"              */
#ifdef SPECIALMAGICS
        error = cfg_CopyString (keyword, &PROT.rq_About, c);
#else
error = kwd_unknown;
#endif
        break;


    case 86:                     /* "ProtInbound"            */
        error = cfg_CopySlashString (keyword, &PROT.sc_Inbound, c);
        break;


    case 87:                     /* "ProtReqLim"             */
        sscanf (c, "%d %d", &PROT.rq_Limit, &PROT.rq_Cum_Limit);
        break;


    case 88:                     /* "ProtReqTpl"             */
        error = cfg_CopyString (keyword, &PROT.rq_Template, c);
        break;


    case 89:                     /* MR 980104 NodeTimeZone   */
        error = cfg_set_nodetimezone (c);
        break;


    case 90:                     /* obsolete "NoZones"       */
        error = kwd_unknown;
        // no_EMSI = 1;            /* no zones means no EMSI */
        // no_zones = 1;
        break;


    case 91:                     /* "Answer"                 */
        error = cfg_CopyString (keyword, &modem.answer, c);
        break;


    case 92:                     /* "PollTries"              */
        poll_tries = atoi (c);
        break;


    case 93:                     /* "SwapDir"                */
        error = cfg_CopySlashString (keyword, &swapdir, c);
        break;


    case 95:                     /* "Curmudgeon"             */
        curmudgeon = 1;             /* Do it like Randy         */
        break;


    case 96:                     /* "NoWaZOO"                */
        error = cfg_set_nodeflag (&no_WaZOO, NOWAZOO, c); /* r. hoerner */
        break;


    case 97:                     /* "ScreenBlank"            */
        do_screen_blank = 1;
        if (strnicmp (c, MSG_TXT (M_KEY), 3) == 0)
            blank_on_key = 1;
        else if (strnicmp (c, MSG_TXT (M_CALL), 4) == 0)
            blank_on_key = 0;
        break;


    case 98:                     /* "Mark_Kromm"             */
        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;        /* These colors from        */
        colors.popup = 15;          /* Mark Kromm, Fidonet      */
        break;                      /* 1:261/1034               */


    case 99:                     /* "Server"                 */
        server_mode = 1;
        break;


    case 100:                    /* "ModemTrans"             */
        cfg_mdm_trans (c);
        break;


    case 101:                    /* "PreDial"                */
        error = cfg_CopyString (keyword, &modem.dial_setup, c);
        break;


    case 102:                    /* "PreInit"                */
        error = cfg_CopyString (keyword, &modem.init_setup, c);
        break;


    case 103:                    /* "DTRHigh"                */
        // leave_dtr_high = 1;
        error = kwd_unknown;
        break;


    case 104:                    /* "Debug"                  */
        debugging_log = 1;
        break;


    case 105:                    /* "NoZedZap"               */
        error = cfg_set_nodeflag (&no_zapzed, NOZED, c); /* r. hoerner */
        break;


    case 106:                    /* "NoResync"               */
        no_resync = 1;
        break;


    case 107:                    /* "NoSEAlink"              */
        error = cfg_set_nodeflag (&no_sealink, NOSEA, c); /* r. hoerner */
        break;


    case 108:                    /* "FTS-0001"               */
        error = cfg_set_nodeflag (&no_sealink, NOSEA, c); /* r. hoerner */
        error = cfg_set_nodeflag (&no_WaZOO, NOWAZOO, c); /* r. hoerner */
        error = cfg_set_nodeflag (&no_EMSI, NOEMSI, c); /* r. hoerner */
        no_resync = 1;
        no_overdrive = 1;
        break;


    case 109:                    /* "LineUpdate"             */
        immed_update = 1;
        break;


    case 162:                    /* "BiDiOK"                 */
    case 110:                    /* "JanusOK"                */
        cfg_Janus (c);
        break;


    case 111:                    /* "TermInit"               */
        if (modem.terminit_cnt < 4)
            modem.terminit[modem.terminit_cnt++] = ctl_string (c);
        else
            printf ("ERR: TermInit: too many init strings, skipped %s\n", c);
        break;


    case 112:                    /* "DomainKludge"           */
        error = cfg_domain_kludge (c);
        break;


    case 113:                    /* "Snoop"                  */
#if defined(OS_2) | defined(_WIN32)
        /* r.hoerner: name in cfgfile should override environment name  */
        error = cfg_CopyString (keyword, &pipename, c);

        if (pipename == NULL)
        {
            if (getenv ("SNOOPPIPE") != NULL)
                pipename = ctl_string (getenv ("SNOOPPIPE"));
        }

        if (pipename == NULL)
        {
            printf ("ERR: Snoop: no name defined, ignored\n");
            error = kwd_other_err;
        }
#else
error = kwd_unknown;
#endif /* Snoop                    */
        break;


    case 114:                    /* "Flags"                  */
        error = cfg_CopySlashString (keyword, &flag_dir, c);
        break;


    case 115:                    /* "NoHydraChat"            */
        error = cfg_set_nodeflag (&nohydrachat, NOHYCHAT, c); /* r. hoerner */
        break;


    case 116:                    /* "MaxBytes"               */
        sscanf (c, "%ld %ld", &DEFAULT.byte_Limit, &DEFAULT.byte_Cum_Limit);
        break;


    case 117:                    /* "KnownMaxBytes"          */
        sscanf (c, "%ld %ld", &KNOWN.byte_Limit, &KNOWN.byte_Cum_Limit);
        break;


    case 118:                    /* "ProtMaxBytes"           */
        sscanf (c, "%ld %ld", &PROT.byte_Limit, &PROT.byte_Cum_Limit);
        break;


    case 119:                    /* "StartBlkLen"            */
        fstblklen = atoi (c);
        /* if ((fstblklen < 64) || (fstblklen > 2048)) */
        if ((fstblklen < 64) || (fstblklen > 8192))
            fstblklen = 1024;
        break;


    case 120:                    /* "MaxTime"                */
        sscanf (c, "%d %ld", &DEFAULT.time_Limit, &DEFAULT.time_Cum_Limit);
        DEFAULT.time_Limit *= PER_MINUTE / PER_SECOND;
        DEFAULT.time_Cum_Limit *= PER_MINUTE / PER_SECOND;
        break;


    case 121:                    /* "KnownMaxTime"           */
        sscanf (c, "%d %ld", &KNOWN.time_Limit, &KNOWN.time_Cum_Limit);
        KNOWN.time_Limit *= PER_MINUTE / PER_SECOND;
        KNOWN.time_Cum_Limit *= PER_MINUTE / PER_SECOND;
        break;


    case 122:                    /* "ProtMaxTime"            */
        sscanf (c, "%d %ld", &PROT.time_Limit, &PROT.time_Cum_Limit);
        PROT.time_Limit *= PER_MINUTE / PER_SECOND;
        PROT.time_Cum_Limit *= PER_MINUTE / PER_SECOND;
        break;


    case 123:                    /* "RingTries"              */
        ring_tries = atoi (c);
        break;


    case 124:                    /* "NoSharing"              */
        no_sharing = 1;
        break;


    case 125:                    /* "Version7"               */
        break;


    case 126:                    /* "BlankWait"              */
        blank_time = atol (c) * PER_SECOND;
        break;


    case 127:                    /* "Serial"                 */
        if (isdigit (*c))
            serial = atoi (c);
        break;


    case 128:                    /* "NoDietIfna"             */
        error = cfg_set_nodeflag (&no_dietifna, NODIET, c); /* r. hoerner */
        break;

    case 129:                    /* obsolete                */
        error = kwd_unknown;
        break;

    case 130:                    /* "WinSlice"               */
        winslice = 1;
        break;


    case 131:                    /* "NoSize"                 */
        no_size = 1;
        break;


    case 132:                    /* "ForcExit"               */
        forcexit = atoi (c);
        break;


    case 133:                    /* "Extern"                 */
        if (strnicmp (c, "exit", 4) == 0)
            EXTopt = OPT_EXIT;
        else if (strnicmp (c, "batch", 5) == 0)
            EXTopt = OPT_BATCH;
        else if (strnicmp (c, "spawn", 5) == 0)
            EXTopt = OPT_SPAWN;
        else
            error = kwd_bad;
        break;


    case 134:                    /* "NoEMSI"                 */
        error = cfg_set_nodeflag (&no_EMSI, NOEMSI, c); /* r. hoerner */
        break;


    case 135:                    /* "MyLocation"             */
        error = cfg_CopyString (keyword, &def_location, c);
        location = def_location;
        break;


    case 136:                    /* "MyPhone"                */
        error = cfg_CopyString (keyword, &myphone, c);
        break;


    case 137:                    /* "MyListFlags"            */
        error = cfg_CopyString (keyword, &myflags, c);
        break;


    case 138:                    /* "MyMaxbaud"              */
        error = cfg_CopyString (keyword, &mymaxbaud, c);
        break;


    case 139:                    /* "PickupALL"              */
        pickup_all = 1;
        break;


    case 140:                    /* "FileSec"                */
        /* AW 980220 sscanf (c, "%d", &DEFAULT.security); */
        /* new: get classname string, convert into security in b_initva.c   */
        error = cfg_CopyString (keyword, &DEFAULT.userclass, c);
        break;


    case 141:                    /* "KnownSec"               */
        /* AW 980220 sscanf (c, "%d", &KNOWN.security); */
        /* new: get classname string, convert into security in b_initva.c   */
        error = cfg_CopyString (keyword, &KNOWN.userclass, c);
        break;


    case 142:                    /* "ProtSec"                */
        /* AW 980220 sscanf (c, "%d", &PROT.security); */
        /* new: get classname string, convert into security in b_initva.c   */
        error = cfg_CopyString (keyword, &PROT.userclass, c);
        break;


    case 143:                    /* "MaxAreas"               */
        error = cfg_CopyString (keyword, &fri_areadat, c);
        fri_areatype = FRI_MAXIMUS;
        break;


    case 144:                    /* "Domain"                 */
        cfg_domain (c);
        break;


    case 145:                    /* "MailSound"              */
#ifdef BINKLEY_SOUNDS
        fnMailSound = cfg_sound (c);
#else
error = kwd_unknown;
#endif
        break;


    case 146:                    /* "FileSound"              */
#ifdef BINKLEY_SOUNDS
        fnFileSound = cfg_sound (c);
#else
error = kwd_unknown;
#endif
        break;


    case 147:                    /* "BBSSound"               */
#ifdef BINKLEY_SOUNDS
        fnBBSSound = cfg_sound (c);
#else
error = kwd_unknown;
#endif
        break;


    case 148:                    /* "EXTSound"               */
#ifdef BINKLEY_SOUNDS
        fnEXTSound = cfg_sound (c);
#else
error = kwd_unknown;
#endif
        break;


    case 149:                    /* "StartSound"             */
#ifdef BINKLEY_SOUNDS
        fnStartSound = cfg_sound (c);
#else
error = kwd_unknown;
#endif
        break;


    case 150:                    /* "FaxSound"               */
#ifdef BINKLEY_SOUNDS
        fnFAXSound = cfg_sound (c);
#else
error = kwd_unknown;
#endif
        break;


    case 151:                    /* "FaxInDir"               */
        error = cfg_CopySlashString (keyword, &fax_in, c);
        break;


    case 152:                    /* "ModemFailure"           */
        error = cfg_mdm_response (c, FAILURE);
        break;


    case 153:                    /* "ModemIgnore"            */
        error = cfg_mdm_response (c, IGNORE);
        break;


    case 154:                    /* "ModemConnect"           */
        error = cfg_mdm_response (c, CONNECTED);
        break;


    case 155:                    /* "ModemRinging"           */
        error = cfg_mdm_response (c, RINGING); /* "RING" */
        break;


    case 156:                    /* "ModemIncoming"          */
        error = cfg_mdm_response (c, INCOMING); /* "NO DIALTONE" */
        break;


    case 157:                    /* "ModemFax"               */
        error = cfg_mdm_response (c, FAX);
        break;


    case 158:                    /* "CostLog"                */
        error = cfg_CopyString (keyword, &cost_log_name, c);
        break;


    case 159:                    /* "CostUnit"               */
        if (isdigit (*c))
            cost_unit = atoi (c);
        break;


    case 160:                    /* "EuroCost"               */
        eurocost = 1;
        break;


    case 161:                    /* "NoFilter"               */
        if (!*c)
        {
            noMNPFilter = 1;
            break;
        }

        if (noMNPFilter)
        {
            printf ("ERR: NoFilter: %s ignored, already using no filter at all\n",
                    c);
            error = kwd_other_err;
            break;                    /* he's so stuuupid!        */
        }

        if (cMNP > 16)              /* Only 16 allowed          */
        {
            printf ("ERR: NoFilter: can't store more then 16 filters.\n");
            error = kwd_other_err;
            break;
        }

        p = ctl_string (c);         /* Allocate space to copy the result code */
        if (p == NULL)
        {
            error = kwd_nomem;
            break;
        }

        pchMNP[cMNP++] = p;         /* Copy the result code and store the pointer */
        break;


    case 164:                    /* "NoHydra"                */
        error = cfg_set_nodeflag (&no_hydra, NOHYDRA, c); /* r. hoerner */
        break;


    case 165:                    /* "NoJanus"                */
        error = cfg_set_nodeflag (&no_janus, NOJANUS, c); /* r. hoerner */
        break;


    case 166:                    /* "ExtBaudRates"           */
#ifdef EXTENDED_BAUDRATES
        extend_rates = 1;
        pbtypes = exttypes;
#else
error = kwd_unknown;
#endif
        break;


    case 167:                    /* "AfterCall"              */

        error = cfg_parse_aftercall (c);
        break;


    case 168:                    /* "PktRsp"                 */
        pktrsp = 1;
        break;


    case 169:                    /* "ExtSession"             */
        if (!isxdigit (*c))
        {
            error = kwd_bad;
            break;
        }

        sscanf (c, "%x", &itemp);
        ExtMailMask = (word) itemp;

        if (!ExtMailMask)
        {
            error = kwd_bad;
            break;
        }

        c = skip_to_blank (c);
        error = cfg_CopyString (keyword, &ExtMailAgent, c);
        break;


    case 170:                    /* "FaxBaud"                */
        ltemp = atol (c);
        fax_baud = -1;
        for (itemp = 0; pbtypes[itemp].rate_value; itemp++)
        {
            if (pbtypes[itemp].rate_value == (unsigned long) ltemp)
            {
                fax_baud = itemp;
                break;
            }
        }
        if (fax_baud == -1)
            error = kwd_bad;
        break;


    case 171:                    /* "ErrLevelShell"          */
        itemp = atoi (c);
        if ((itemp <= 0) || (itemp > 255))
        {
            printf (MSG_TXT (M_BAD_ERRLEVELSHELLNUM), itemp);
            error = kwd_other_err;
            break;
        }
        c = skip_to_word (c);
        if (c)
        {
            // strupr (c);                      /* MR 970503 not good!      */
            error = cfg_CopyString (keyword, &errlvlshell[itemp - 1], c);
        }
        break;


    case 172:                    /* AltNumber                */
        error = cfg_alt_num (c);
        break;


    case 173:                    /* ModemRetry               */
        error = cfg_mdm_response (c, DIALRETRY);
        break;


    case 174:                    /* RecentActivityLines      */
        itemp = atoi (c);
        if (itemp > 0)
            scrllines = itemp;
        break;


    case 175:                    /* "RingWait"               */
        ring_wait = atoi (c);
        break;


    case 176:                    /* HJK - 99/01/22 FreqLongNames */
        freqlongnames = 1;
        break;


        /* case 177: TJW 960830 [expression] - see parse_config... */


    case 178:                    /* TJW 960830 TaskPath      */
        if (task_dir == BINKpath)
            task_dir = ctl_slash_string (binkdir, c);
        else
            error = cfg_CopySlashString (keyword, &task_dir, c);
        break;


    case 179:                    /* RDH 9604 "ShowAlive"     */
        should_show_alive = 1;
        break;


    case 180:                    /* "ReadHoldTime"           */
    case 208:                    /* "OutboundRescanPeriod"   */
        readholdtime = atol (c);
        if (readholdtime < 1)
            readholdtime = 1;
        readholdtime *= PER_MINUTE;
        break;


    case 181:                    /* "ReInitTime"             */
        reinittime = atol (c);      /* TJW 960421               */
        if (reinittime < 1)
            reinittime = 1;           /* TJW 960421               */
        reinittime *= PER_MINUTE;   /* TJW 960421               */
        break;


    case 182:                    /* CE/TJW 960425 "ConditionalPoll"  */
        error = cfg_condpoll (c);
        break;


    case 183:                    /* CE/TJW 960425 "Reject"   */
        error = cfg_CopyString (keyword, &modem.reject, c);
        break;


    case 184:                    /* TJW 960719 "ProtocolPreference"  */
        error = cfg_CopyString (keyword, &protpreference, c);
        strupr (protpreference);
        break;


    case 185:                    /* MMP 960419 "PutEnv"      */
        p = ctl_string (c);
        if (p == NULL)
        {
            error = kwd_nomem;
            break;
        }

        for (c = p; *c && *c != '='; c++)
            *c = (char) toupper (*c);
        putenv (p);
        break;


    case 186:                    /* MMP 960419 "SpawnInit"   */
        b_spawn (c);
        break;


    case 187:                    /* MMP 960419 "LocalLog"    */
        locallogs = 1;
        break;


    case 188:                    /* MMP 960422 "ShortCostLog"    */
        if (*c)
            error = cfg_CopyString (keyword, &shortcostlog, c);
        else
            shortcostlog =
                "$02y$02m$02d $02H$02M$02S $# $14A $6B $4s $4c $4r $8i $8o $8C $4Y";

        /* MMP 960513 Spaces removed */
        /* TJW 960813 added $4r for remote's cost */
        break;


    case 189:                    /* MMP/TJW 960419 "TimeSync"    */
        itemp = 0;
        error = cfg_set_nodeflag (&itemp, TIMESYNC, c); /* MR 970506 */
        if (itemp)
            error = kwd_bad;          /* syntax error             */
        else
        {
            p = skip_to_word (c);
            if (*p)                   /* MR 970406 max_diff_time  */
                max_diff_trx = atol (p); /*           if given       */
        }
        break;


    case 190:                    /* MMP 960419 "MailFlag"    */
        if (*c)
            error = cfg_CopyString (keyword, &MailFlag, c);
        else
            error = cfg_CopyString (keyword, &MailFlag, "%sbtmail.in");
        break;


    case 191:                    /* TJW 960429 "MakeDir"     */
#ifdef MAKEDIR
        makedir = 1;
#else
error = kwd_unknown;
#endif
        break;


    case 192:                    /* mtt 960502 "SRIF"        */
        for (p = SRIF_commandline; *c; c++, p++) /* TJW 960503               */
        {
            switch (*c)
            {
            case '$':
                *p = '%';               /* % is comment, so use $ instead in cfg    */
                break;
            default:
                *p = *c;
            }
        }
        *p = '\0';
        break;


    case 193:                    /* "AfterConnect" PE 1996-04-25 */
        if (isdigit (*c))
        {
            lines_afterconnect = atoi (c);
            c = skip_to_blank (c);
        }
        error = cfg_CopyString (keyword, &modem.afterconnect, c);
        break;


    case 194:                    /* MaxBusyAge               */
        maxbsyage = atol (c);
        break;


    case 195:                    /* SpawnNoOK                */
        error = cfg_CopyString (keyword, &spawnnook, c);
        break;

    case 196:                    /* "CacheHold"              */
    case 209:                    /* "OutboundCache"          */
#ifdef CACHE
        cachehold = *c ? atoi (c) : 2;
        c = skip_to_word (c);
        if (!memicmp (c, "stat", 4))
            rescanstat = 1;
        else
            rescanstat = 0;
#else
error = kwd_unknown;
#endif
        break;


    case 197:                    /* "PBAreas"                */
        error = cfg_CopyString (keyword, &fri_areadat, c);
        fri_areatype = FRI_PROBOARD;
        break;


    case 198:                    /* ModemReject              */
        error = cfg_CopyString (keyword, &ModemReject, c);
        break;


    case 199:                    /* AfterCallOut             */
        if (isdigit (*c))
        {
            lines_aftercallout = atoi (c);
            c = skip_to_blank (c);
        }
        error = cfg_CopyString (keyword, &modem.aftercallout, c);
        break;


    case 200:                    /* ChangeMailTo             */
        if (!stricmp (c, "CRASH"))
            chg_mail = (int) 'c';
        else if (!stricmp (c, "DIRECT"))
            chg_mail = (int) 'd';
        else if (!stricmp (c, "HOLD"))
            chg_mail = (int) 'h';
        else if (!stricmp (c, "NORMAL"))
            chg_mail = (int) 'f';
        else
            error = kwd_bad;
        break;


    case 201:                    /* TJW 960721 CostTimeCorrection    */
        if (sscanf (c, "%d %d", &costtimecorr_conn, &costtimecorr_sess) != 2)
            error = kwd_bad;
        break;


    case 202:                    /* "IPC"                    */
        error = cfg_CopySlashString (keyword, &ipc_dir, c);
        break;


    case 203:                    /* "ReadLog"                */
        error = cfg_CopyString (keyword, &readlog_name, c);
        break;


    case 204:                    /* "EMSIbanner"             */
        EMSIbanner = 1;
        break;


    case 205:                    /* TJW 960802 "CostCPS"     */
        costcps = atol (c);
        break;


    case 206:                    /* TJW 961010 "MCPpipe"     */
#ifdef OS_2
        /* r.hoerner: name in cfg file should override environment name     */
        error = cfg_CopyString (keyword, &MCPpipename, c);

        if (MCPpipename == NULL)
        {
            if (getenv ("MCPPIPE") != NULL)
                MCPpipename = ctl_string (getenv ("MCPPIPE"));
        }
        if (MCPpipename == NULL)
        {
            printf ("ERR: MCPpipe: no name defined, ignored\n");
            error = kwd_other_err;
        }
#else
error = kwd_unknown;
#endif
        break;


    case 207:                    /* TJW 961013 "WindowTitleFmt"  */
#if defined(OS_2) | defined(_WIN32) // HJK 98/06/13 Added Windows support
        if (*c)
            error = cfg_CopyString (keyword, &title_format, c);
        else
            error = cfg_CopyString (keyword, &title_format, "BT-XE #%d: %s");
#else
        error = kwd_unknown;
#endif
        break;


    case 210:                    /* "CheckPath" */
        check_path = 1;             /* enable CheckPath */

        check_path_errorlevel = atoi (c); /* get variable errorlevel */
        if (check_path_errorlevel < 0) /* in range from 0 - 255 */
            check_path_errorlevel = 0;
        if (check_path_errorlevel > 255)
            check_path_errorlevel = 255;

        c = skip_to_word (c);
        check_path_time = atoi (c); /* get variable time for next */
        if (check_path_time < 1)    /* checking. min 1 second     */
            check_path_time = 1;

        break;


    case 211:                    /* AKAMatching */
        AKA_matching = 1;
        break;


    case 212:                    /* NodeInboundDir */
        error = cfg_set_nodeinbounddir (c);
        break;


    case 213:                    /* SyncHydraSessions */
        error = cfg_set_SyncHydraSessions (c);
        break;

    case 214:                    /* NoModem */
        NoModem = 1;
        break;


    case 215:                    /* MTT reserverd            */
        error = cfg_CopyString (keyword, &HydraMessage, c);
        break;


    case 216:
    case 217:
    case 218:
    case 219:
        error = kwd_bad;
        break;


    case 220:                    /* "SmartBiDi" (switch off hydra in case    */
        smart_bidi = 1;             /* of expected one-way transfer)            */
        if (!stricmp (c, "outgoing")) /* TJW 970216 also enable       */
            smart_bidi_out = 1;       /* smartbidi on outgoing calls  */
        break;

    case 221:                    /* RH reserved              */
    case 222:
    case 223:
    case 224:

    case 225:                    /* NoRescan */
        no_rescan = 1;
        break;

    case 226:                    /* CE reserved             */
    case 227:
    case 228:
    case 229:
        error = kwd_bad;
        break;


    case 230:                    /* TS "NoANSITrash"         */
#ifdef DOS16
        noansitrash = 1;
#else
error = kwd_unknown;
#endif
        break;


    case 231:                    /* CFS "SIOMode"            */
        SIOMode = 1;
        break;


    case 232:                    /* TE 971013 "IpRepChar" */
        if ((*(c + 1)) || (!*c))    /* other than single char  */
            error = kwd_bad;
        else
        {
            cIPRepChar = *c;
            error = kwd_ok;
        }
        break;


    case 233:
        error = kwd_bad;
        break;


    case 234:                    /* JNK 971506 NoZedZip      */
        error = cfg_set_nodeflag (&no_zipzed, NOZIP, c);
        error = cfg_set_nodeflag (&no_zapzed, NOZED, c);
        error = cfg_set_nodeflag (&no_EMSI, NOEMSI, c);
        break;

    case 235:                    /* CFS "BannerCID"          */
        parse_BannerCID (c);
        break;


    case 236:                    /* CFS "ModemCID"           */
        error = cfg_CopyString (keyword, &CIDline, c);
        break;


    case 237:                    /* CFS "StringRep"          */
        parse_stringrep (c, 0);
        break;


    case 238:                    /* CFS "Callback"           */
        itemp = 0;
        error = cfg_set_nodeflag (&itemp, CALLBACK, c); /* MR 970324 */
        if (itemp)
            error = kwd_bad;          /* syntax error             */
        else
        {
            p = skip_to_word (c);
            if (*p)                   /* MR 970406 set CallerID   */
                error = cfg_set_callerid (c, NULL); /* if given       */
        }
        break;


    case 239:                    /* CFS "Nohundredths"       */
        nologhundredths = 1;
        break;


    case 240:                    /* "AssumeBaud <baudrate>"  */
        assumebaud = atol (c);
        break;


    case 241:                    /* "Clock [color] [char]" in screensaver    */
        DrawClock = 1;
        if (c == NULL)
            break;
        if (isdigit (*c))
        {
            sscanf (c, "%u", &itemp);
            clock_color = itemp & 0xff;
            c = skip_to_word (c);
        }
        if (c == NULL)
            break;
        if (*c)
            clock_char = c[0];
        if (clock_char == ' ')
            DrawClock = 0;
        break;


    case 242:                    /* BitType                  */
        exact_mdm_type = 0;
        break;


    case 243:                    /* "ReDialTime <seconds>"   */
        ReDialTime = atol (c);
        if (ReDialTime < 10)
            ReDialTime = 10;
        ReDialTime *= PER_SECOND;
        break;


    case 244:                    /* "EmsiLog <filename>"     */
        error = cfg_CopyString (keyword, &emsilog, c);
        if (emsilog != NULL)
            debug_emsi = 1;
        break;


    case 245:                    /* "NoErrDelay"             */
        no_delay = 1;
        break;


    case 246:                    /* "BinkDir"                */
        binkdir = 1;
        break;


    case 247:                    /* "ShowDomains"            */
        hidedomains = 0;
        break;


    case 248:                    /* "PassWordFile <filename>" */
        error = cfg_CopyString (keyword, &passwordfile, c);
        break;


    case 249:                    /* "ForcedRescan"           */
        rescanforced = 1;
        break;


    case 250:                    /* "NoFancyStrings"         */
        nofancystrings = 1;
        break;


    case 251:                    /* "MaxRingWait <seconds>"  */
        MaxRingWait = atoi (c);
        if (MaxRingWait < 10)
            MaxRingWait = 10;
        if (MaxRingWait > 120)
            MaxRingWait = 120;
        break;


    case 252:                    /* obsolete, was: "HoldAfterBadConnect" */
        error = kwd_unknown;
        break;


    case 253:                    /* "ShowPassword"           */
        show_password = 1;
        break;


    case 254:                    /* "Override <params...>"   */
        error = cfg_override (c);
        break;


    case 255:                    /* "NoWildCards <...>"      */
        error = cfg_set_nodeflag (&noWildcards, NOJOKERS, c);
        break;


    case 256:                    /* "PipeTo <computer>"      */
        cfg_CopyString (keyword, &bink_pipe, c);
        break;


    case 257:                    /* "DelBadCall"             */
        DelBadCall = 1;
        break;


    case 258:                    /* "EventFile <filename>"   */
        if (strcmp (eventfile, PRDCT_PRFXlower ".evt") == 0)
            eventfile = ctl_string (c);
        else
            cfg_CopyString (keyword, &eventfile, c);
        break;


    case 259:                    /* "SharePort"              */
        // HJK 98/06/13 - In some cases it is useful to use it in Windows too
#if defined (OS_2) | defined (_WIN32)
#if defined (NEED_OS2COMMS) | defined (NT)
        share_port = TRUE;
#else
error = kwd_unknown;
#endif
#else
error = kwd_unknown;
#endif
        break;


    case 260:                    /* "MaxPrm"  AW 980219      */
        error = cfg_MaxPrm (keyword, c);
        break;


    case 261:                    /* "ModemRing"              */
        error = cfg_mdm_response (c, RING); /* "RINGING" */
        UseModemRing = 1;
        break;


    case 262:                    /* "cFosCost"               */
        cFosCost = 1;
        break;


    case 263:                    /* CFS "ModemCostReset"     */
        error = cfg_mdm_response (c, COSTRESET);
        UseRingingCost = 1;
        break;


    case 264:                    /* CFS "StatsToMSG"         */
        if ((error = cfg_parse_pktstats (c, &PKTStats)) == kwd_ok)
            DoStats = 1;
        break;


    case 265:                    /* MR 970215 "UseCompletePaths" */
        addBINKpath = BINKpath;
        break;


    case 266:                    /* MR 970215 "ShowModemWin" */
        show_modemwin = 1;
        break;


    case 267:                    /* JNK 970312 "NoTranx"     */
        no_tranx = 1;
        break;


    case 268:                    /* CFS 970310 CAPICID       */
#if !defined(OS_2) || defined(__EMX__)
        error = kwd_unknown;
#else
p = skip_to_word (c);
        p2 = skip_to_word (p);

        if (*c == '\0' || *p == '\0' || *p2 == '\0')
        {
            error = kwd_bad;
            break;
        }

        *skip_to_blank (c) = 0;
        *skip_to_blank (p) = 0;

        do
        {
            /* Word starts at P2 */
            AddCIDTo =

                (char **) realloc (AddCIDTo, (AddCIDToNumber + 1) * sizeof (char *));

            AddCIDTo[AddCIDToNumber++] = p3 = ctl_string (p2);
            while (*p3)
            {
                if (*p3 == ' ')
                {
                    *p3 = 0;
                    break;
                }
                p3++;
            }
            p2 = skip_to_word (p2);
        }
        while (*p2);

        // for (itemp=0; itemp<AddCIDToNumber; itemp++)
        //   printf ("Add ID to modem string: %s\n",AddCIDTo[itemp]);

        // printf ("EAZs: %s\n",c);
        // printf ("Services: %s\n",p);

        if (!CAPIInit (c, p))
        {
            UseCAPICID = 1;
            if (CIDline == NULL)
                CIDline = ctl_string ("/ID=");
        }
#endif
        break;


    case 269:                    /* CFS 971103 CFOS Line     */
#ifdef OS_2
        MonitorCFOS = CFOSMonitorStart ();
#else
error = kwd_unknown;
#endif
        break;


    case 270:                    /* MR 970325 "PreAnswer"    */
        if (modem.answer_setup_cnt < 4)
            modem.answer_setup[modem.answer_setup_cnt++] = ctl_string (c);
        else
        {
            printf ("ERR: PreAnswer: too many init strings, skipped %s\n", c);
            error = kwd_other_err;
        }
        break;


    case 271:                    /* MR 970325 "CallerID"     */
        error = cfg_set_callerid (c, NULL);
        break;


    case 272:                    /* CFS "StringRepModem"     */
        parse_stringrep (c, 1);
        break;


    case 273:                    /* MR 970425 "HangUp"       */
        error = cfg_CopyString (keyword, &modem.hangup, c);
        break;


    case 274:                    /* CFS "Autochatopen"       */
        autochatopen = 1;
        break;


    case 275:                    /* CFS "ChatLogDir"         */
        error = cfg_set_chatlogdir (c);
        break;


    case 276:                    /* Node extra dir           */
        error = cfg_set_nodeextradir (c);
        break;


    case 277:                    /* CFS "Random System"      */
        error = cfg_set_randomsystem (c);
        break;


    case 278:                    /* CFS "Random Sysop"       */
        error = cfg_set_randomsysop (c);
        break;


    case 279:
        error = cfg_set_randomlocation (c); /* CFS "Random location"    */
        break;


    case 280:                    /* CFS "Short History"      */
        HistMode = HIST_SHORT;
        break;


    case 281:                    /* CFS "StatsDef"           */
        error = cfg_statsdef (c);
        break;


    case 282:                    /* JH 980817 "RejectIgnoreSize */
        ltemp = atol (c);
        if (ltemp >= 0)
            rejectignoresize = ltemp;
        break;


    case 283:                    /* CEH 990604 "ReadFlagTime" */
        ltemp = atol (c);
        if (ltemp > 0)
            readflagtime = ltemp;
        break;


    case 284:                    /* "LocalInbound"            */
        error = cfg_CopySlashString (keyword, &local_inbound, c);
        break;


    case 285:                    /* VRP 990820 "OnLine"       */
        SetOnLineTime (c);
        break;


    case 286:                    /* VRP 990824 "SendHoldIfCaller" */
        SendHoldIfCaller = 1;
        break;


    case 287:                    /* VRP 990824 "RestorePoll" */
        RestorePoll = 1;
        RestorePollFlavour[0] = 'c';

        strlwr (c);
        if (strstr (c, "norm") != NULL)
            RestorePollFlavour[0] = 'n';
        else if (strstr (c, "dir") != NULL)
            RestorePollFlavour[0] = 'd';
        else if (strstr (c, "cra") != NULL)
            RestorePollFlavour[0] = 'c';
        else
        {
            printf ("ERR: RestorePoll: unknown flavour '%s', assuming 'crash'\n",
                    c);
            error = kwd_other_err;
        }
        break;


    case 288:                    /* VRP 990830 "Override <params...>" */
        error = cfg_hidden (c);
        break;


    case 289:                    /* VRP 990918 "NetMailFlag" */
        if (*c)
            error = cfg_CopyString (keyword, &NetMailFlag, c);
        else
            error = cfg_CopyString (keyword, &NetMailFlag, "%sbtnetml.in");
        break;


    case 290:                    /* VRP 990918 "ArcMailFlag" */
        if (*c)
            error = cfg_CopyString (keyword, &ArcMailFlag, c);
        else
            error = cfg_CopyString (keyword, &ArcMailFlag, "%sbtarcml.in");
        break;


    case 291:                    /* VRP 990918 "TicFlag"     */
        if (*c)
            error = cfg_CopyString (keyword, &TicFlag, c);
        else
            error = cfg_CopyString (keyword, &TicFlag, "%sbttic.in");
        break;


    case 292:                    /* VRP 990920 "SaveExtSession" */
        SaveExtSession = SAVE_EXT_BOTH;
        if (c && *c)
        {
            strlwr (c);
            if (strncmp (c, "out", 3) == 0)
            {
                SaveExtSession = SAVE_EXT_OUT;
            }
            else if (strncmp (c, "in", 2) == 0)
            {
                SaveExtSession = SAVE_EXT_IN;
            }
        }
        break;

    case 293:
        if (c && *c)
        {
            itemp = atoi (c);
#ifdef OS_2
            DosSetProcessCp (itemp);
#endif

#ifdef _WIN32
            SetConsoleCP (itemp);
            SetConsoleOutputCP (itemp);
#endif
        }
        break;

    default:
        error = kwd_bad;
        break;
    }

    return error;
}


/* MMP 960419
 * cfgfgets() also has some advantages: it supports indented config verbs,
 * another method to specifying task specific lines, and it does not
 * dynamically allocate memory. Using it instead of fgets() we are also sure
 * to NUL-terminate the input line (the original code in parse_config() could
 * trap on very long lines).
 *
 * TJW 960422 changed comment definition to support stuff like:
 *            PutEnv PATH=x:\bt;x:\bt\bin and similar cases.
 *
 * TE 960516 made some changes around the "%"-char to support % in Init strings.
 *
 * TJW 960523 well, just another change, because this was really TOO
 * complicated and yet makes too much complications, therefore the solution
 * (hopefully) - see comments below.
 */

static char *
cfgfgets (char buf[], FILE * fp)
{
    int bufpos = 0;               /* index into buf[] */
    char tmp[CFGLINEBUFSIZE];     /* temporary buffer */
    int tmppos;                   /* index into tmp[] */
    int max = CFGLINEBUFSIZE - 1; /* make sure there is room for end '\0' */
    int ch;
    int comment = 0;              /* 1 if reading a comment */
    int whitespacebefore = 1;     /* TJW 960422 begin of line or char(s) before were white space */
    char *var;

    /*
     * Check for EOF - we might have encountered it while reading previous line
     */
    if (feof (fp))
        return (NULL);

    /*
     * Read line. Check for the special characters '%' and ';' as we read.
     */
    while (ch = fgetc (fp), ch != '\n' && ch != EOF)
        if (!comment)
            switch (ch)
            {
            case '%':
                /*
                 * '%' has a VERY ambiguous semantics:
                 * - it can prefix a "rest of line"-comment (if it is at
                 *   1st non-white-space position in the config line)
                 * - it can designate the start/end of an environment
                 *   variable reference.
                 * - it can be used simply as "%" character
                 *
                 * We resolve this the following way:
                 * 1. if first non-white-space char, it is a comment.
                 * 2. if there are some characters between 2 percent signs
                 *    try to evaluate an environment variable of this name.
                 *    if not, meaning it is followed immediately by another
                 *    %, use it as a single "%" character.
                 * 4. if there is only a single "%" in this line, also use
                 *    it as a single "%" character.
                 */
                if (whitespacebefore && !bufpos)
                {                       /* "%" first non-ws char */
                    comment = 1;
                    break;
                }

                whitespacebefore = 0;
                tmppos = 0;

                while (ch = fgetc (fp), ch != EOF && ch != '\n' && ch != '%')
                    if (tmppos < max)
                        tmp[tmppos++] = (char) ch;
                tmp[tmppos] = '\0';

                /* how did we get out of this loop ? */
                if (ch == '%')
                {                       /* there was a 2nd "%" */
                    if (tmppos == 0)
                    {                     /* it was "%%" -> just use one % */
                        if (bufpos < max)
                            buf[bufpos++] = '%';
                    }
                    else
                    {                     /* env var name is in tmp[] */
                        strupr (tmp);       /* TJW 960422 make it uppercase! */
                        var = getenv (tmp);
                        if (var)
                        {                   /* valid env var -> copy value */
                            while (*var)
                                if (bufpos < max)
                                    buf[bufpos++] = *var++;
                        }
                        else
                        {                   /* there is no such env var */
                            /* -> copy verbatim chars in tmp */
                            for (tmppos = 0;
                                    tmp[tmppos] && (bufpos < max);
                                    buf[bufpos++] = tmp[tmppos++])
                            {;
                            }
                            if (bufpos < max)
                                buf[bufpos++] = '%'; /* copy terminating %, too */
                        }
                    }
                }
                else
                {                       /* EOF or \n -  there was no 2nd "%" */
                    if (bufpos < max)
                        buf[bufpos++] = '%'; /* use it as verbatim "%" char */

                    for (tmppos = 0;
                            tmp[tmppos] && (bufpos < max); buf[bufpos++] = tmp[tmppos++]) ;

                    goto done;            /* there's nothing more in this line */
                }
                break;

                /*
                 * ';' is a bit WEIRD, too:
                 * - it can be a "rest-of-line"-comment
                 * - it can be a literal character
                 *
                 * We resolve this the following way:
                 * 1. if first non-white-space char, it is a comment.
                 * 2. if there is a sequence "<white space>;;", then don't
                 * begin a comment, but just read it as "<white space>;"
                 * 3. if there is a sequence "<white space>;" (and no ";"
                 *    following), it is a comment
                 * 4. in any other case, just read it as ";" - no comment.
                 */
            case ';':
                /*
                 * '#' is checked here, too (though first non-whitespace
                 * only). This makes the fall-through to default easier.
                 */
            case '#':
                if (whitespacebefore)
                {
                    if (!bufpos)          /* ";" first non-ws char */
                    {
                        comment = 1;
                        break;
                    }
                    else if (ch == ';')
                    {
                        whitespacebefore = 0;
                        ch = fgetc (fp);    /* look at next char */
                        if (ch == ';')
                        {                   /* ";" follows again - no comment */
                            if (bufpos < max)
                                buf[bufpos++] = ';';
                        }
                        else if (ch == '\n' || ch == EOF)
                        {                   /* Null length comment */
                            goto done;
                        }
                        else                /* this IS a comment */
                            comment = 1;
                        break;
                    }
                }
                /* else: no break! fall through into default ! */

            default:
                whitespacebefore = isspace (ch); /* don't store blanks  */
                if (!whitespacebefore || bufpos)
                {                       /* at begining of line */
                    /* Store character literally */
                    if (bufpos < max)
                        buf[bufpos++] = (char) ch;
                }
                break;
            }

    /*
     * Done. Strip off trailing spaces, terminate buffer.
     */
done:
    while (bufpos && isspace (buf[bufpos - 1]))
        bufpos--;
    buf[bufpos] = '\0';

    /*
     * If the line begins with a digit, we parse this as a task number. If
     * it is different from TaskNumber, we clear the line buffer. If equal,
     * we remove the number. In this way, we can mix configurations of
     * different lines in the same configuration file.
     */
    if (isdigit (*buf))
    {
        if (atoi (buf) != TaskNumber)
            *buf = '\0';
        else
        {
            char *src, *dest;

            dest = src = buf;
            src = skip_to_word (src);
            while (*src)
                *dest++ = *src++;
            *dest = '\0';
        }
    }

    /*
     * Return result.
     */
    if (*buf == '\0' && ch == EOF)
        return (NULL);
    else
        return (buf);
}

static KWD_ERR
cfg_statsdef (char *c)
{
    LSTATS *ps, *news;
    PKTREP pktr;
    char *c0, *c1, *c2, *c3, *c4;
    int i;

    c0 = skip_to_word (c);        /* All lines or this line only */
    c1 = skip_to_word (c0);       /* Number of days to include in the report */
    c2 = skip_to_word (c1);       /* Number of items to save in each sorted list */
    c3 = skip_to_word (c2);       /* Parameters for cfg_parse_pktstats */

    if (!*c || !*c0 || !*c1 || !*c2 || !*c3)
        return kwd_other_err;

    if (cfg_parse_pktstats (c3, &pktr) != kwd_ok)
        return kwd_other_err;

    *(skip_to_blank (c)) = 0;

    /* Check definition name and create an entry with that name if no dupe */
    if (lstats)
    {
        for (ps = lstats; ps != NULL; ps = ps->next)
            if (!stricmp (ps->name, c))
            {
                printf ("Dupe stats definition name %s\n", c);
                return kwd_other_err;   /* Dupe region, ignore */
            }
    }

    news = (LSTATS *) malloc (sizeof (LSTATS));

    if (!lstats)
        lstats = news;
    else
    {
        for (ps = news; ps->next != NULL; ps = ps->next) ;
        {;
        }
        ps->next = news;
    }

    news->name = ctl_string (c);
    memcpy (&news->pktr, &pktr, sizeof (PKTREP));

    /* Check for All or This in second parameter */
    if (strstrci (c0, "This"))
        i = 0;
    else if (strstrci (c0, "All"))
        i = 1;
    else
    {
        printf ("Second parameter of StatsDef must be 'All' or 'This'.\n");
        strcpy (news->name, "--Invalid--"); /* Invalidate entry */
        return kwd_other_err;
    }

    news->alllines = i;

    /* Check second parameter for number of days */
    *(skip_to_blank (c1)) = 0;
    i = 1;

    for (c4 = c1; *c4; c4++)
    {
        if (!isdigit (*c4))
        {
            i = 0;
            break;
        }
    }

    if (i)
    {
        news->days = atoi (c1);
        news->coverage = DAYS_FIXED;
    }

    return kwd_ok;
}

static KWD_ERR
cfg_parse_pktstats (char *c, PKTREP * PKTStats)
{
    char *p, *p2;
    int itemp;

    parse_address (c, &PKTStats->from);
    memset (&PKTStats->password, 0, 8);
    c = skip_to_word (c);

    if (*c == 0 || c == NULL)
        return kwd_other_err;

    p = c;
    itemp = 0;

    while (*p && *p != ' ')
    {
        if (!isdigit (*p) && (*p != ':' && *p != '/' && *p != '.'))
        {
            itemp = 1;
            break;
        }

        p++;
    }

    p2 = skip_to_word (c);

    while (*p && *p != ' ')
        p++;

    if (*p == ' ')
        *p = 0;

    if (itemp)                    /* Send msg to echo         */
    {
        PKTStats->toecho = 1;
        strntcpy (PKTStats->echo, c, 65);
        // printf ("Logging to echo %s from %u:%u/%u.%u\n",
        //          PKTStats->echo,PKTStats->from.Zone,
        //          PKTStats->from.Net,PKTStats->from.Node,
        //          PKTStats->from.Point);
    }
    else
        /* Send msg to netmail      */
    {
        PKTStats->toecho = 0;
        parse_address (c, &PKTStats->to);
        // printf ("Logging to netmail to %u:%u/%u.%u from %u:%u/%u.%u\n",
        //          PKTStats->to.Zone,
        //          PKTStats->to.Net,PKTStats->to.Node,
        //          PKTStats->to.Point,
        //          PKTStats->from.Zone,
        //          PKTStats->from.Net,PKTStats->from.Node,
        //          PKTStats->from.Point);
    }
    if (p2 != NULL)
        if (*p2)
            /* There are eight bytes for the password - copying */
            /* more would screw the .PKT header up. Note that   */
            /* there isn't room for an ending zero, that's why  */
            /* we use strncpy.                                  */
        {
            strncpy (PKTStats->password, p2, 8);
            // printf ("Using password %s\n",p2);
        }
    return kwd_ok;
}


static KWD_ERR
cfg_set_randomsystem (char *c)
{
    char *t1, *t2, *t3;
    RANDOM_SYSTEM *group;

    t1 = c;
    t2 = skip_to_word (c);

    if (!*t2)
        return kwd_other_err;

    *(skip_to_blank (c)) = 0;

    while (t1 < t2)
    {
        t3 = t1;

        while (*t3 != ',' && *t3)
            t3++;

        *t3 = 0;
        group = QueryRandomGroup (t1, 1);

        if (group)
        {
            group->system = (char**)realloc (group->system, (group->systemcount + 1) *
                                     sizeof (char *));

            group->system[group->systemcount++] = ctl_string (t2);
        }

        t1 = t3 + 1;
    }

    return kwd_ok;
}

static KWD_ERR
cfg_set_randomsysop (char *c)
{
    char *t1, *t2, *t3;
    RANDOM_SYSTEM *group;

    t1 = c;
    t2 = skip_to_word (c);

    if (!*t2)
        return kwd_other_err;

    *(skip_to_blank (c)) = 0;

    while (t1 < t2)
    {
        t3 = t1;

        while (*t3 != ',' && *t3)
            t3++;

        *t3 = 0;
        group = QueryRandomGroup (t1, 1);

        if (group)
        {
            group->sysop = (char**)realloc (group->sysop, (group->sysopcount + 1) * sizeof (char *));

            group->sysop[group->sysopcount++] = ctl_string (t2);
        }
        t1 = t3 + 1;
    }

    return kwd_ok;
}

static KWD_ERR
cfg_set_randomlocation (char *c)
{
    char *t1, *t2, *t3;
    RANDOM_SYSTEM *group;

    t1 = c;
    t2 = skip_to_word (c);

    if (!*t2)
        return kwd_other_err;

    *(skip_to_blank (c)) = 0;

    while (t1 < t2)
    {
        t3 = t1;

        while (*t3 != ',' && *t3)
            t3++;

        *t3 = 0;
        group = QueryRandomGroup (t1, 1);

        if (group)
        {
            group->location = (char**)realloc (group->location, (group->locationcount + 1) * sizeof (char *));

            group->location[group->locationcount++] = ctl_string (t2);
        }

        t1 = t3 + 1;
    }

    return kwd_ok;
}

#ifdef BINKLEY_SOUNDS
static char *
cfg_sound (char *c)             /* malloc & copy to ctl      */
{
    char *dest;
    int i;

    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 = ctl_string (c);        /* allocate space for string */
    return (dest);                /* return the directory name */
}
#endif


static KWD_ERR
cfg_macro (char *c)
{
    int i;
    char *p;

    i = atoi (c);
    if ((i <= 0) || (i > 9))
    {
        printf ("ERR: Macro: %s %d %s\n", MSG_TXT (M_MACRO_NUMBER), i,
                MSG_TXT (M_OUT_OF_RANGE));
        return kwd_other_err;
    }

    c = skip_to_word (c);
    keys[i - 1] = (char*)calloc (1, strlen (c) + 1);
    p = keys[i - 1];

    while (*c && (*c != '\n'))
    {
        if (*c == '|')
            *p++ = '\r';
        else
            *p++ = *c;
        ++c;
    }

    *p = '\0';
    return kwd_ok;
}


void
cfg_dial_string (char *p)
{
    char *p1;
    PN_TRNS *tpn;

    if ((*p == ';') || (*p == '\0'))
    {
        return;
    }

    tpn = (PN_TRNS *) calloc (1, sizeof (PN_TRNS));

    p1 = tpn->num;
    while ((*p) && (!isspace (*p)))
    {
        *p1++ = *p++;
    }
    *p1 = '\0';

    p = skip_blanks (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 *p)
{
    char *p1;
    int i;
    MDM_TRNS *tmm;

    if ((*p == ';') || (*p == '\0'))
    {
        return;
    }

    tmm = (MDM_TRNS *) calloc (1, sizeof (MDM_TRNS));

    tmm->mdm = (byte) atoi (p);
    p = skip_to_word (p);

    p1 = tmm->pre;
    i = sizeof (tmm->pre);
    while (i && (*p) && (*p != '/') && (!isspace (*p)))
    {
        *p1++ = *p++;
        i--;
    }
    *p1 = '\0';

    p1 = tmm->suf;
    if ((*p == '\0') || (isspace (*p)))
    {
        *p1 = '\0';
    }
    else
    {
        ++p;

        i = sizeof (tmm->suf);
        while (i && (*p) && (*p != '/') && (!isspace (*p)))
        {
            *p1++ = *p++;
            i--;
        }
        *p1 = '\0';
    }

    p1 = tmm->ascii;
    while (isspace (*p))
        p++;

    if (*p != '/')
    {
        *p1 = '\0';
    }
    else
    {
        ++p;

        i = sizeof (tmm->ascii);
        while (i && (*p) && (*p != ';') && (!isspace (*p)))
        {
            *p1++ = *p++;
            i--;
        }
        *p1 = '\0';
    }

    tmm->next = NULL;
    if (mm_head == NULL)
    {
        mm_head = tmm;
    }
    else
    {
        mm->next = tmm;
    }
    mm = tmm;
}


void
cfg_domain (char *p)
{
    char *p1, *p2;
    int i;

    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; (i < DOMAINS) && (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 (i < DOMAINS)
                if (domain_name[i] == NULL)
                {
                    domain_name[i] = strdup (p);
                    domain_abbrev[i] = strdup (p2);
                    domain_nodelist[i] = strdup (p1);
                }
        }
    }
}


static KWD_ERR
cfg_domain_kludge (char *p)
{
    word i;

    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);
        p = skip_to_blank (p);
    }
    else
        return kwd_bad;

    p = skip_blanks (p);
    p = strtok (p, "; \t\r\n");
    if (p != NULL)
    {
        for (i = 0; (i < DOMAINS) && (domain_name[i] != NULL); i++)
        {
            if (strnicmp (domain_name[i], p, strlen (domain_name[i])) == 0)
            {
                domainkludge[num_domain_kludge++].domain = i;
                break;
            }
        }
    }
    return kwd_ok;
}


static void
cfg_Janus (char *p)
{
    J_TYPES *tjt;
    char *p1;

    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;
}


static KWD_ERR
cfg_alt_num (char *c)
{
    char *n1, *n2, *p;
    P_ANUMS a1, a2;

    /* Primary starts at first non-blank, ends at blank */

    p = skip_to_blank (c);
    *p++ = '\0';

    n1 = ctl_string (c);
    if (n1 == NULL)
    {
        printf ("ERR: AltNumber: %s\n", MSG_TXT (M_ALTNUM_NO_PRIMARY));
        return kwd_other_err;
    }

    c = skip_blanks (p);
    n2 = ctl_string (c);
    if (n2 == NULL)
    {
        printf ("ERR: AltNumber: %s\n", MSG_TXT (M_ALTNUM_NO_ALTERNATE));
        free (n1);
        return kwd_other_err;
    }

    a1 = (P_ANUMS)calloc (1, sizeof (ANUMS));

    a1->num = n1;
    a1->alt = n2;

    if (anum_head == NULL)
    {
        anum_head = a1;
    }
    else
    {
        /* we need to maintain the order they were entered */
        for (a2 = anum_head; a2->next != NULL; a2 = a2->next) ;
        a2->next = a1;
    }

    return kwd_ok;
}


static KWD_ERR
cfg_mdm_response (char *c, int 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)
        {
            return kwd_nomem;
        }
        max_resp_count = new_max;
        mdm_resps = new_resps;
    }
    mdm_resps[resp_count].resp = ctl_string (c);
    if (mdm_resps[resp_count].resp != NULL)
        mdm_resps[resp_count++].disp = response;

    return kwd_ok;
}


static void
bad_line (int linecounter, char *fname)
{
    long ltemp;

    printf ("ERR: line %d of file '%s'\007\n\n", linecounter, fname);

    if (!no_delay)
    {                             /* R. hoerner: don't bother me */
        ltemp = timerset (5 * PER_SECOND);
        while (!timeup (ltemp))
        {
#ifdef OS_2
            DosSleep (0)
#endif
            ;
        }                           /* TJW 960522 5s delay to show error */
    }
    /*
       (R. Hoerner)
       PLEASE:
       THIS STATEMENT CAUSES AN EXCEPTION! DO NOT ADD IT AGAIN.
       THE "MTASK_FIND" HAS NOT YET RUN!
       SEE B_INITVA.C FOR THE REASON.
       time_release(causes exception)
     */
}


/*--------------------------------------------------------------------*/
/* Remove comments, that are still in line                 R. Hoerner */
/*--------------------------------------------------------------------*/

static void
remove_comments (char *c)
{
    if (c == NULL)
        return;

    while (*c && (*c != ';') && (*c != '%'))
        c++;
    *c = 0;
}


/*--------------------------------------------------------------------*/
/* Set special flags on selective nodes                    R. Hoerner */
/* If no node is specified it sets the global variable to "1"         */
/*--------------------------------------------------------------------*/

static KWD_ERR
cfg_set_nodeflag (int *global, unsigned long flag, char *nodestring)
{
    ADDR addr;
    NODESTRUC *qnode = NULL;

    remove_comments (nodestring);

    if (strlen (nodestring) == 0) /* if not node specific */
    {
        *global = 1;                /* set global variable */
    }
    else
    {
        parse_address (nodestring, &addr);

        /* MR 970314 query node structure; if addr does not yet exist, create new
         *           struct and add it to our list.
         */

        qnode = QueryNodeStruct (&addr, 1);

        if (qnode)
            qnode->Flags |= flag;
        else
            return kwd_other_err;
    }

    return kwd_ok;
}

/*--------------------------------------------------------------------*/
/* Add region to region list                                          */
/*--------------------------------------------------------------------*/
static void LOCALFUNC
cfg_insert_region (word Zone, char *Region)
{
    AKREGION *pr, *newr;

    if (regions)
    {
        for (pr = regions; pr != NULL; pr = pr->next)
            if (pr->Zone == Zone && !strcmp (Region, pr->Region))
                return;                 /* Dupe region, ignore */
    }

    newr = (AKREGION *) malloc (sizeof (AKREGION));

    if (!regions)
        regions = newr;
    else
    {
        for (pr = regions; pr->next != NULL; pr = pr->next) ;
        pr->next = newr;
    }

    newr->Zone = Zone;
    newr->Region = ctl_string (Region);
    newr->next = NULL;
}

/*--------------------------------------------------------------------*/
/* insert your AKA in a list of AKAS                       R. Hoerner */
/*--------------------------------------------------------------------*/

static KWD_ERR
cfg_insert_AKA (char *nodestring)
{
    ADDR addr;
    AKA *pnode = NULL;
    AKA *qnode = NULL;
    char *c, *c2 = NULL;

    remove_comments (nodestring);
    c = skip_to_word (nodestring);

    if (*c)
    {
        c2 = ctl_string (c);
        *c = 0;
    }

    if (parse_address (nodestring, &addr) < 3) /* Less than "Zone:Net/Node" */
    {
        printf ("ERR: Address: unsufficient data\n");
        return kwd_bad;
    }

    if (c2)
    {
        cfg_insert_region (addr.Zone, c2);
        free (c2);
    }

    if (addrMyAddr != NULL)            /* if aka structure exists */
    {
        if ((addrMyAddr->next == NULL)   /* and there is only 1 entry in list */
                && ((word) addrMyAddr->Zone == 1)
                && ((word) addrMyAddr->Net == 0xffff) && ((word) addrMyAddr->Node == 0xffff)) /* and adress is 1:-1/-1 (default) */
        {
            copy_address (&addr, (ADDR*) addrMyAddr); /* than take this structure */
            return kwd_ok;
        }
    }

    for (pnode = addrMyAddr; pnode != NULL; pnode = pnode->next)
    {
        if (SameAddress ((ADDR *) pnode, &addr))
        {
            printf ("Note: Address: duplicate address %u:%u/%u ignored\n",
                    addr.Zone, addr.Net, addr.Node);

            if (pnode->Domain == NULL)
                pnode->Domain = addr.Domain;

            /* CFS 970504 - changed error to OK - Dupe AKA is NOT an error, it is
               common in multiline enviroments where the main AKA for each line is
               define twice (at the line specific part and at the common part). */
            return kwd_ok;
        }
    }

    /* if we reach this point then we didn't find this aka */

    qnode = (AKA *) calloc (1, sizeof (AKA));
    if (qnode == NULL)
    {
        return kwd_nomem;
    }

    if (addrMyAddr == NULL)            /* if first structure */
        addrMyAddr = qnode;
    else
    {
        for (pnode = addrMyAddr; pnode->next != NULL; pnode = pnode->next) ;
        pnode->next = qnode;        /* add new structure */
    }

    copy_address (&addr, (ADDR*) qnode);
    qnode->next = NULL;

    return kwd_ok;
}


/*--------------------------------------------------------------------*/
static char *
GoToNextString (char *p)        /* return next in "xxx,yyy,aaa" */
/*--------------------------------------------------------------------*/
{
    if (p != NULL)
        while (*p && (*p != ' ') && (*p != ',')) /* search for end of flag */
            p++;

    return (p);
}


/*--------------------------------------------------------------------*/
/* set modem flag field of "Override" statement            r. hoerner */
/*--------------------------------------------------------------------*/

static word LOCALFUNC
SetModemFlag (char *modem)
{
    MDM_TRNS *mm;
    char *s, *p;
    word ret;

    /* no "ModemTrans" or no modemflags */
    if ((mm_head == NULL) || modem == NULL || (*modem == '-')) /* VRP 990903 */
    {
        return (0);
    }

    modem = strupr (modem);
    ret = 0;

    /* walk ModemTrans data */
    for (mm = mm_head; mm != NULL; mm = mm->next)
    {
        s = p = modem;
        while (*p)
        {
            p = GoToNextString (p);   /* stops at '\0', ',' and ' ' */

            *p = 0;                   /* terminate string   */

            if (strnicmp (mm->ascii, s, strlen (s)) == 0) /* compare string     */
                ret |= mm->mdm;

            if (!*p)                  /* last string? done! */
                break;

            s = ++p;                  /* else eat next portion    */
        }                           /* or check next ModemTrans */
    }

    if (!ret)
        printf
        ("ERR: Override: ignored modemflag '%s': no such data in ModemTrans\r\n",
         modem);

    return (ret);
}


/*--------------------------------------------------------------------*/
/* set fidoflag field in "Override" statement              r. hoerner */
/*--------------------------------------------------------------------*/

static word LOCALFUNC
SetFidoFlag (char *fido, ADDR* addr)
{
    word ret = 0;

    /* VRP 990903 start */

    if (fido == NULL || (*fido == '-'))
    {
        return (0);
    }

    /* VRP 990903 end */

    fido = strupr (fido);

    while (*fido && (*fido != ' '))
    {
        if (strnicmp (fido, "CM", 2) == 0)
            ret |= B_CM;
        else if (strnicmp (fido, "HUB", 3) == 0)
            ret |= B_hub;
        else if (strnicmp (fido, "RC", 2) == 0)
            ret |= B_region;
        else
            printf ("ERR: Override: unknown flag %s\n", fido);

        fido = GoToNextString (fido); /* stops at '\0', ',' and ' ' */

        if (*fido == ',')
            fido++;
    }
    /* some fields are left:                              */

    if (addr->Point)              /* Point != 0: a Point       */
        ret |= B_point;

    if (addr->Node)               /* Node != 0: no host, no ZC */
        return (ret);

    if (addr->Net)                /* Node == 0, Net != 0: host */
        ret |= B_host;
    else
        ret |= B_zone;              /* Node == 0; Net == 0: a ZC */

    return (ret);
}

/* VRP 990820 start */

/*--------------------------------------------------------------------*/
/* Override node online time                            v. pomortseff */
/*                                                                    */
/* OnLine <address> <starttime>-<endtime> [weekdays]                  */
/*                                                                    */
/*--------------------------------------------------------------------*/

static KWD_ERR LOCALFUNC
SetOnLineTime (char *str)
{
    ADDR addr;
    ONLINE_TIME *online_time = NULL;
    short start = 0, end = 0, days = 0;
    char *p, *node = NULL, *time = NULL;

    remove_comments (str);

    node = str;

    p = skip_to_blank (node);     /* p points after nodenumber  */
    time = skip_to_word (node);   /* num points to phonenumber  */
    *p = 0;

    if (node)
    {
        if (parse_address (node, &addr) < 3) /* Less than "Zone:Net/Node" */
        {
            printf ("ERR: Address: unsufficient data\n");
            return kwd_other_err;
        }

        if (cfg_parse_online_time (time, &start, &end, &days) == kwd_ok)
        {
            online_time = (ONLINE_TIME *) malloc (sizeof (ONLINE_TIME));

            if (online_time == NULL)
            {
                printf ("ERR: Memory error.\n");
                return kwd_nomem;
            }

            copy_address (&addr, (ADDR*) online_time);
            online_time->start = start;
            online_time->end = end;
            online_time->days = days;
            online_time->next = online_time1;
            online_time1 = online_time;

            return kwd_ok;
        }
    }

    return kwd_other_err;
}

static KWD_ERR
cfg_parse_online_time (char *time, short *start, short *end, short *days)
{
    int shour = 0, smin = 0, ehour = 24, emin = 0;

    *start = *end = 0;
    *days = DAY_ALL;

    if (time != NULL && time[0] != '\0')
    {
        if (time[0] == '-')
        {
            shour = smin = ehour = emin = 0;
        }
        else
        {
            if (time[0] != 'C' || time[1] != 'M')
                sscanf (time, "%d:%d - %d:%d", &shour, &smin, &ehour, &emin);
        }

        *start = (short) (shour * 60 + smin);
        *end = (short) (ehour * 60 + emin);
        *days = 0;

        strlwr (time);

        if (strstr (time, "mo") != NULL)
            *days |= DAY_MONDAY;
        if (strstr (time, "tu") != NULL)
            *days |= DAY_TUESDAY;
        if (strstr (time, "we") != NULL)
            *days |= DAY_WEDNESDAY;
        if (strstr (time, "th") != NULL)
            *days |= DAY_THURSDAY;
        if (strstr (time, "fr") != NULL)
            *days |= DAY_FRIDAY;
        if (strstr (time, "sa") != NULL)
            *days |= DAY_SATURDAY;
        if (strstr (time, "su") != NULL)
            *days |= DAY_SUNDAY;
        if (strstr (time, "wk") != NULL)
            *days |= DAY_WEEK;
        if (strstr (time, "wn") != NULL)
            *days |= DAY_WKEND;

        if (*days == 0)
            *days = DAY_ALL;
    }

    return kwd_ok;
}

/* VRP 990820 end */

/*** VRP 20000616 start ***/

/*--------------------------------------------------------------------*/
/* AfterCall - new format                                         VRP */
/*                                                                    */
/* AfterCall <lines> <modem string> [filter]                          */
/*                                                                    */
/*--------------------------------------------------------------------*/

static KWD_ERR
cfg_parse_aftercall (char *c)
{
    KWD_ERR error = kwd_ok;
    struct modem_after_call *aftercall = modem.paftercall;
    char *p;
    int i;

    if (c == NULL || strlen (c) == 0)
        error = kwd_bad;
    else
    {
        if (aftercall == NULL)
        {
            aftercall = (struct modem_after_call *) calloc (1, sizeof (struct modem_after_call));

            if (aftercall == NULL)
                return kwd_nomem;

            memset (aftercall, 0, sizeof (struct modem_after_call));

            modem.paftercall = aftercall;
        }
        else
        {
            while (aftercall->pnext != NULL)
                aftercall = aftercall->pnext;

            aftercall->pnext = (struct modem_after_call *) calloc (1, sizeof (struct modem_after_call));
            aftercall = aftercall->pnext;
            memset (aftercall, 0, sizeof (struct modem_after_call));
        }

        if (isdigit (*c))
        {
            aftercall->lines = atoi (c);
            c = skip_to_word (c);
        }

        for (i = 0, p = c; !isspace (*p) && (*p) != '\0'; i++, p++);

        if (isspace (*p))
        {
            aftercall->command = (char *) calloc (i + 1, sizeof (char));
            strncpy (aftercall->command, c, i);
            aftercall->command[i] = '\0';

            c = skip_to_word (c);
            i = strlen (c);

            if (i)
            {
                aftercall->filter = strdup (c);
            }
        }
        else
            aftercall->command = strdup (c);
    }

    return error;
}

/*** VRP 20000616 end ***/

/*--------------------------------------------------------------------*/
/* Override nodelist                                       r. hoerner */
/*                                                                    */
/* Override <address> <phone> <modemflag,..> <fidoflag,..>            */
/*                                                                    */
/*--------------------------------------------------------------------*/

static KWD_ERR
cfg_override (char *override)
{
    ADDR addr;
    char *p, *q, *r;
    char *node, *num, *modem, *fido;
    PHONE *phone, *tmp;
    word m_flag, f_flag;

    remove_comments (override);

    modem = fido = num = NULL;
    node = override;

    p = skip_to_blank (node);     /* p points after nodenumber  */
    num = skip_to_word (node);    /* num points to phonenumber  */
    if (num)
    {
        q = skip_to_blank (num);    /* q points after phonenumber */
        modem = skip_to_word (num); /* modem points to modemflags */
        if (modem)
        {
            r = skip_to_blank (modem); /* r points after modemflags  */
            fido = skip_to_word (modem); /* fido points to fidoflags   */
            *r = 0;
            r = skip_to_blank (fido); /* terminate all partial strings */
            *r = 0;
        }
        *q = 0;
    }
    *p = 0;

    if (parse_address (node, (ADDR*) & addr) < 3) /* Less than "Zone:Net/Node" */
    {
        printf ("ERR: Override: incomplete nodenumber\n");
        return kwd_other_err;
    }

    if (*num == '-')              /* then this field is "blank" */
        num = NULL;

    if (strlen (modem) == 0)      /* then no such field exists  */
        modem = NULL;
    else if (*modem == '-')       /* then this field is "blank" */
        modem = NULL;

    if (strlen (fido) == 0)       /* then no such field exists  */
        fido = NULL;

    m_flag = f_flag = 0;          /* initialize flags */

    if (num)
        num = ctl_string (num);     /* allocates mem, copies and returns ptr */

    for (phone = phone1; phone != NULL; phone = phone->next)
    {
        if (SameAddress ((ADDR *) phone, &addr))
        {
            if (phone->Domain == NULL)
                ((PHONE *) phone)->Domain = addr.Domain;

            if ((phone->num != NULL) && (num != NULL))
                free (phone->num);      /* give up old stringspace in this case */

            goto insert_datafields;
        }
    }

    /* if we reach this point then we didn't find this aka */

    phone = (PHONE *) calloc (1, sizeof (PHONE));

    if (phone == NULL)
        return kwd_nomem;

    if (phone1 == NULL)           /* if first structure */
        phone1 = phone;
    else
    {
        for (tmp = phone1; tmp->next != NULL; tmp = tmp->next) ;
        tmp->next = phone;
    }

    copy_address (&addr, (ADDR*) phone);

insert_datafields:

    ((PHONE *) phone)->num = num; /* either NULL or valid */

    if (modem != NULL)
        m_flag = SetModemFlag (modem); /* if any modemflag     */

    if (fido != NULL)             /* if any fidoflag      */
        f_flag = SetFidoFlag (fido, &addr);

    if (m_flag)                   /* if really modemflags */
        ((PHONE *) phone)->modem = m_flag;

    if (f_flag)                   /* if really fidoflags  */
        ((PHONE *) phone)->fido = f_flag;

    ((PHONE *) phone)->next = NULL;

    return kwd_ok;
}

/* VRP 990830 start */

/*--------------------------------------------------------------------*/
/* Add hidden line                                      v. pomortseff */
/*                                                                    */
/* Hidden <address> <phone> <modemflag,..> <fidoflag,..> <online>     */
/*                                                                    */
/*--------------------------------------------------------------------*/

static KWD_ERR
cfg_hidden (char *c)
{
    ADDR addr;
    char *p, *q, *r, *s;
    char *node, *num, *modem, *fido, *time;
    HIDDEN *hidden;
    HIDDEN_LINE *hidden_line;

    remove_comments (c);

    modem = fido = num = time = NULL;
    node = c;

    p = skip_to_blank (node);     /* p points after nodenumber  */
    num = skip_to_word (node);    /* num points to phonenumber  */
    if (num)
    {
        q = skip_to_blank (num);    /* q points after phonenumber */
        modem = skip_to_word (num); /* modem points to modemflags */
        if (modem)
        {
            r = skip_to_blank (modem); /* r points after modemflags  */
            fido = skip_to_word (modem); /* fido points to fidoflags   */

            if (fido)
            {
                s = skip_to_blank (fido); /* s points after fidoflags */
                time = skip_to_word (fido); /* time points to online time */
                *s = 0;
            }
            *r = 0;
        }
        *q = 0;
    }
    *p = 0;

    if (parse_address (node, (ADDR*) & addr) < 3) /* Less than "Zone:Net/Node" */
    {
        printf ("ERR: Override: incomplete nodenumber\n");
        return kwd_other_err;
    }

    if (num == NULL || strlen (num) == 0 || *num == '-') /* if this field is "blank" */
    {
        printf ("ERR: Hidden: incomplete phonenumber\n");
        return kwd_other_err;
    }

    if (modem != NULL && (strlen (modem) == 0 || *modem == '-'))
        modem = NULL;

    if (fido != NULL && (strlen (fido) == 0 || *fido == '-'))
        fido = NULL;

    if (num)
        num = ctl_string (num);     /* allocates mem, copies and returns ptr */

    for (hidden = hidden1; hidden != NULL; hidden = hidden->next)
    {
        if (SameAddress ((ADDR *) hidden, &addr))
        {
            if (hidden->Domain == NULL)
                ((HIDDEN *) hidden)->Domain = addr.Domain;

            hidden_line = (HIDDEN_LINE *) calloc (1, sizeof (HIDDEN_LINE));

            if (hidden_line == NULL)
                return kwd_nomem;

            hidden_line->next = hidden->hidden_line1;
            hidden->hidden_line1 = hidden_line;

            goto insert_datafields;
        }
    }

    /* if we reach this point then we didn't find this aka */

    hidden = (HIDDEN *) calloc (1, sizeof (HIDDEN));

    if (hidden == NULL)
        return kwd_nomem;

    copy_address (&addr, (ADDR*) hidden);

    hidden->hidden_line1 = (HIDDEN_LINE *) calloc (1, sizeof (HIDDEN_LINE));

    if (hidden->hidden_line1 == NULL)
    {
        free (hidden);
        return kwd_nomem;
    }

    hidden->next = hidden1;
    hidden->current = NULL;
    hidden1 = hidden;
    hidden1->hidden_line1->next = NULL;

insert_datafields:

    hidden1->hidden_line1->num = num; /* either NULL or valid */
    hidden1->hidden_line1->modem = SetModemFlag (modem); /* if any modemflag */
    hidden1->hidden_line1->fido = SetFidoFlag (fido, &addr);

    return (cfg_parse_online_time (time, &hidden1->hidden_line1->start,
                                   &hidden1->hidden_line1->end,
                                   &hidden1->hidden_line1->days));
}

/* VRP 990830 end */

/* MR 970314 cfg_condpoll */

static KWD_ERR
cfg_condpoll (char *c)
{
    ADDR addr;
    FPP newfp;
    NODESTRUC *qnode = NULL;
    KWD_ERR error = kwd_ok;

    remove_comments (c);

    if (strlen (c) == 0)          /* if not node specific */
        error = kwd_bad;
    else
    {
        newfp = (FPP) calloc (1, sizeof (FP));
        newfp->next = NULL;

        if (!strnicmp (c, "AND", 3))
            newfp->and_op = 1;        /* TJW 960505 boolean op */
        else if (!strnicmp (c, "OR", 2))
            newfp->and_op = 0;        /* TJW 960505 boolean op */

        c = skip_to_word (c);
        parse_address (c, &addr);

        /* MR 970314 query node structure; if addr does not yet exist, create new
         *           struct and add it to our list.
         */

        qnode = QueryNodeStruct (&addr, 1);

        if (qnode == NULL)
            error = kwd_other_err;
        else
        {
            c = skip_to_word (c);
            newfp->Size = atoi (c);   /* Size KB        */

            c = skip_to_word (c);
            newfp->Delta_T = atoi (c); /* delta time     */

            newfp->MinDelta_T = 0;
            newfp->AttachType = 0;

            c = skip_to_word (c);

            if (isdigit (*c))         /* MR 970810      */
                if (isdigit (*(c + 1)))
                    if (!isdigit (*(c + 2)))
                    {
                        newfp->MinDelta_T = atoi (c); /* min delta time */
                        c = skip_to_word (c);
                    }

            if (strchr (c, 'N') || strchr (c, 'n'))
                newfp->AttachType |= AT_NETMAIL;

            if (strchr (c, 'E') || strchr (c, 'e'))
                newfp->AttachType |= AT_ECHOMAIL;

            if (strchr (c, 'O') || strchr (c, 'o'))
                newfp->AttachType |= AT_OTHER;

            if (newfp->AttachType)
                c = skip_to_word (c);

            if (*c)
                error = cfg_set_callerid (c, &addr); /* phonenumber    */

            if (qnode->FPoll == NULL)
            {
                qnode->FPoll = newfp;
                qnode->Flags |= FREEPOLL;
            }
            else
            {
                FPP tmpfp = qnode->FPoll;

                while (tmpfp->next)
                    tmpfp = tmpfp->next;

                tmpfp->next = newfp;
            }
        }
    }

    return error;
}


/* MR 970324 cfg_set_callerid */

static KWD_ERR
cfg_set_callerid (char *c, ADDR* gotaddr)
{
    ADDR addr;
    CIDLSTP newcid;
    CIDLSTP cid;
    NODESTRUC *qnode = NULL;
    KWD_ERR error = kwd_ok;

    if (gotaddr == NULL)
    {
        parse_address (c, &addr);
        gotaddr = &addr;
        c = skip_to_word (c);
    }

    qnode = QueryNodeStruct (gotaddr, 1);

    if (qnode != NULL)
    {
        newcid = (CIDLSTP) calloc (1, sizeof (CIDLST));

        if (newcid != NULL)
        {
            newcid->next = NULL;
            newcid->CallerID = ctl_string (c);

            if (newcid->CallerID != NULL)
            {
                if (qnode->CallerIDList == NULL)
                    qnode->CallerIDList = newcid;
                else
                {
                    cid = qnode->CallerIDList;

                    while (cid->next != NULL)
                        cid = cid->next;

                    cid->next = newcid;
                }
            }
            else
                error = kwd_nomem;
        }
        else
            error = kwd_nomem;
    }
    else
        error = kwd_other_err;

    return error;
}

static KWD_ERR
cfg_set_chatlogdir (char *c)
{
    KWD_ERR error = kwd_ok;

    if (c == NULL)
        error = kwd_bad;

    if (!strlen (c))
        error = kwd_bad;

    ChatLogDir = (char*)realloc (ChatLogDir, strlen (c) + 2);
    strcpy (ChatLogDir, c);

    if (ChatLogDir[strlen (ChatLogDir) - 1] != DIR_SEPC)
        strcat (ChatLogDir, DIR_SEPS);

    return error;
}

/* CFS 970428 cfg_set_nodeextradir */

static KWD_ERR
cfg_set_nodeextradir (char *c)
{
    ADDR addr;
    NODESTRUC *qnode = NULL;
    KWD_ERR error = kwd_ok;
    char *t, *t2;

    t2 = c;

    parse_address (t2, &addr);
    qnode = QueryNodeStruct (&addr, 1);

    if (qnode != NULL)
    {
        c = skip_to_word (t2);
        t = skip_to_blank (c);

        if (*t)
        {
            *t = 0;
            t++;
            while (*t)
            {
                if (toupper (*t) == 'H')
                    qnode->ExtraDirHold = 1;
                if (toupper (*t) == 'N')
                    qnode->ExtraDirNotify = 1;
                t++;
            }
        }

        qnode->ExtraDir = (char *) malloc (strlen (c) + 2);
        strcpy (qnode->ExtraDir, c);
        if (qnode->ExtraDir[strlen (qnode->ExtraDir) - 1] != DIR_SEPC)
            strcat (qnode->ExtraDir, DIR_SEPS);
        error = kwd_ok;
    }
    else
        error = kwd_other_err;

    return error;
}

/* CE 980114 cfg_set_nodeinbounddir */

static KWD_ERR
cfg_set_nodeinbounddir (char *c)
{
    ADDR addr;
    NODESTRUC *qnode = NULL;
    KWD_ERR error = kwd_ok;
    char *t;

    t = c;

    parse_address (t, &addr);
    qnode = QueryNodeStruct (&addr, 1);

    c = skip_to_word (t);
    t = skip_to_blank (c);

    if (qnode != NULL)
    {
        qnode->ExtraDirIn = (char *) malloc (strlen (c) + 2);
        strcpy (qnode->ExtraDirIn, c);
        if (qnode->ExtraDirIn[strlen (qnode->ExtraDirIn) - 1] != DIR_SEPC)
            strcat (qnode->ExtraDirIn, DIR_SEPS);
        error = kwd_ok;
    }
    else
        error = kwd_other_err;

    return error;
}

/* CE 980119 cfg_set_SyncHydraSessions */


static KWD_ERR
cfg_set_SyncHydraSessions (char *c)
{
    ADDR addr;
    NODESTRUC *qnode = NULL;
    KWD_ERR error = kwd_ok;
    char *t;

    t = c;

    parse_address (t, &addr);
    qnode = QueryNodeStruct (&addr, 1);

    if (qnode != NULL)
    {
        qnode->SyncHydraSessions = 1;
        error = kwd_ok;
    }
    else
        error = kwd_other_err;

    return error;
}


/* MR 970204 cfg_set_nodetimezone */

static KWD_ERR
cfg_set_nodetimezone (char *c)
{
    ADDR addr;
    NODESTRUC *qnode = NULL;
    KWD_ERR error = kwd_ok;
    char *nodeTZ, *tmpTZ;
    char junk[128 + 4];

    parse_address (c, &addr);
    c = skip_to_word (c);
    qnode = QueryNodeStruct (&addr, 1);

    if (qnode != NULL)
    {                             /* AW980208 changed NodeTimeZone behaviour */
        nodeTZ = ctl_string (c);    /* compute remote TZUTC time diff to UTC */
        tmpTZ = store_TZ ();        /* save old TZ */

        strcpy (junk, "TZ=");       /* temporary set TZ of remote node */
        strntcpy (junk + 3, nodeTZ, 128);
        putenv (junk);
        tzset ();
        qnode->tzutc = TIMEZONE;    /* get "his" time diff to UTC */

        putenv (tmpTZ);             /* restore old TZ */
        tzset ();
        if (TZ)
            free (TZ);                /* TZ variable was malloc'd */
        TZ = tmpTZ;                 /* set new old TZ */
    }
    else
        error = kwd_other_err;

    return error;
}


/*--------------------------------------------------------------------*/
/* Copies a string with ctl_string. Frees duplicate allocated strings */
/* returns kwd_other_err or kwd_nomem in case of failure, else kwd_ok */
/*--------------------------------------------------------------------*/

KWD_ERR cfg_CopyString (int keyword, char **p, char *c)
{
    KWD_ERR error = kwd_ok;

    if (*p != NULL)
    {
        printf ("ERR: %s: can only store one value\n", config_lines[keyword - 1]);
        printf ("ERR: %s: BT will forget '%s' and use '%s'.\n",
                config_lines[keyword - 1], *p, c);
        free ((void *) *p);
        *p = NULL;
        error = kwd_other_err;
    }

    if (*c)
    {
        *p = ctl_string (c);

        if (*p == NULL)
            error = kwd_nomem;
    }
    else
        error = kwd_bad;

    return error;
}

static KWD_ERR
cfg_CopySlashString (int keyword, char **p, char *c)
{
    KWD_ERR error = kwd_ok;

    if (*p != NULL)
    {
        printf ("ERR: %s: can only store one value\n", config_lines[keyword - 1]);
        printf ("ERR: %s: BT will forget '%s' and use '%s'\n",
                config_lines[keyword - 1], *p, c);
        free ((void *) *p);
        *p = NULL;
        error = kwd_other_err;
    }

    if (*c)
    {
        *p = ctl_slash_string (binkdir, c);

        if (*p == NULL)
            error = kwd_nomem;
    }
    else
        error = kwd_bad;

    return error;
}

/* $Id: btconfig.cpp,v 1.3 2005/01/03 03:55:06 vildanov Exp $ */

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us