File: ckuus5.c

package info (click to toggle)
ckermit 193-3
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 6,180 kB
  • ctags: 8,803
  • sloc: ansic: 118,504; makefile: 2,474; sh: 52
file content (7693 lines) | stat: -rw-r--r-- 210,343 bytes parent folder | download
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
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
#include "ckcsym.h"

#ifndef NOICP

/*  C K U U S 5 --  "User Interface" for C-Kermit, part 5  */
 
/*
  Author: Frank da Cruz <fdc@columbia.edu>,
  Columbia University Academic Information Systems, New York City.

  Copyright (C) 1985, 1998, Trustees of Columbia University in the City of New
  York.  The C-Kermit software may not be, in whole or in part, licensed or
  sold for profit as a software product itself, nor may it be included in or
  distributed with commercial products or otherwise distributed by commercial
  concerns to their clients or customers without written permission of the
  Office of Kermit Development and Distribution, Columbia University.  This
  copyright notice must not be removed, altered, or obscured.
*/

/* Includes */

#include "ckcdeb.h"
#include "ckcasc.h"
#include "ckcker.h"
#include "ckuusr.h"
#include "ckcnet.h"
#ifndef NOCSETS
#include "ckcxla.h"
#endif /* NOCSETS */
#ifdef MAC
#include "ckmasm.h"
#endif /* MAC */

#ifdef OS2
#include "ckoetc.h"
#ifndef NT
#define INCL_NOPM
#define INCL_VIO /* Needed for ckocon.h */
#include <os2.h>
#undef COMMENT
#else /* NT */
#include <windows.h>
#define TAPI_CURRENT_VERSION 0x00010004
#include <tapi.h>
#include <mcx.h>
#include "ckntap.h"
#define APIRET ULONG
extern int DialerHandle;
extern int StartedFromDialer;
#endif /* NT */
#include "ckouni.h"
#include "ckocon.h"
#include "ckokey.h"
#ifdef putchar
#undef putchar
#endif /* putchar */
#define putchar(x) conoc(x)
extern int cursor_save ;
extern bool cursorena[] ;
#endif /* OS2 */

/* For formatted screens, "more?" prompting, etc. */

#ifdef FT18
#define isxdigit(c) isdigit(c)
#endif /* FT18 */

#ifdef STRATUS				/* Stratus Computer, Inc.  VOS */
#ifdef putchar
#undef putchar
#endif /* putchar */
#define putchar(x) conoc(x)
#ifdef getchar
#undef getchar
#endif /* getchar */
#define getchar(x) coninc(0)
#endif /* STRATUS */

/* External variables */

extern int carrier, cdtimo, local, quiet, backgrd, bgset, sosi, suspend,
  displa, binary, deblog, escape, xargs, flow, cmdmsk, bye_active,
  duplex, ckxech, pktlog, seslog, what, protocol,
  keep, tlevel, cwdf, nfuncs, unkcs, msgflg, remfile, rempipe, remappd,
  mdmtyp, zincnt, cmask, rcflag, success, xitsta, pflag, lf_opts, tnlm, tn_nlm,
  xfrcan, xfrchr, xfrnum, xitwarn, debses, pktpaus, autodl, xaskmore, fncnv;

extern int ngetpath, exitonclose;
extern char * getpath[];

extern char * nm[];

#ifdef CK_UTSNAME
extern char unm_mch[];
extern char unm_mod[];
extern char unm_nam[];
extern char unm_rel[];
extern char unm_ver[];
#endif /* CK_UTSNAME */

#ifndef NOPUSH
#ifndef NOFRILLS
extern char editor[];
extern char editfile[];
extern char editopts[];
#ifdef BROWSER
extern char browser[];
extern char browsopts[];
extern char browsurl[];
#endif /* BROWSER */
#endif /*  NOFRILLS */
#endif /* NOPUSH */

#ifndef NOSERVER
extern char * x_user, * x_passwd, * x_acct;
#endif /* NOSERVER */

#ifndef NOSPL
extern int fnerror, fnsuccess;
extern int cfilef, xxdot;

struct localvar * localhead[MACLEVEL];
struct localvar * localtail = NULL;
struct localvar * localnext = NULL;

_PROTOTYP( static VOID shoinput, (void) );
_PROTOTYP( static char gettok,   (void) );
_PROTOTYP( static VOID factor,   (void) );
_PROTOTYP( static VOID term,     (void) );
_PROTOTYP( static VOID termp,    (void) );
_PROTOTYP( static VOID exprp,    (void) );
_PROTOTYP( static VOID expr,     (void) );
_PROTOTYP( static VOID simple,   (void) );
_PROTOTYP( static VOID simpler,  (void) );
_PROTOTYP( static VOID simplest, (void) );
_PROTOTYP( static long xparse,   (void) );
#endif /* NOSPL */

#ifdef MAC
char * ckprompt = "Mac-Kermit>";	/* Default prompt for Macintosh */
#else  /* Not MAC */
#ifdef NOSPL
#ifdef OS2
char * ckprompt = "K-95> ";		/* Default prompt for Win32 */
#else
char * ckprompt = "C-Kermit>";
#endif /* NT */
#else  /* NOSPL */
#ifdef OS2
/* Default prompt for OS/2 and Win32 */
char * ckprompt = "[\\freplace(\\v(dir),/,\\\\)] K-95> ";	
#else
#ifdef VMS
char * ckprompt = "\\v(dir) C-Kermit>";	/* Default prompt VMS */
#else
char * ckprompt = "[\\v(dir)] C-Kermit>";	/* Default prompt for others */
#endif /* VMS */
#endif /* NT */
#endif /* NOSPL */
#endif /* MAC */

#ifndef CCHMAXPATH
#define CCHMAXPATH 257
#endif /* CCHMAXPATH */
char inidir[CCHMAXPATH] = { NUL, NUL };	/* Directory INI file executed from */

#ifdef TCPSOCKET 
extern int tn_b_nlm;			/* TELNET BINARY newline mode */
extern int me_binary, u_binary;
#endif /* TCPSOCKET */

#ifndef NOKVERBS
extern struct keytab kverbs[];		/* Table of \Kverbs */
extern int nkverbs;			/* Number of \Kverbs */
#endif /* NOKVERBS */

#ifndef NOPUSH
extern int nopush;
#endif /* NOPUSH */

#ifdef CK_RECALL
extern int cm_recall;
#endif /* CK_RECALL */

extern char *ccntab[];

/* Printer stuff */

extern char *printername;
extern int printpipe;
#ifdef BPRINT
extern int printbidi, pportparity, pportflow;
extern long pportspeed;
#endif /* BPRINT */

#ifdef OS2
_PROTOTYP (int os2getcp, (void) );
_PROTOTYP (int os2getcplist, (int *, int) );
#ifdef OS2MOUSE
extern int tt_mouse;
#endif /* OS2MOUSE */
extern int tt_update, tt_updmode, tt_font, updmode;
extern struct keytab termfont[];
extern int ntermfont;
extern unsigned char colornormal, colorunderline, colorstatus,
    colorhelp, colorselect, colorborder, colorgraphic, colordebug,
    colorreverse;
extern int priority;
extern struct keytab prtytab[];
extern int nprty;
char * cmdmac = NULL;
#endif /* OS2 */

#ifdef VMS
_PROTOTYP (int zkermini, (char *, int, char *) );
#endif /* VMS */

#ifndef NOFRILLS
extern int en_asg, en_cwd, en_cpy, en_del, en_dir, en_fin, en_bye, en_ret,
  en_get, en_hos, en_que, en_ren, en_sen, en_set, en_spa, en_typ, en_who,
  en_mai, en_pri, en_mkd, en_rmd;
#endif /* NOFRILLS */
extern long vernum;
#ifdef CK_AUTODL
extern int inautodl;
#endif /* CK_AUTODL */
extern int srvtim, srvdis, inecho, insilence, inbufsize, nvars, inintr;
extern char *protv, *fnsv, *cmdv, *userv, *ckxv, *ckzv, *ckzsys, *xlav,
 *cknetv, *clcmds;
#ifdef OS2
extern char *ckonetv;
extern int interm;
#ifdef CK_NETBIOS
extern char *ckonbiv;
#endif /* CK_NETBIOS */
#ifdef OS2MOUSE
extern char *ckomouv;
#endif /* OS2MOUSE */
#endif /* OS2 */
extern char *connv, *dialv, *loginv, *nvlook();

#ifndef NOSCRIPT
extern int secho;
#endif /* NOSCRIPT */

#ifndef NODIAL
extern int nmdm, dirline;
extern struct keytab mdmtab[];
#endif /* NODIAL */

extern int network;
#ifdef NETCONN
extern int ttnproto;
#endif /* NETCONN */

#ifdef OS2
/* SET TERMINAL items... */
extern int tt_type, tt_arrow, tt_keypad, tt_wrap, tt_answer, tt_scrsize[];
extern int tt_bell, tt_roll[], tt_ctstmo, tt_cursor, tt_pacing;
extern char answerback[];  
extern struct tt_info_rec tt_info[];	/* Indexed by terminal type */
extern int max_tt;
#endif /* OS2 */

#ifdef CK_TTGWSIZ
_PROTOTYP( int ttgwsiz, (void) );
#endif /* CK_TTGWSIZ */
_PROTOTYP( VOID shotrm, (void) );
_PROTOTYP( int shofea, (void) );

#ifdef OS2
extern int tt_rows[], tt_cols[];
#else /* OS2 */
extern int tt_rows, tt_cols;
#endif /* OS2 */
extern int cmd_rows, cmd_cols;

#ifdef CK_TMPDIR
extern int f_tmpdir;			/* Directory changed temporarily */
extern char savdir[];			/* Temporary directory */
#endif /* CK_TMPDIR */

#ifndef NOLOCAL
extern int tt_crd, tt_escape;
#endif /* NOLOCAL */

#ifndef NOCSETS
extern int language, nfilc, tcsr, tcsl;
extern struct keytab fcstab[];
extern struct csinfo fcsinfo[];
#ifndef MAC
extern struct keytab ttcstab[];
#endif /* MAC */
#endif /* NOCSETS */

extern int atcapr,
  atenci, atenco, atdati, atdato, atleni, atleno, atblki, atblko,
  attypi, attypo, atsidi, atsido, atsysi, atsyso, atdisi, atdiso; 

#ifdef STRATUS
extern int atfrmi, atfrmo, atcrei, atcreo, atacti, atacto;
#endif /* STRATUS */

#ifdef CK_PERMS
extern int atlpri, atlpro, atgpri, atgpro;
#endif /* CK_PERMS */

extern long speed;

extern char *DIRCMD, *PWDCMD, *DELCMD;
#ifndef NOXMIT
extern int xmitf, xmitl, xmitp, xmitx, xmits, xmitw, xmitt;
extern char xmitbuf[];
#endif /* NOXMIT */

extern char **xargv, *versio, *ckxsys, *dftty, *cmarg, *lp;

#ifdef DCMDBUF
extern char *cmdbuf, *atmbuf;		/* Command buffers */
#ifndef NOSPL
extern char *savbuf;			/* Command buffers */
#endif /* NOSPL */
#else
extern char cmdbuf[], atmbuf[];		/* Command buffers */
#ifndef NOSPL
extern char savbuf[];			/* Command buffers */
#endif /* NOSPL */
#endif /* DCMDBUF */

extern char toktab[], ttname[], psave[];
extern CHAR sstate, feol;
extern int cmflgs, techo, repars, ncmd;
extern struct keytab cmdtab[];

#ifndef NOSETKEY
KEY *keymap;
#ifndef OS2
#define mapkey(x) keymap[x]
#endif /* OS2 */
MACRO *macrotab;
_PROTOTYP( VOID shostrdef, (CHAR *) );
#endif /* NOSETKEY */

#ifndef NOSPL
extern struct mtab *mactab;
extern struct keytab mackey[];
extern struct keytab vartab[], fnctab[];
extern int cmdlvl, maclvl, nmac, mecho, fndiags, fnerror;
#endif /* NOSPL */

FILE *tfile[MAXTAKE];			/* TAKE file stack */
char *tfnam[MAXTAKE];
int tfline[MAXTAKE];

int topcmd = -1;			/* cmdtab index of current command */

#ifdef DCMDBUF				/* Initialization filespec */
char *kermrc = NULL;
#else
char kermrcb[KERMRCL];
char *kermrc = kermrcb;
#endif /* DCMDBUF */

int noherald = 0;
int cm_retry = 1;			/* Command retry enabled */
xx_strp xxstring = zzstring;

#ifndef NOSPL

extern long ck_alarm;
extern char alrm_date[], alrm_time[];

extern int query;			/* QUERY active */

/* Local declarations */

static int nulcmd = 0;			/* Flag for next cmd to be ignored */

/* Definitions for predefined macros */

/* First, the single-line macros, installed with addmac()... */

/* IBM-LINEMODE macro */
char *m_ibm = "set parity mark, set dupl half, set handsh xon, set flow none";

/* FATAL macro */
char *m_fat = "if def \\%1 echo \\%1, if not = \\v(local) 0 hangup, stop 1";

#ifdef CK_SPEED
#ifdef IRIX
char *m_fast = "set window 30, set rec pack 8000, set send pack 4000,\
 set pref cautious";
#else
#ifdef pdp11
char *m_fast = "set win 3, set rec pack 1024, set prefix cautious";
#else
#ifdef BIGBUFOK
char *m_fast = "set win 30, set rec pack 8000, set prefix cautious";
#else
char *m_fast = "set win 4, set rec pack 2200, set prefix cautious";
#endif /* BIGBUFOK */
#endif /* IRIX */
#endif /* pdp11 */
#ifdef pdp11
char *m_cautious = "set win 2, set rec pack 512, set prefixing cautious";
#else
char *m_cautious = "set win 4, set rec pack 1000, set prefixing cautious";
#endif /* pdp11 */
char *m_robust = "set win 1, set rec pack 90, set prefixing all";
#else
#ifdef BIGBUFOK
#ifdef IRIX
char *m_fast = "set win 20, set rec pack 4096, set send pack 4000";
#else
char *m_fast = "set win 20, set rec pack 4096";
#endif /* IRIX */
#else
char *m_fast = "set win 4, set rec pack 2200";
#endif /* BIGBUFOK */
char *m_cautious = "set win 4, set rec pack 1000";
char *m_robust = "set win 1, set rec pack 90";
#endif /* CK_SPEED */

/* Now the multiline macros, defined with addmmac()... */

/* FOR macro */
char *for_def[] = { "_assign _for\\v(cmdlevel) { _getargs,",
"define \\\\\\%1 \\feval(\\%2),:_..top,if \\%5 \\\\\\%1 \\%3 goto _..bot,",
"\\%6,:_..inc,incr \\\\\\%1 \\%4,goto _..top,:_..bot,_putargs},",
"def break goto _..bot, def continue goto _..inc,",
"do _for\\v(cmdlevel) \\%1 \\%2 \\%3 \\%4 { \\%5 },_assign _for\\v(cmdlevel)",
""};

/* WHILE macro */
char *whil_def[] = { "_assign _whi\\v(cmdlevel) {_getargs,",
":_..inc,\\%1,\\%2,goto _..inc,:_..bot,_putargs},",
"_def break goto _..bot, _def continue goto _..inc,",
"do _whi\\v(cmdlevel),_assign _whi\\v(cmdlevel)",
""};

/* SWITCH macro */
char *sw_def[] = { "_assign _sw_\\v(cmdlevel) {_getargs,",
"_forward \\%1,\\%2,:default,:_..bot,_putargs},_def break goto _..bot,",
"do _sw_\\v(cmdlevel),_assign _sw_\\v(cmdlevel)",
""};

/* XIF macro */
char *xif_def[] = {
"_assign _if\\v(cmdlevel) {_getargs,\\%1,_putargs},",
"do _if\\v(cmdlevel),_assign _if\\v(cmdlevel)",
""};

/*
  Variables declared here for use by other ckuus*.c modules.
  Space is allocated here to save room in ckuusr.c.
*/
#ifdef DCMDBUF
struct cmdptr *cmdstk;
int *ifcmd, *count, *iftest, *intime, *inpcas, *takerr, *merror;
#else
struct cmdptr cmdstk[CMDSTKL];
int ifcmd[CMDSTKL], count[CMDSTKL], iftest[CMDSTKL], intime[CMDSTKL],
  inpcas[CMDSTKL], takerr[CMDSTKL], merror[CMDSTKL];
#endif /* DCMDBUF */

char *m_line[MACLEVEL] = { NULL, NULL };
char **m_xarg[MACLEVEL];
int n_xarg[MACLEVEL];
char *m_arg[MACLEVEL][NARGS];
char *g_var[GVARS], *macp[MACLEVEL], *mrval[MACLEVEL];
int macargc[MACLEVEL];
char *macx[MACLEVEL];
extern char varnam[];

/* Dimension must be 'z' - ARRAYBASE + 1 */

char **a_ptr[28];			/* Array pointers, for arrays a-z */
int a_dim[28];				/* Dimensions for each array */

char **aa_ptr[CMDSTKL][28];		/* Array stack for automatic arrays */
int aa_dim[CMDSTKL][28];		/* Dimensions for each array */

char * inpbuf = NULL;			/* Buffer for INPUT and REINPUT */
extern char * inpbp;			/* Global/static pointer to it  */
char inchar[2] = { NUL, NUL };		/* Last character that was INPUT */
int  incount = 0;			/* INPUT character count */
extern int instatus;			/* INPUT status */
static char * i_text[] = {		/* INPUT status text */
    "success", "timeout", "interrupted", "internal error", "i/o error"
};

char lblbuf[LBLSIZ];			/* Buffer for labels */
#else
int takerr[MAXTAKE];
#endif /* NOSPL */

int pacing = 0;				/* OUTPUT pacing */

#ifdef DCMDBUF
char *line;				/* Character buffer for anything */
char *tmpbuf;
#else
char line[LINBUFSIZ+1];
char tmpbuf[TMPBUFSIZ+1];		/* Temporary buffer */
#endif /* DCMDBUF */
char *tp;				/* Temporary buffer pointer */

#ifdef CK_APC				/* Application Program Command (APC) */
int apcactive = APC_INACTIVE;
int apcstatus = APC_OFF;		/* OFF by default everywhere */
#ifdef DCMDBUF
char *apcbuf;
#else
char apcbuf[APCBUFLEN];
#endif /* DCMDBUF */
#endif /* CK_APC */

extern char pktfil[],
#ifdef DEBUG
  debfil[],
#endif /* DEBUG */
#ifdef TLOG
  trafil[],
#endif /* TLOG */
  sesfil[];

#ifndef NOFRILLS
extern int rmailf, rprintf;		/* REMOTE MAIL & PRINT items */
extern char optbuf[];
#endif /* NOFRILLS */

char *homdir = "";			/* Pointer to home directory string */

char numbuf[20];			/* Buffer for numeric strings. */
int noinit = 0;				/* Flag for skipping init file */

#ifndef NOSPL
_PROTOTYP( VOID freelocal, (int) );
_PROTOTYP( static long expon, (long, long) );
_PROTOTYP( static long gcd, (long, long) );
_PROTOTYP( static long fact, (long) );

int			/* Initialize macro data structures. */
macini() {		/* Allocate mactab and preset the first element. */
    int i;
    if (!(mactab = (struct mtab *) malloc(sizeof(struct mtab) * MAC_MAX)))
      return(-1);
    mactab[0].kwd = NULL;
    mactab[0].mval = NULL;
    mactab[0].flgs = 0;
    for (i = 0; i < MACLEVEL; i++)
      localhead[i] = NULL;
    return(0);
}
#endif /* NOSPL */

/*  C M D S R C  --  Returns current command source  */

int
cmdsrc() {
#ifndef NOSPL
    if (cmdlvl == 0)
      return(0);
    else if (cmdstk[cmdlvl].src == CMD_MD)
      return(2);
    else if (cmdstk[cmdlvl].src == CMD_TF)
      return(1);
    else
      return(-1);
#else
    if (tlevel < 0)
      return(0);
    else
      return(1);
#endif /* NOSPL */
}

/*  C M D I N I  --  Initialize the interactive command parser  */
 
static int cmdinited = 0;		/* Command parser initialized */
int cmdint = 1;				/* Interrupts are allowed */

VOID
cmdini() {
    int i, x, y, z;
#ifdef TTSPDLIST
    long * ss;
    extern int nspd;
    extern struct keytab * spdtab;
#endif /* TTSPDLIST */

#ifndef NOSPL
/*
  On stack to allow recursion!
*/
    char vnambuf[VNAML];		/* Buffer for variable names */
#endif /* NOSPL */

    if (cmdinited)			/* Already initialized */
      return;				/* Don't do it again */

#ifndef NOSETKEY			/* Allocate & initialize the keymap */
    if (!(keymap = (KEY *) malloc(sizeof(KEY)*KMSIZE)))
      fatal("cmdini: no memory for keymap");
    if (!(macrotab = (MACRO *) malloc(sizeof(MACRO)*KMSIZE)))
      fatal("cmdini: no memory for macrotab");
    for (i = 0; i < KMSIZE; i++) {
       keymap[i] = (KEY) i;
       macrotab[i] = NULL;
    }
#endif /* NOSETKEY */

#ifdef TTSPDLIST
    if (!spdtab && (ss = ttspdlist())) { /* Get speed list if necessary */
	int j, k, m = 0, n;		/* Create sorted keyword table */
	char buf[16];
	char * p;
	if ((spdtab =
	     (struct keytab *) malloc(sizeof(struct keytab) * ss[0]))) {
	    for (i = 1; i <= ss[0]; i++) { /* ss[0] = number of elements */
		if (ss[i] < 1L) break;	   /* Shouldn't happen */
		buf[0] = NUL;		   /* Make string */
		sprintf(buf,"%ld",ss[i]);
		if (ss[i] == 134L) strcat(buf,".5");
		n = strlen(buf);
		if ((n > 0) && (p = (char *)malloc(n+1))) {
		    if (m > 0) {	/* Have at least one in list */
			for (j = 0;	/* Find slot */
			     j < m && strcmp(buf,spdtab[j].kwd) > 0;
			     j++
			     )
			  ;
			if (j < m) {	/* Must insert */
			    for (k = m-1; k >= j; k--) { /* Move others down */
				spdtab[k+1].kwd = spdtab[k].kwd;
				spdtab[k+1].flgs = spdtab[k].flgs;
				spdtab[k+1].kwval = spdtab[k].kwval;
			    }
			}
		    } else		/* First one */
		      j = 0;
		    strcpy(p,buf);	/* Add new speed */
		    spdtab[j].kwd = p;
		    spdtab[j].flgs = 0;
		    spdtab[j].kwval = (int) ss[i] / 10;
		    m++;		/* Count this one */
		}
	    }
	} 
	nspd = m;
    }
#endif /* TTSPDLIST */

#ifndef NOSPL
    /* Allocate INPUT command buffer */
    if (!inpbuf) {
	if (!(inpbuf = (char *) malloc(INPBUFSIZ+1)))
	  fatal("cmdini: no memory for INPUT buffer");
    }
    for (x = 0; x < INPBUFSIZ; x++)	/* Initialize it */
      inpbuf[x] = NUL;
    inpbp = inpbuf;			/* Initialize pointer */
    inbufsize = INPBUFSIZ;		/* and size. */
#endif /* NOSPL */

#ifdef DCMDBUF
    if (cmsetup() < 0) fatal("Can't allocate command buffers!");

#ifndef NOSPL
    /* Allocate command stack allowing command parser to call itself */

    if (!(cmdstk = (struct cmdptr *) malloc(sizeof(struct cmdptr)*CMDSTKL)))
      fatal("cmdini: no memory for cmdstk");
    if (!(ifcmd = (int *) malloc(sizeof(int)*CMDSTKL)))
      fatal("cmdini: no memory for ifcmd");
    if (!(count = (int *) malloc(sizeof(int)*CMDSTKL)))
      fatal("cmdini: no memory for count");
    if (!(iftest = (int *) malloc(sizeof(int)*CMDSTKL)))
      fatal("cmdini: no memory for iftest");
    if (!(intime = (int *) malloc(sizeof(int)*CMDSTKL)))
      fatal("cmdini: no memory for intime");
    if (!(inpcas = (int *) malloc(sizeof(int)*CMDSTKL)))
      fatal("cmdini: no memory for inpcas");
    if (!(takerr = (int *) malloc(sizeof(int)*CMDSTKL)))
      fatal("cmdini: no memory for takerr");
    if (!(merror = (int *) malloc(sizeof(int)*CMDSTKL)))
      fatal("cmdini: no memory for merror");
    if (!kermrc)
      if (!(kermrc = (char *) malloc(KERMRCL+1)))
	fatal("cmdini: no memory for kermrc");
#ifdef CK_APC
/* Application Program Command buffer */
    if (!(apcbuf = malloc(APCBUFLEN + 1)))
	fatal("cmdini: no memory for apcbuf");
#endif /* CK_APC */
#endif /* NOSPL */

/* line[] and tmpbuf[] are the two string buffers used by the command parser */

    if (!(line = malloc(LINBUFSIZ + 1)))
	fatal("cmdini: no memory for line");
    if (!(tmpbuf = malloc(LINBUFSIZ + 1)))
	fatal("cmdini: no memory for tmpbuf");
#endif /* DCMDBUF */

#ifndef NOSPL
#ifdef CK_MINPUT
    {					/* Initialize MINPUT pointers */
	int i;
	extern char *ms[];
	for (i = 0; i < MINPMAX; i++)
	  ms[i] = NULL;
    }
#endif /* CK_MINPUT */

    if (macini() < 0)			/* Allocate macro buffers */
      fatal("Can't allocate macro buffers!");

    ifcmd[0] = 0;			/* Command-level related variables. */
    iftest[0] = 0;			/* Initialize variables at top level */
    count[0] = 0;			/* of stack... */
    intime[0] = 0;
    inpcas[0] = 0;
    takerr[0] = 0;
    merror[0] = 0;
#endif /* NOSPL */

#ifdef AMIGA
    if (tlevel < 0)    
      concb(escape);
#endif /* AMIGA */

#ifndef NOSPL
    cmdlvl = 0;				/* Initialize the command stack */
    cmdstk[cmdlvl].src = CMD_KB;	/* Source is console */
    cmdstk[cmdlvl].lvl = 0;		/* Level is 0 */
    cmdstk[cmdlvl].ccflgs = 0;		/* No flags */
#endif /* NOSPL */

    tlevel = -1;			/* Take file level = keyboard */
    for (i = 0; i < MAXTAKE; i++)	/* Initialize command file names */
      tfnam[i] = NULL;

    cmsetp(ckprompt);			/* Set up C-Kermit's prompt */

#ifndef NOSPL

    initmac();				/* Initialize macro table */

/* Predefine built-in one-line macros */

    addmac("ibm-linemode",m_ibm);	/* IBM-LINEMODE */
    addmac("fatal",m_fat);		/* FATAL macro */
    y = addmac("fast",m_fast);		/* FAST macro */
    addmac("cautious",m_cautious);	/* CAUTIOUS macro */
    addmac("robust",m_robust);		/* ROBUST macro */
/*
  Predefine built-in multiline macros; these are top-level commands
  that are implemented internally as macros.  NOTE: When adding a new
  one of these, remember to update the END and RETURN commands to
  account for it, or else END and RETURN from within it won't work right.
*/
    x = addmmac("_forx",for_def);	/* FOR macro */
    if (x > -1) mactab[x].flgs = CM_INV;
    x = addmmac("_xif",xif_def);	/* XIF macro */
    if (x > -1) mactab[x].flgs = CM_INV;
    x = addmmac("_while",whil_def);	/* WHILE macro */
    if (x > -1) mactab[x].flgs = CM_INV;
    x = addmmac("_switx",sw_def);	/* SWITCH macro */
    if (x > -1) mactab[x].flgs = CM_INV;

/* Predefine the macro argument vector */

    strcpy(vnambuf,"\\&_[10]"); 	/* Macro argument vector */
    y = arraynam(vnambuf,&x,&z);	/* goes in array \&_[] */
    if (y > -1) {
	dclarray((char)x,z);		/* Declare the array */
	for (i = 0; i < 10; i++) {	/* Fill it */
	    sprintf(vnambuf,"\\&_[%d]",i); /* with NULL pointers */
	    addmac(vnambuf,NULL);
	}
    }
    *vnambuf = NUL;

/* Fill in command-line argument vector */

    sprintf(vnambuf,"\\&@[%d]",xargs); 	/* Command line argument vector */
    y = arraynam(vnambuf,&x,&z);	/* goes in array \&@[] */
    if (y > -1) {
	dclarray((char)x,z);		/* Declare the array */
	for (i = 0; i < xargs; i++) {	/* Fill it */
	    sprintf(vnambuf,"\\&@[%d]",i);
	    addmac(vnambuf,xargv[i]);
	}
    }
    *vnambuf = NUL;

#endif /* NOSPL */

/* Get our home directory now.  This needed in lots of places. */

    homdir = zhome();
    cmdinited = 1;
}

VOID
doinit() {
    int x = 0, ok = 0;
#ifdef OS2
    char * ptr = 0;
    extern int initvik;
#endif /* OS2 */

    if (!cmdinited)
      cmdini();

#ifdef MAC
    return;				/* Mac Kermit has no init file */

#else /* !MAC */

#ifdef OS2
    keymapinit();
    keynaminit();
#ifdef OS2MOUSE
    mousemapinit(-1,-1);
#endif /* OS2MOUSE */
    initvik = 1;
#endif /* OS2 */

/* If skipping init file ('-Y' on Kermit command line), return now. */

    if (noinit) {
	kermrc[0] = '\0'; 
	inidir[0] = '\0'; 
/*
  But returning from here results in inidir[] never being set to anything.
  Instead it should be set to wherever the init file *would* have been
  executed from.  So this bit of code should be removed, and then we should
  sprinkle "if (noinit)" tests throughout the following code until we have
  set inidir[], and then return without actually taking the init file.
*/
	return;
    }

#ifdef OS2
/*
  The -y init file must be fully specified or in the current directory.
  KERMRC is looked for via INIT, DPATH and PATH in that order.  Finally, our
  own executable file path is taken and the .EXE suffix is replaced by .INI
  and this is tried as the initialization file.
*/
    if (rcflag) {
	strcpy(line, kermrc);
    } else {
        char * env = 0;
#ifdef NT
	env = getenv("K95.INI");
#else
	env = getenv("K2.INI");
#endif /* NT */
	if (!env)
	  env = getenv("CKERMIT.INI");
	if (!env)
	  env = getenv("CKERMIT_INI");
        line[0] = '\0';

	if (env)
	  strcpy(line,env);
	if (line[0] == 0)
	  _searchenv(kermrc,"INIT",line);
	if (line[0] == 0)
	  _searchenv(kermrc,"DPATH",line);
	if (line[0] == 0)
	  _searchenv(kermrc,"PATH",line);
	if (line[0] == 0) {
	    char *pgmptr = GetLoadPath();
	    if (pgmptr) {
		lp = strrchr(pgmptr, '.');
		strncpy(line, pgmptr, lp - pgmptr);
		strcpy(line + (lp - pgmptr), ".ini");
	    }
	}
    }
    if ((tfile[0] = fopen(line,"r")) != NULL) {
	ok = 1;
        tlevel = 0;
	tfline[tlevel] = 0;
	if (tfnam[tlevel] = malloc(strlen(line)+1))
	  strcpy(tfnam[tlevel],line);
#ifndef NOSPL
	cmdlvl++;
	cmdstk[cmdlvl].src = CMD_TF;
	cmdstk[cmdlvl].lvl = tlevel;
	cmdstk[cmdlvl].ccflgs = 0;
	ifcmd[cmdlvl] = 0;
	iftest[cmdlvl] = 0;
	count[cmdlvl] =  count[cmdlvl-1]; /* Inherit from previous level */
	intime[cmdlvl] = intime[cmdlvl-1];
	inpcas[cmdlvl] = inpcas[cmdlvl-1];
	takerr[cmdlvl] = takerr[cmdlvl-1];
	merror[cmdlvl] = merror[cmdlvl-1];
#endif /* NOSPL */
        debug(F110,"doinit init file",line,0);
    } else {
        debug(F100,"doinit no init file","",0);
    }
    strncpy(kermrc,line,KERMRCL);	/* XXXX */
    for (ptr = kermrc; *ptr; ptr++)	/* Convert backslashes to slashes */
       if (*ptr == '\\')
         *ptr = '/';
#else /* not OS2 */
    lp = line;
    lp[0] = '\0';
#ifdef GEMDOS
    zkermini(line, rcflag, kermrc);
#else
#ifdef VMS
    zkermini(line,LINBUFSIZ,kermrc);
#else /* not VMS */
    if (rcflag) {			/* If init file name from cmd line */
	strcpy(lp,kermrc);		/* use it, */
    } else {				/* otherwise... */
#ifdef CK_INI_A				/* If we've a system-wide init file */
	/* And it takes precedence over the user's... */
	strncpy(lp,CK_SYSINI,KERMRCL);	/* Use it */
	if (zchki(lp) < 0) {		/* (if it exists...) */
#endif /* CK_INI_A */
	    line[0] = NUL;
	    if (homdir) {		/* Home directory for init file. */
		strcpy(lp,homdir);
#ifdef STRATUS
		strcat(lp,">");		/* VOS separates dirs with >'s */
#else
		if (lp[0] == '/') strcat(lp,"/");
#endif /* STRATUS */
	    }
	    strcat(lp,kermrc);		/* Append the default file name */
#ifdef CK_INI_A
	}
#endif /* CK_INI_A */
    }
#ifdef CK_INI_B				/* System-wide init defined? */
    /* But user's ini file takes precedence */
    if (zchki(lp) < 0)			/* If user doesn't have her own, */
	strncpy(lp,CK_SYSINI,KERMRCL);	/* use system-wide one. */
#endif /* CK_INI_B */

#endif /* VMS */
#endif /* GEMDOS */

#ifdef AMIGA
    reqoff();				/* Disable requestors */
#endif /* AMIGA */

    debug(F110,"ini file is",line,0);
    if ((tfile[0] = fopen(line,"r")) != NULL) {	/* Try to open init file. */
	ok = 1;
	tlevel = 0;
	tfline[tlevel] = 0;
	if (tfnam[tlevel] = malloc(strlen(line)+1))
	  strcpy(tfnam[tlevel],line);

	strncpy(kermrc,line,KERMRCL);	/* XXXX */

#ifndef NOSPL
	cmdlvl++;
	ifcmd[cmdlvl] = 0;
	iftest[cmdlvl] = 0;
	count[cmdlvl] =  count[cmdlvl-1]; /* Inherit from previous level */
	intime[cmdlvl] = intime[cmdlvl-1];
	inpcas[cmdlvl] = inpcas[cmdlvl-1];
	takerr[cmdlvl] = takerr[cmdlvl-1];
	merror[cmdlvl] = merror[cmdlvl-1];
	debug(F101,"open ok","",cmdlvl);
	cmdstk[cmdlvl].src = CMD_TF;
	cmdstk[cmdlvl].lvl = tlevel;
	cmdstk[cmdlvl].ccflgs = 0;
#endif /* NOSPL */
	debug(F110,"init file",line,0);
    }

#ifdef datageneral
/* If CKERMIT.INI not found in home directory, look in searchlist */
    if (homdir && (tlevel < 0)) {
    	strcpy(lp,kermrc);
	if ((tfile[0] = fopen(line,"r")) != NULL) {
	    ok = 1;
	    tlevel = 0;
	    tfline[tlevel] = 0;
	    if (tfnam[tlevel] = malloc(strlen(line)+1))
	      strcpy(tfnam[tlevel],line);
#ifndef NOSPL
	    cmdlvl++;
	    cmdstk[cmdlvl].src = CMD_TF;
	    cmdstk[cmdlvl].lvl = tlevel;
	    cmdstk[cmdlvl].ccflgs = 0;
	    ifcmd[cmdlvl] = 0;
	    iftest[cmdlvl] = 0;
	    count[cmdlvl] =  count[cmdlvl-1]; /* Inherit from previous level */
	    intime[cmdlvl] = intime[cmdlvl-1];
	    inpcas[cmdlvl] = inpcas[cmdlvl-1];
	    takerr[cmdlvl] = takerr[cmdlvl-1];
	    merror[cmdlvl] = merror[cmdlvl-1];
#endif /* NOSPL */
	}
    }
#endif /* datageneral */

#ifdef AMIGA				/* Amiga... */
    reqpop();				/* Restore requestors */
#endif /* AMIGA */
#endif /* OS2 */
#endif /* MAC */

    /* Assign value to inidir */

    if (!ok) {
	inidir[0] = NUL;
    } else {
	strcpy(inidir, kermrc);
	x = strlen(inidir);
	if (x > 0) {
	    int i;
	    for (i = x - 1; i > 0; i-- ) {
		if (inidir[i] ==
#ifdef MAC
		    ':'
#else
#ifdef UNIX
		    '/'
#else
#ifdef OSK
		    '/'
#else
#ifdef STRATUS
		    '>'
#else
#ifdef VMS
		    ']' || inidir[i] == ':'
#else
#ifdef datageneral
		    ':'
#else
#ifdef OS2
		    '/' || inidir[i+1] == '\\'
#else
#ifdef AMIGA
		    '/' || inidir[i+1] == ':'
#endif /* AMIGA */
#endif /* OS2 */
#endif /* datageneral */
#endif /* VMS */
#endif /* STRATUS */
#endif /* OSK */
#endif /* UNIX */
#endif /* MAC */
		    ) {
		    inidir[i+1] = NUL;
		    break;
		}
	    }
	}
    }
}

#ifndef NOSPL
/*
  G E T N C M

  Get next command from current macro definition.

  Moved to a separate routine in edit 181 to allow multiline GET
  to work when issued in a macro.

  Command is copied into string pointed to by argument s, max length n.
  Returns:
   0 if a string was copied, -1 if there was no string to copy.
*/
int
getncm(s,n) char *s; int n; {
    int y,				/* Character counter */
#ifdef COMMENT
    quote = 0,
#endif /* COMMENT */
    kp = 0,				/* Brace up-down counter */
    pp = 0;				/* Parenthesis up-down counter */
    char *s2;				/* Copy of destination pointer */
    
    s2 = s;				/* Initialize string pointers */
    *s = NUL;				/* and destination buffer */
    
    debug(F101,"getncm dest length","",n);

    for (y = 0;				/* Loop for n bytes max */
 	 macp[maclvl] && *macp[maclvl] && y < n;
	 y++, s++, macp[maclvl]++) {
	
	*s = *macp[maclvl];		/* Get next char from macro def */
	/* debug(F000,"char","",*s); */
#ifdef COMMENT
/*
  The intention here was to allow quoting of commas, braces, etc,
  in macro definitions, e.g. "define rows mode co80\,\%1".  And it
  works, but it breaks just about everything else.
*/
	if (*s == CMDQ && quote == 0) {	/* Allow for quoting of */
	    quote = 1;			/* braces, commas, etc. */
	    continue;
	}
#endif /* COMMENT */
/*
  Allow braces around macro definition to prevent commas from being turned to
  end-of-lines and also treat any commas within parens as text so that
  multiple-argument functions won't cause the command to break prematurely.
*/
#ifdef COMMENT
	if (!quote) {
#endif /* COMMENT */
	    if (*s == '{') kp++;	/* Count braces */
	    if (*s == '}') kp--;
	    if (*s == '(') pp++;	/* Count parentheses. */
	    if (*s == ')') pp--;
	    if (*s == ',' && pp <= 0 && kp <= 0) {
		macp[maclvl]++;		/* Comma not in {} or () */
		debug(F110,"next cmd",s,0);
		kp = pp = 0;		/* so we have the next command */
		break;
	    }
#ifdef COMMENT
	}
#endif /* COMMENT */
    }					/* Reached end. */
    if (*s2 == NUL) {			/* If nothing was copied, */
	debug(F100,"getncm eom","",0);
	popclvl();			/* pop command level. */
	return(-1);
    } else {				/* otherwise, tack CR onto end */
	*s++ = CR;
	*s = '\0';
	if (mecho && pflag)		/* If MACRO ECHO ON, echo the cmd */
	  printf("%s\n",s2);
	debug(F110,"getncm returns ptr to",s2,0);
    }
    return(0);
}

/*  D O M A C  --  Define and then execute a macro */

int
domac(name, def, flags) char *name, *def; int flags; {
    int x, m;
#ifdef OS2
    extern int term_io;
    int term_io_sav = term_io;
    term_io = 0;			/* Disable Terminal Emulator I/O */
#endif /* OS2 */

    m = maclvl;				/* Current macro stack level */
    debug(F101,"domac entry maclvl","",maclvl);
    x = addmac(name, def);		/* Define a new macro */
    if (x > -1) {			/* If successful, */
	dodo(x,NULL,flags);		/* start it (increments maclvl). */
	while (maclvl > m) {		/* Keep going till done with it, */
	    debug(F101,"domac loop maclvl 1","",maclvl);
	    sstate = (CHAR) parser(1);	/* parsing & executing each command, */
	    debug(F101,"domac loop maclvl 2","",maclvl);
	    if (sstate) proto();	/* including protocol commands. */
	}
	debug(F101,"domac loop exit maclvl","",maclvl);
    }	    
#ifdef OS2
    term_io = term_io_sav;
#endif /* OS2 */
    return(success);
}
#endif /* NOSPL */

/*
  G E T N C T

  Get next command from TAKE (command) file.

  Call with:
   s     Pointer to buffer to read into
   n     Length of buffer
   f     File descriptor of file to read from
   flag  0 == keep line terminator on and allow continuation 
         1 == discard line terminator and don't allow continuation

  Call with flag == 0 to read a command from a TAKE file;
  Call with flag != 0 to read a line from a dialing or network directory.

  In both cases, trailing comments and/or trailing whitespace is stripped.
  If flag == 0, continued lines are combined into one line.  A continued line
  is one that ends in hypen or backslash, or any line in a "block", which
  starts with "{" at the end of a line and ends with "}" at the beginning of
  a line; blocks may be nested.

  Returns:
   0 if a string was copied,
  -1 on EOF,
  -2 on malloc failure
  -3 if line is not properly terminated
  -4 if (possibly continued) line is too long. */
int
getnct(s,n,f,flag) char *s; int n; FILE *f; int flag; {
    int i, len, buflen;
    char c, cc, ccl, ccx, *s2, *lp, *lpx, *lp2, *lp3, *lastcomma = NULL;
    int bc = 0;				/* Block counter */

    s2 = s;				/* Remember original pointer */
    buflen = n;				/* Remember original buffer length */

    debug(F101,"getnct","",n);
    if (!(lpx = (char *) malloc(n+n+1))) { /* Get a temporary buffer */
	debug(F101,"getnct malloc failure","",0);
	return(-2);
    }

    lp2 = lpx;
#define KLUDGE				/* See below */
#ifdef KLUDGE
    lp2++;
#endif /* KLUDGE */

    while (1) {				/* Loop to read lines from file */
	if (fgets(lp2,n,f) == NULL) {	/* Read a line into lp2 */
	    debug(F100,"getnct fgets EOF","",0); /* EOF */
	    free(lpx);			/* Free temporary storage */
	    lpx = NULL;
	    *s = NUL;			/* Make destination be empty */
	    return(-1);			/* Return failure code */
	}
#ifndef NODIAL
	if (flag)			/* Count this line */
	  dirline++;
	else
#endif /* NODIAL */
	  tfline[tlevel]++;
	len = strlen(lp2) - 1;		/* Position of line terminator */
	debug(F111,"getnct fgets ok",lp2,len);
	if (len < 0)
	  len = 0;
	if (techo && pflag)		/* If TAKE ECHO ON, */
	  printf("%3d. %s",		/* echo it this line. */
#ifndef NODIAL
		 flag ? dirline :
#endif /* NODIAL */
		 tfline[tlevel],
		 lp2
		 );
        lp3 = lp2;			/* Working pointer */
	i = len;
	while (*lp3 == SP || *lp3 == HT) { /* First nonwhitespace character */
	    i--;
	    lp3++;
	}
	if (i == 0 && bc > 0)		/* Blank line in {...} block */
	  continue;

	/* Isolate, remove, and check terminator */

	c = lp2[len];			/* Value of line terminator */
	debug(F101,"getnct terminator","",c);
	if (c < LF || c > CR) {		/* It's not a terminator */
	    debug(F111,"getnct bad line",lp2,c);
	    if (feof(f) && len > 0 && len < n) {
		/* Kludge Alert... */
		printf("Warning: Last line of %s lacks terminator\n",
		       s2 == cmdbuf ? "command file" : "directory file");
		c = lp2[++len] = '\n';	/* No big deal - supply one. */
	    } else {			/* Something's wrong, fail. */
		free(lpx);
		lpx = NULL;
		return(-3);
	    }
	}

	/* Trim trailing whitespace */

	for (i = len - 1; i > -1 && lp2[i] <= SP; i--) /* Trim */
	  ;
	debug(F101,"getnct i","",i);
	lp2[i+1] = NUL;			/* Terminate the string */
	debug(F110,"getnct lp2",lp2,0);
	lp = lp2;			/* Make a working pointer */

	/* Remove trailing or full-line comment */

	while (cc = *lp) {
	    if (cc == ';' || cc == '#') { /* Comment introducer? */
		if (lp == lp2) {	/* First char on line */
		    *lp = NUL;
		    break;
		} else if (*(lp - 1) == SP || *(lp - 1) == HT) {
		    lp--;
		    *lp = NUL;	/* Or preceded by whitespace */
		    break;
		}
	    }
	    lp++;
	}
	if (lp > lp2)
	  lp--;				/* Back up over the NUL */

	/* Now trim any space that preceded the comment */

	while ((*lp == SP || *lp == HT) && lp >= lp2) {
	    *lp = NUL;
	    if (lp <= lp2)
	      break;
	    lp--;
	}
	debug(F110,"getnct comment trimmed",lp2,0);

	len = strlen(lp2);		/* Length after trimming */

	if (n - len < 2) {		/* Check remaining space */
	    debug(F111,"getnct command too long",s2,buflen);
	    printf("?Line too long, maximum length: %d.\n",buflen);
	    free(lpx);
	    return(-4);
	}
	ccl = (len > 0) ? lp2[len-1] : 0;     /* Last character in line */
	ccx = (len > 1) ? lp2[len-2] : 0;     /* Penultimate char in line */

#ifdef KLUDGE
/*
  If it is a command and it begins with a token (like ! or .) that is not
  followed by a space, insert a space now; otherwise cmkey() can get might
  confused.
*/
	if (s == s2 && !flag) {
	    char *p = toktab;
	    while (*p) {
		if (*p == *lp3 && *(p+1) != SP) {
		    *lp3-- = SP;
		    *lp3 = *p;
		    if (lp3 < lp2) {
			lp2--;
			len++;
		    }
		    break;
		} else
		  p++;
	    }
	}
#endif /* KLUDGE */
	lp = lp2;

	while (*s++ = *lp++)		/* Copy result to target buffer */
	  n--;				/* accounting for length */
	s--;				/* Back up over the NUL */

	/* Check whether this line is continued */

        if (flag)			/* No line continuation when flag=1 */
	  break;			/* So break out of read-lines loop */

	debug(F000,"getnct first char","",*lp3);
	debug(F000,"getnct last char","",ccl);
	debug(F000,"getnct next-to-last char","",ccx);

	if (bc > 0 && *lp3 == '}')	/* First char on line is '}' */
	  bc--;				/* Decrement block counter */

	if (bc == 0 &&			/* Line is continued if bc > 0 */
#ifdef COMMENT
	    /* Not supported as of C-Kermit 6.0 */
	    ccl != CMDQ &&		/* or line ends with CMDQ */
#endif /* COMMENT */
	    ccl != '-'  &&		/* or line ends with dash */
	    ccl != '{')			/* or line ends with opening brace */
	  break;			/* None of those, we're done. */

	if (ccl == '-' || ccl == '{')	/* Continuation character */
	  if (ccx == CMDQ)		/* But it's quoted */
	    break;			/* so ignore it */

	if (ccl == '{') {		/* Last char on line is '{'? */
	    bc++;			/* Count the block opener. */
	} else if (ccl == '-'		/* Explicit continue? */
#ifdef COMMENT
/* Not supported as of C-Kermit 6.0. */
		   || ccl == CMDQ
#endif /* COMMENT */
		   ) {
	    s--;			/* Yes, back up over terminators */
	    n++;			/* and over continuation character */
	} else {			/* None of those but (bc > 0) */
	    lastcomma = s;
	    *s++ = ',';			/* and insert a comma */
	    n--;
	}
	debug(F101,"getnct bc","",bc);
	debug(F100,"getnct continued","",0);
    } /* read-lines while loop */

    if (lastcomma)
      *lastcomma = SP;
    if (!flag)				/* Tack line terminator back on */
      *s++ = c;
    *s++ = NUL;				/* Terminate the string */
    untab(s2);				/* Done, convert tabs to spaces */
    debug(F110,"getnct return",s2,0);
    free(lpx);				/* Free temporary storage */
    return(0);				/* Return success */
}

/*  P A R S E R  --  Top-level interactive command parser.  */
 
/*
  Call with:
    m = 0 for normal behavior: keep parsing and executing commands
          until an action command is parsed, then return with a
          Kermit start-state as the value of this function.
    m = 1 to parse only one command, can also be used to call parser()
          recursively.
    m = 2 to read but do not execute one command.
  In all cases, parser() returns:
    0     if no Kermit protocol action required
    > 0   with a Kermit protocol start-state.
    < 0   upon error.
*/
int
parser(m) int m; {
    int tfcode, xx, yy, zz;		/* Workers */

#ifndef NOSPL
    int inlevel;			/* Level we were called at */
#endif /* NOSPL */
    char *cbp;				/* Command buffer pointer */
#ifdef MAC
    extern char *lfiles;		/* Fake extern cast */
#endif /* MAC */

#ifdef AMIGA
    reqres();				/* Restore AmigaDOS requestors */
#endif /* AMIGA */

#ifdef OS2
    if (cursor_save > -1) {		/* Restore cursor if it was */
	cursorena[VCMD] = cursor_save;	/* turned off during file transfer */
	cursor_save = -1;
    }
#endif /* OS2 */

    what = W_COMMAND;			/* Now we're parsing commands. */
    
    if (!cmdsrc())			/* If at top (interactive) level ... */
      concb((char)escape);		/* put console in 'cbreak' mode. */

#ifdef CK_TMPDIR
/* If we were cd'd temporarily to another device or directory ... */
    if (f_tmpdir) {
	int x;
	x = zchdir((char *) savdir);	/* ... restore previous directory */
	f_tmpdir = 0;			/* and remember we did it. */
	debug(F111,"parser tmpdir restoring",savdir,x);
    }
#endif /* CK_TMPDIR */

#ifndef NOSPL
    inlevel = cmdlvl;		/* Current macro level */
#ifdef DEBUG
    if (deblog) {
	debug(F101,"&parser entry maclvl","",maclvl);
	debug(F101,"&parser entry inlevel","",inlevel);
	debug(F101,"&parser entry tlevel","",tlevel);
	debug(F101,"&parser entry cmdlvl","",cmdlvl);
	debug(F101,"&parser entry m","",m);
    }
#endif /* DEBUG */
#endif /* NOSPL */

    ftreset();				/* Reset global file-xfer settings */
/*
  sstate becomes nonzero when a command has been parsed that requires some
  action from the protocol module.  Any non-protocol actions, such as local
  directory listing or terminal emulation, are invoked directly from below.
*/
    sstate = 0;				/* Start with no start state. */

#ifndef NOSPL
    query = 0;				/* QUERY not active */
#endif /* NOSPL */

    while (sstate == 0) {		/* Parse cmds until action requested */
#ifdef WHAT_THE_HECK_IS_THIS
	int nnn;
	debug(F100,"top of parse loop","",0);
	nnn = ttchk();
	debug(F101,"APC ttchk p1","",nnn);
#endif /* WHAT_THE_HECK_IS_THIS */

	remfile = 0;			/* Clear these in case REMOTE */
	remappd = 0;			/* command was interrupted... */
	rempipe = 0;

    /* Take requested action if there was an error in the previous command */

#ifndef MAC
	if (cmdint)
	  conint(trap,stptrap);		/* Fix interrupts */
	else
	  connoi();
	bgchk();			/* Check background status */
#endif /* MAC */

	debug(F101,"parser tlevel","",tlevel);
	debug(F101,"parser cmd_rows","",cmd_rows);

#ifndef NOSPL
	xxdot = 0;			/* Clear this... */

	if (success == 0) {
	    if (cmdstk[cmdlvl].src == CMD_TF && takerr[cmdlvl]) {
		printf("Command file terminated by error.\n");
		popclvl();
		if (cmdlvl == 0) return(0);
	    }
	    if (cmdstk[cmdlvl].src == CMD_MD && merror[cmdlvl]) {
		printf("Command error: macro terminated.\n");
		popclvl();
		if (m && (cmdlvl < inlevel))
		  return((int) sstate);
	    }
	}
	nulcmd = (m == 2);
#else
	if (success == 0 && tlevel > -1 && takerr[tlevel]) {
	    printf("Command file terminated by error.\n");
	    popclvl();
	    cmini(ckxech);		/* Clear the cmd buffer. */
	    if (tlevel < 0) 		/* Just popped out of cmd files? */
	      return(0);		/* End of init file or whatever. */
	}
#endif /* NOSPL */

#ifdef MAC
	/* Check for TAKE initiated by menu. */
	if ((tlevel == -1) && lfiles)
	    startlfile();
#endif /* MAC */

        /* If in TAKE file, check for EOF */
#ifndef NOSPL
#ifdef MAC
	if
#else
	while
#endif /* MAC */
	  ((cmdstk[cmdlvl].src == CMD_TF)  /* If end of take file */
	       && (tlevel > -1)
	       && feof(tfile[tlevel])) {
	    popclvl();			/* pop command level */
	    cmini(ckxech);		/* and clear the cmd buffer. */
	    if (cmdlvl == 0) {		/* Just popped out of all cmd files? */
		return(0);		/* End of init file or whatever. */
	    }
	}
#ifdef MAC
	miniparser(1);
	if (sstate == 'a') {		/* if cmd-. cancel */
	    debug(F100, "parser: cancel take due to sstate", "", sstate);
	    sstate = '\0';
	    dostop();
	    return(0);			/* End of init file or whatever. */
	}
#endif /*  MAC */

#else /* NOSPL */
	if ((tlevel > -1) && feof(tfile[tlevel])) { /* If end of take */
	    popclvl();			/* Pop up one level. */
	    cmini(ckxech);		/* and clear the cmd buffer. */
	    if (tlevel < 0) 		/* Just popped out of cmd files? */
	      return(0);		/* End of init file or whatever. */
 	}
#endif /* NOSPL */

#ifndef NOSPL
        if (cmdstk[cmdlvl].src == CMD_MD) { /* Executing a macro? */
	    debug(F100,"parser macro","",0);
	    maclvl = cmdstk[cmdlvl].lvl; /* Get current level */
	    debug(F101,"parser maclvl","",maclvl);
	    cbp = cmdbuf;		/* Copy next cmd to command buffer. */
	    *cbp = NUL;
	    if (*savbuf) {		/* In case then-part of 'if' command */
		strcpy(cbp,savbuf);	/* was saved, restore it. */
		*savbuf = '\0';
	    } else {			/* Else get next cmd from macro def */
		if (getncm(cbp,CMDBL) < 0) {
		    if (m && (cmdlvl < inlevel))
		      return((int) sstate);
		    else /* if (!m) */ continue;
		}
	    }
	    debug(F110,"cmdbuf from macro",cmdbuf,0);

	} else if (cmdstk[cmdlvl].src == CMD_TF)
#else
	  if (tlevel > -1)  
#endif /* NOSPL */
	  {
#ifndef NOSPL
	    if (*savbuf) {		/* In case THEN-part of IF command */
		strcpy(cmdbuf,savbuf);	/* was saved, restore it. */
		*savbuf = '\0';
	    } else
#endif /* NOSPL */

	      /* Get next line from TAKE file */

	      if ((tfcode = getnct(cmdbuf,CMDBL,tfile[tlevel],0)) < 0) {
		  if (tfcode < -1) {	/* Error */
		      printf("?Error in TAKE command file: %s\n",
			     (tfcode == -2) ? "Memory allocation failure" :
			     "Line too long or contains NUL characters"
			     );
		      dostop();
		  }
		  continue;		/* -1 means EOF */
	      }	    

        /* If interactive, get next command from user. */

	} else {			/* User types it in. */
	    if (pflag) prompt(xxstring);
	    cmini(ckxech);
    	}

    /* Now we know where next command is coming from. Parse and execute it. */

	repars = 1;			/* 1 = command needs parsing */
	displa = 0;			/* Assume no file transfer display */

	while (repars) {		/* Parse this cmd until entered. */
	    debug(F101,"parser top of while loop","",0);
	    cmres();			/* Reset buffer pointers. */

#ifdef OS2
#ifdef COMMENT
	    /* we check to see if a macro is waiting to be executed */
	    /* if so, we call domac on it */
	    if (cmdmac) {
		strncpy(cmdbuf, cmdmac, CMDBL);
		free(cmdmac);
		cmdmac = NULL;
	    }
#endif /* COMMENT */
#endif /* OS2 */
	    bye_active = 0;
	    xx = cmkey2(cmdtab,ncmd,"Command","",toktab,xxstring,1);
	    debug(F101,"top-level cmkey2","",xx);
	    if (xx == -5) {
		yy = chktok(toktab);
		debug(F101,"top-level cmkey token","",yy);
		ungword();
		switch (yy) {
		  case '#': xx = XXCOM; break; /* Comment */
		  case ';': xx = XXCOM; break; /* Comment */
#ifndef NOSPL
		  case '.': xx = XXDEF; xxdot = 1; break; /* Assignment */
		  case ':': xx = XXLBL; break; /* GOTO label */
#endif /* NOSPL */

#ifndef NOPUSH
#ifdef CK_REDIR            
                  case '<':
#endif /* CK_REDIR */      
                  case '@':
                  case '!':                   
		    if (!nopush) {
			switch(yy) {
#ifdef CK_REDIR
			  case '<': xx = XXFUN; break; /* REDIRECT */
#endif /* CK_REDIR */
			  case '@':
			  case '!': xx = XXSHE; break; /* Shell escape */
			}
		    }
		    break;
#endif /* NOPUSH */
#ifdef CK_RECALL
		  case '^': xx = XXREDO; break;
#endif /* CK_RECALL */

		  default: 
		    printf("\n?Invalid - %s\n",cmdbuf);
		    if (tlevel > -1) {
			printf("Command file: %s, line %d\n",
			       tfnam[tlevel] ? tfnam[tlevel] : "",
			       tfline[tlevel]
			       );
		    }
		    xx = -2;
		}
	    }
	    topcmd = xx;		/* Top-level command index */

#ifndef NOSPL
            /* Special handling for IF..ELSE */

	    if (ifcmd[cmdlvl])		/* Count stmts after IF */
	      ifcmd[cmdlvl]++;
	    if (ifcmd[cmdlvl] > 2 && xx != XXELS && xx != XXCOM)
	      ifcmd[cmdlvl] = 0;

	    /* Execute the command and take action based on return code. */

	    if (nulcmd) {		/* Ignoring this command? */
		xx = XXCOM;		/* Make this command a comment. */
	    }
	    fnsuccess = 1;		/* For catching \function() errors */
#endif /* NOSPL */

	    zz = docmd(xx);		/* Parse rest of command & execute. */

#ifndef NOSPL	    
	    if (fnerror && !fnsuccess)
	      success = 0;
#endif /* NOSPL */
	    debug(F101,"docmd returns","",zz);
	    debug(F110,"cmdbuf",cmdbuf,"");
	    debug(F110,"atmbuf",atmbuf,"");
#ifdef CK_RECALL
	    if (zz < 0 && cmflgs == 1)
	      addcmd(cmdbuf);
#endif /* CK_RECALL */

#ifdef MAC
	    if (tlevel > -1) {
		if (sstate == 'a') {	/* if cmd-. cancel */
		    debug(F110, "parser: cancel take, sstate:", "a", 0);
		    sstate = '\0';
		    dostop();
		    return(0);		/* End of init file or whatever. */
		}
	    }
#endif /* MAC */
	    switch (zz) {
	      case -4:			/* EOF (e.g. on redirected stdin) */
		doexit(GOOD_EXIT,xitsta); /* ...exit successfully */
	      case -1:			/* Reparse needed */
		repars = 1;		/* Just set reparse flag and... */
		continue;
#ifdef OS2
	      case -7:			/* They typed a disk letter */
		if (!zchdir((char *)cmdbuf)) {
		    perror((char *)cmdbuf);
		    success = 0;
		} else success = 1;
		repars = 0;
		continue;
		
#endif /* OS2 */
	      case -6:			/* Invalid command given w/no args */
	      case -2:			/* Invalid command given w/args */
#ifdef COMMENT
#ifndef NOSPL
		    /* This is going to be really ugly... */
		    yy = mlook(mactab,atmbuf,nmac); /* Look in macro table */
		    if (yy > -1) {	            /* If it's there */
			if (zz == -2) {	            /* insert "do" */
			    char *mp;
			    mp = malloc((int)strlen(cmdbuf) + 5);
			    if (!mp) {
				printf("?malloc error 1\n");
				return(-2);
			    }
			    sprintf(mp,"do %s ",cmdbuf);
			    strcpy(cmdbuf,mp);
			    free(mp);
			    mp = NULL;
			} else sprintf(cmdbuf,"do %s %c",atmbuf, CR);
			if (ifcmd[cmdlvl] == 2)	/* This one doesn't count! */
			  ifcmd[cmdlvl]--;
			debug(F111,"stuff cmdbuf",cmdbuf,zz);
			repars = 1;	/* Go for reparse */
			continue;
		    } else {
			char *p;
			int n;
			p = cmdbuf;
			lp = line;     
			n = LINBUFSIZ;
			if (cmflgs == 0) printf("\n");
			if (zzstring(p,&lp,&n) > -1) 
			  printf("?Invalid: %s\n",line);
			else
			  printf("?Invalid: %s\n",cmdbuf);
		    } /* (fall thru...) */
#else
		    printf("?Invalid: %s\n",cmdbuf);
#endif /* NOSPL */
#else /* Not COMMENT */
		    printf("?Invalid: %s\n",cmdbuf);
#endif /* COMMENT */

		case -9:		/* Bad, error message already done */
		    success = 0;
		    debug(F110,"top-level cmkey failed",cmdbuf,0);
		    /* If in background w/ commands coming stdin, terminate */
		    if (pflag == 0 && tlevel < 0)
		      fatal("Kermit command error in background execution");
/*
  Command retry feature, edit 190.  If we're at interactive prompting level,
  reprompt the user with as much of the command as didn't fail.
*/
#ifdef CK_RECALL
		    if (cm_retry && !cmdsrc()) { /* If at top level */
			int len;
			char *p, *s;
			len = strlen(cmdbuf); /* Length of command buffer */
			p = malloc(len + 1);  /* Allocate space for copy */
			if (p) {	      /* If we got the space */
			    strcpy(p,cmdbuf); /* copy the command buffer. */
			    /* Chop off final field, the one that failed. */
			    s = p + len - 1;          /* Point to end */
			    while (*s == SP && s > p) /* Trim blanks */
			      s--;
			    while (*s != SP && s > p) /* Trim last field */
			      s--;
			    if (s > p)        /* Keep the space */
			      s++;	      /* after last good field */
			    if (s >= p)	      /* Cut off remainder */
			      *s = NUL;
			    cmini(ckxech);    /* Reinitialize the parser */
			    strcpy(cmdbuf,p); /* Copy truncated cmd back */
			    free(p);          /* Free temporary storage */
			    p = NULL;
			    prompt(xxstring); /* Reprint the prompt */
			    printf("%s",cmdbuf); /* Reprint partial command */
			    repars = 1;          /* Force reparse */
			    continue;
			}
		    } else
#endif /* CK_RECALL */
		      if (tlevel > -1) {
			  printf("Command file: %s, line %d\n",
				 tfnam[tlevel] ? tfnam[tlevel] : "",
				 tfline[tlevel]
				 );
		      }
		      cmini(ckxech);	/* (fall thru) */

 	    	case -3:		/* Empty command OK at top level */
		    repars = 0;		/* Don't need to reparse. */
		    continue;		/* Go back and get another command. */

		default:		/* Command was successful. */
#ifndef NOSPL
		    debug(F101,"parser preparing to continue","",maclvl);
#endif /* NOSPL */
		    repars = 0;		/* Don't need to reparse. */
		    continue;		/* Go back and get another command. */
		}
	}
#ifndef NOSPL
	debug(F101,"parser breaks out of while loop","",maclvl);
	if (m && (cmdlvl < inlevel))  return((int) sstate);
#endif /* NOSPL */
    }

/* Got an action command, return start state. */
 
    return((int) sstate);
}

#ifndef NOSPL
/*
  OUTPUT command.
  Buffering and pacing added by L.I. Kirby, 5A(189), June 1993.
*/
#define OBSIZE 80			/* Size of local character buffer */

static int obn;				/* Buffer offset (high water mark) */
static char obuf[OBSIZE+1];		/* OUTPUT buffer. */
static char *obp;			/* Pointer to output buffer. */
_PROTOTYP( static int oboc, (char) );
_PROTOTYP( static int xxout, (char *, int) );

/* ^^^^ */

static int
#ifdef CK_ANSIC
xxout(char *obuf, int obsize)
#else
xxout(obuf, obsize) char *obuf; int obsize; 
#endif /* CK_ANSIC */
/* xxout */ {				/* OUTPUT command's output function */
    int i, rc;

    debug(F101,"xxout obsize","",obsize);
    debug(F101,"xxout pacing","",pacing);
    debug(F111,"xxout string",obuf,strlen(obuf));

    rc = 0;				/* Initial return code. */
    if (!obuf || (obsize <= 0))		/* Nothing to output. */
      goto xxout_x;			/* Return successfully */

    rc = -1;				  /* Now assume failure */
    if (pacing == 0) {			  /* Is pacing enabled? */
	if ((local ?		 	  /* No, write entire string at once */
	     ttol((CHAR *)obuf, obsize) : /* to communications device */
	     conxo(obsize, obuf))	  /* or to console */
	    != obsize)
	  goto xxout_x;
    } else {
	for (i = 0; i < obsize; i++) {	/* Write individual chars */
	    if ((local ? ttoc(obuf[i]) : conoc(obuf[i])) < 0)
	      goto xxout_x;
	    msleep(pacing);
	}
    }
    if (inecho && duplex && local) {
#ifdef OS2
	for (i = 0; i < obsize; i++) {	/* Write to emulator */
	    scriptwrtbuf((USHORT)obuf[i]);
	}
#endif /* OS2 */
	conxo(obsize,obuf);
    }
    rc = 0;				/* Success */
  xxout_x:
    obn = 0;				/* Reset count */
    obp = obuf;				/* and pointers */
    return(rc);				/* return our return code */
}

#ifdef COMMENT
/*
  Macros for OUTPUT command execution, to make it go faster. 
*/
#define obfls() ((xxout(obuf,obn)<0)?-1:0)
#define oboc(c) ((*obp++=(char)(c)),*obp=0,(((++obn)>=OBSIZE)?obfls():0))

#else /* The macros cause some compilers to generate bad code. */

static int
#ifdef CK_ANSIC
oboc(char c)
#else
oboc(c) char c;
#endif /* CK_ANSIC */
/* oboc */ {				/* OUTPUT command's output function */

    *obp++ = c;				/* Deposit character */
    *obp = NUL;				/* Flush buffer if it's now full */

    return(((++obn) >= OBSIZE) ? xxout(obuf,obn) : 0);
}
#endif /* COMMENT */

/*  Routines for handling local variables -- also see popclvl().  */

VOID
freelocal(m) int m; {			/* Free local variables */
    struct localvar * v, * tv;		/* at macro level m... */
    debug(F101,"freelocal level","",m);
    if (m < 0) return;
    v = localhead[m];			/* List head for level m */
    while (v) {
	if (v->lv_name)			/* Variable name */
	  free(v->lv_name);
	if (v->lv_value)		/* Value */
	  free(v->lv_value);
	tv = v;				/* Save pointer to this node */
	v = v->lv_next;			/* Get next one */
	if (tv)				/* Free this one */
	  free(tv);
    }
    localhead[m] = (struct localvar *) NULL; /* Done, set list head to NULL */
}

int
dolocal() {				/* Do the LOCAL command */
    int i, x, z;
    char * s;
    char * list[65];			/* Up to 64 variables per line */
    struct localvar * v, *prev = (struct localvar *)NULL;

    if ((x = cmtxt("Variable name(s)","",&s,NULL)) < 0)
      return(x);

    xwords(s,64,list,0);		/* Break up line into "words" */
/*
  loop thru variable list.
  if variable is defined, allocate a node for it,
  copy its value to the node,
  and undefine it.
*/
    if (v = localhead[cmdlvl]) {	/* Already have some at this level? */
	while (v) {			/* Find end of list */
	    prev = v;
	    v = v->lv_next;
	}
    }
    for (i = 1; i < 10 && list[i]; i++) { /* Go through the list */
	if (*(list[i]) == CMDQ)  {
	    if (parsevar(list[i],&x,&z) < 0) /* Check for valid name */
	      continue;
	    sprintf(tmpbuf,"\\fcontents(%s)",list[i]); /* Get definition */
	} else {			/* Macro */
	    sprintf(tmpbuf,"\\fdefinition(%s)",list[i]); /* Get def */
	}
	s = line;			/* Point to destination buffer */
	x = LINBUFSIZ;			/* Length of destination buffer */
	zzstring(tmpbuf,&s,&x);		/* Get definition */

/* Name is in list[i], definition is in line[] */

	v = (struct localvar *) malloc(sizeof(struct localvar));
	if (!v) {
	    printf("?Failure to allocate storage for local variables");
	    return(-9);
	}
	if (!localhead[cmdlvl])		/* If first, set list head */
	  localhead[cmdlvl] = v;
	else				/* Otherwise link previous to this */
	  prev->lv_next = v;
	prev = v;			/* And make this previous */
	v->lv_next = (struct localvar *) NULL; /* No next yet */

	if (!(v->lv_name = (char *) malloc((int) strlen(list[i]) + 1)))
	  goto localbad;	  
	strcpy(v->lv_name, list[i]);	/* Copy name into new node */

	if (*line) {
	    if (!(v->lv_value = (char *) malloc((int) strlen(line) + 1)))
	      goto localbad;
	    strcpy(v->lv_value, line);	/* Copy value into new node */
	} else
	  v->lv_value = NULL;

	delmac(list[i]);		/* Delete the original macro */
    }
    return(success = 1);

  localbad:
    printf("?Failure to allocate storage for local variables");
    freelocal(cmdlvl);
    return(-9);
}

/*  D O O U T P U T  --  Returns 0 on failure, 1 on success */

#ifndef NOKVERBS
#define K_BUFLEN 30
#define SEND_BUFLEN 255
#define sendbufd(x) { sendbuf[sendndx++] = x;\
 if (sendndx == SEND_BUFLEN) {dooutput(s); sendndx = 0;}}
#endif /* NOKVERBS */

int outesc = 1;				/* Process special OUTPUT escapes */

int
dooutput(s) char *s; {

    int x, xx, y, quote;		/* Workers */

    debug(F111,"dooutput s",s,(int)strlen(s));

    if (local) {			/* Condition external line */
#ifdef NOLOCAL
	goto outerr;
#else
	if (ttchk() < 0) {
	    printf("?Connection %s %s is not open.\n",
		   network ? "to" : "on",
		   ttname
		   );
	    return(0);
	}
	if (ttvt(speed,flow) < 0) {
	    printf("?OUTPUT initialization error\n");
	    return(0);
	}
#endif /* NOLOCAL */
    }
    if (!cmdgquo()) {			/* COMMAND QUOTING OFF */
	x = strlen(s);			/* Just send the string literally */
	xx = local ? ttol((CHAR *)s,x) : conxo(x,s);
	return(success = (xx == x) ? 1 : 0);
    }
    quote = 0;				/* Initialize backslash (\) quote */
    obn = 0;				/* Reset count */
    obp = obuf;				/* and pointers */

    while (x = *s++) {			/* Loop through the string */
	y = 0;				/* Error code, 0 = no error. */
	debug(F000,"dooutput","",x);
	if (quote) {			/* This character is quoted */
#ifndef NOKVERBS
           if (x == 'k' || x == 'K') {	/* \k or \K */
               extern struct keytab kverbs[];
               extern int nkverbs;
               extern char * keydefptr;
               extern int keymac;
               extern int keymacx;      
               int x, y, brace = 0;
               int pause;
               char * p, * b;
               char kbuf[K_BUFLEN + 1];	/* Key verb name buffer */
	       char sendbuf[SEND_BUFLEN +1];
               int  sendndx = 0;

	       if (xxout(obuf,obn) < 0) /* Flush buffer */
		 goto outerr;
	       debug(F100,"OUTPUT KVERB","",0); /* Send a KVERB */
               {			/* Have K verb? */
		   if (!*s) {
                       break;
                   }
/*
  We assume that the verb name is {braced}, or it extends to the end of the
  string, s, or it ends with a space, control character, or backslash.
*/
                   p = kbuf;		/* Copy verb name into local buffer */
                   x = 0;
                   while ((x++ < K_BUFLEN) && (*s > SP) && (*s != CMDQ)) {
                       if (brace && *s == '}') {
                           break;
                       }
                       *p++ = *s++;
                   }
                   if (*s && !brace)	/* If we broke because of \, etc, */
                     s--;		/*  back up so we get another look. */
                   brace = 0;
                   *p = NUL;		/* Terminate. */
                   p = kbuf;		/* Point back to beginning */
                   debug(F110,"dooutput kverb",p,0);
                   y = xlookup(kverbs,p,nkverbs,&x); /* Look it up */
                   debug(F101,"dooutput lookup",0,y);
                   if (y > -1) {
                       if (sendndx) { 
                           dooutput(sendbuf); 
                           sendndx = 0; 
                       }
                       dokverb(VCMD,y);      
#ifndef NOSPL
                   } else {		/* Is it a macro? */
                       y = mxlook(mactab,p,nmac);
                       if (y > -1) {
                           cmpush();
                           keymac = 1;	/* Flag for key macro active */
                           keymacx = y;	/* Key macro index */
                           keydefptr = s; /* Where to resume next time */
                           debug(F111,"dooutput mxlook",keydefptr,y);
                           parser(1);
                           cmpop();
                       }
#endif /* NOSPL */
                   }
               }
               quote = 0;
	       continue;
	   } else
#endif /* NOKVERBS */
	     if (outesc && (x == 'n' || x == 'N')) { /* \n or \N */
		 if (xxout(obuf,obn) < 0) /* Flush buffer */
		   goto outerr;
		 debug(F100,"OUTPUT NUL","",0); /* Send a NUL */
		 if (local)
		   ttoc(NUL);
		 else
		   conoc(NUL);
		 quote = 0;
		 continue;

	     } else if (outesc && (x == 'b' || x == 'B')) { /* \b or \B */

		if (xxout(obuf,obn) < 0) /* Flush buffer first */
		  goto outerr;
		debug(F100,"OUTPUT BREAK","",0);
#ifndef NOLOCAL
		ttsndb();		/* Send BREAK signal */
#else
		 if (local)
		   ttoc(NUL);
		 else
		   conoc(NUL);
#endif /* NOLOCAL */
		quote = 0;		/* Turn off quote flag */
		continue;		/* and not the b or B */
#ifdef CK_LBRK
	     } else if (outesc && (x == 'l' || x == 'L')) { /* \l or \L */
		 if (xxout(obuf,obn) < 0) /* Flush buffer first */
		   goto outerr;
		 debug(F100,"OUTPUT Long BREAK","",0);
#ifndef NOLOCAL
		 ttsndlb();		/* Send Long BREAK signal */
#else
		 if (local)
		   ttoc(NUL);
		 else
		   conoc(NUL);
#endif /* NOLOCAL */
		 quote = 0;		/* Turn off quote flag */
		 continue;		/* and not the l or L */
#endif /* CK_LBRK */

	     } else if (x == CMDQ) {	/* Backslash itself */
		 debug(F100,"OUTPUT CMDQ","",0);
		 xx = oboc(dopar(CMDQ)); /* Output the backslash. */
		 if (xx < 0)
		   goto outerr;
		 quote = 0;
		 continue;

	     } else {			/* if \ not followed by special esc */
		/* Note: Atari ST compiler won't allow macro call in "if ()" */
		 xx = oboc(dopar(CMDQ)); /* Output the backslash. */
		 if (xx < 0)
		   goto outerr;
		 quote = 0;		/* Turn off quote flag */
	     }
	} else if (x == CMDQ) {		/* This is the quote character */
            quote = 1;			/* Go back and get next character */
	    continue;			/* which is quoted */
	} 
	xx = oboc(dopar((char)x));	/* Output this character */
	debug(F111,"dooutput",obuf,obn);
	if (xx < 0)
	  goto outerr;
	if (seslog && duplex)		/* Log the character if log is on */
	  if (zchout(ZSFILE,(char)x) < 0) /* and connection is half duplex */
	    seslog = 0;
	if (x == '\015') {		/* String contains carriage return */
	    int stuff = -1, stuff2 = -1;
	    if (tnlm) {			/* TERMINAL NEWLINE ON */
		stuff = LF;		/* Stuff LF */
        }
#ifdef TNCODE
        /* TELNET NEWLINE ON/OFF/RAW */
	    if (network && (ttnproto == NP_TELNET)) {
            switch (me_binary ? tn_b_nlm : tn_nlm) { /* NVT or BINARY */
                case TNL_CR:
                    break;
                case TNL_CRNUL:
                    stuff2 = stuff;
                    stuff  = NUL;
                    break;
                case TNL_CRLF:
                    stuff2 = stuff;
                    stuff = LF;
                    break;
                }
    	    }
#endif /* TNCODE */
	    if (stuff > -1) {		/* Stuffing another character... */
		xx = oboc(dopar((CHAR)stuff)); 
		if (xx < 0)
		  goto outerr;
		if (seslog && duplex)	/* Log stuffed char if appropriate */
		  if (zchout(ZSFILE, (CHAR)stuff) < 0)
		    seslog = 0;
	    }
	    if (stuff2 > -1) {		/* Stuffing another character... */
		xx = oboc(dopar((CHAR)stuff2)); 
		if (xx < 0)
		  goto outerr;
		if (seslog && duplex)	/* Log stuffed char if appropriate */
		  if (zchout(ZSFILE, (CHAR)stuff2) < 0)
		    seslog = 0;
	    }
	    if (xxout(obuf,obn) < 0)	/* Flushing is required here! */
	      goto outerr;
	}
    }
    if (quote == 1)			/* String ended with backslash */
      xx = oboc(dopar(CMDQ));

    if (obn > 0)			/* OUTPUT done */
      if (xxout(obuf,obn) < 0)		/* Flush the buffer if necessary. */
	goto outerr;
    return(1);

outerr:					/* OUTPUT command error handler */
    if (msgflg) printf("?OUTPUT execution error\n");
    return(0);

/* Remove "local" OUTPUT macro defininitions */

#ifdef COMMENT
/* No more macros ... */
#undef oboc
#undef obfls
#endif /* COMMENT */
}
#endif /* NOSPL */

/* Display version herald and initial prompt */

VOID
herald() {
    int x = 0;

    if (noherald || bgset > 0 || (bgset != 0 && backgrd != 0)) x = 1;
    debug(F101,"herald","",backgrd);
    if (x == 0) {
#ifdef datageneral
	printf("%s, for%s\n",versio,ckxsys);
#else
#ifdef OSK
	printf("%s, for%s\n",versio,ckxsys);
#else
	printf("%s, for%s\n\r",versio,ckxsys);
#endif /* OSK */
#endif /* datageneral */
	printf(" Copyright (C) 1985, 1998,\n");
	printf("  Trustees of Columbia University in the City of New York.\n");

#ifdef OS2
       shoreg();
#endif /* OS2 */

	if (!quiet && !backgrd) {
	    char * s;
	    extern int xfermode;
#ifdef VMS
	    s = "AUTOMATIC";	    
#else
	    if (xfermode == XMODE_A) {
		s = "AUTOMATIC";
	    } else {
		s = gfmode(binary,1);
	    }
	    if (!s) s = "";
#endif /* VMS */
	    if (*s)
	      printf("Default file-transfer mode is %s\n", s);
#ifdef COMMENT
#ifdef NT
	    printf("\n");
	    printf("StartedFromDialer = %d\n",StartedFromDialer);
	    printf("Window Handle = %ld\n",DialerHandle);
	    printf("\n");
#endif /* NT */
#endif /* COMMENT */
	    printf("Type ? or HELP for help.\n");
	}
    }
}

/*  G F M O D E  --  Get File (transfer) Mode  */

char *
gfmode(binary,upcase) int binary, upcase; {
    char * s;
    switch (binary) {
      case XYFT_T: s = upcase ? "TEXT" : "text"; break;
#ifdef VMS
      case XYFT_B: s = upcase ? "BINARY FIXED" : "binary fixed"; break;
      case XYFT_I: s = upcase ? "IMAGE" : "image"; break;
      case XYFT_L: s = upcase ? "LABELED" : "labeled"; break;
      case XYFT_U: s = upcase ? "BINARY UNDEF" : "binary undef"; break;
#else
#ifdef MAC
      case XYFT_B: s = upcase ? "BINARY" : "binary"; break;
      case XYFT_M: s = upcase ? "MACBINARY" : "macbinary"; break;
#else
      case XYFT_B: s = upcase ? "BINARY" : "binary"; break;
#ifdef CK_LABELED
      case XYFT_L: s = upcase ? "LABELED" : "labeled"; break;
#endif /* CK_LABELED */
#endif /* MAC */
#endif /* VMS */
      default: s = "";
    }
    return(s);
}

#ifndef NOSPL
/*  M L O O K  --  Lookup the macro name in the macro table  */
 
/*
 Call this way:  v = mlook(table,word,n);
 
   table - a 'struct mtab' table.
   word  - the target string to look up in the table.
   n     - the number of elements in the table.
 
 The keyword table must be arranged in ascending alphabetical order, and
 all letters must be lowercase.
 
 Returns the table index, 0 or greater, if the name was found, or:
 
  -3 if nothing to look up (target was null),
  -2 if ambiguous,
  -1 if not found.
 
 A match is successful if the target matches a keyword exactly, or if
 the target is a prefix of exactly one keyword.  It is ambiguous if the
 target matches two or more keywords from the table.
*/
int
mlook(table,cmd,n) struct mtab table[]; char *cmd; int n; {
 
    int i, v, cmdlen;
 
/* Lowercase & get length of target, if it's null return code -3. */
 
    if ((((cmdlen = lower(cmd))) == 0) || (n < 1)) return(-3);
 
/* Not null, look it up */
 
    for (i = 0; i < n-1; i++) {
        if (!strcmp(table[i].kwd,cmd) ||
           ((v = !strncmp(table[i].kwd,cmd,cmdlen)) &&
             strncmp(table[i+1].kwd,cmd,cmdlen))) {
                return(i);
             }
        if (v) return(-2);
    }   
 
/* Last (or only) element */
 
    if (!strncmp(table[n-1].kwd,cmd,cmdlen)) {
        return(n-1);
    } else return(-1);
}

/* mxlook is like mlook, but an exact full-length match is required */

int
mxlook(table,cmd,n) char *cmd; struct mtab table[]; int n; {
    int i, cmdlen;
    if ((((cmdlen = lower(cmd))) == 0) || (n < 1)) return(-3);
    for (i = 0; i < n; i++)
      if (((int)strlen(table[i].kwd) == cmdlen) &&
	  (!strncmp(table[i].kwd,cmd,cmdlen))) return(i);
    return(-1);
}

/*
  This routine is for the benefit of those compilers that can't handle
  long string constants or continued lines within them.  Long predefined
  macros like FOR, WHILE, and XIF have their contents broken up into
  arrays of string pointers.  This routine concatenates them back into a
  single string again, and then calls the real addmac() routine to enter
  the definition into the macro table.
*/
int
addmmac(nam,s) char *nam, *s[]; {	/* Add a multiline macro definition */
    int i, x, y; char *p;
    x = 0;				/* Length counter */
    for (i = 0; (y = (int)strlen(s[i])) > 0; i++) { /* Add up total length */
    	debug(F111,"addmmac line",s[i],y);	
	x += y;
    }
    debug(F101,"addmmac lines","",i);
    debug(F101,"addmmac loop exit","",y);
    debug(F111,"addmmac length",nam,x);
    if (x < 0) return(-1);

    p = malloc(x+1);			/* Allocate space for all of it. */
    if (!p) {
	printf("?addmmac malloc error: %s\n",nam);
	debug(F110,"addmmac malloc error",nam,0);
	return(-1);
    }
    *p = '\0';				/* Start off with null string. */
    for (i = 0; *s[i]; i++)		/* Concatenate them all together. */
      strcat(p,s[i]);
    y = (int)strlen(p);			/* Final precaution. */
    debug(F111,"addmmac constructed string",p,y);
    if (y == x) {
	y = addmac(nam,p);		/* Add result to the macro table. */
    } else {
	debug(F100,"addmmac length mismatch","",0);
	printf("\n!addmmac internal error!\n");
	y = -1;
    }
    free(p);				/* Free the temporary copy. */
    return(y);	
}

/* Here is the real addmac routine. */

/* Returns -1 on failure, 0 on success. */

int
addmac(nam,def) char *nam, *def; {	/* Add a macro to the macro table */
    int i, x, y, z, namlen, deflen;
    char * p = NULL, c;

    if (!nam) return(-1);
    namlen = (int)strlen(nam);		/* Get argument lengths */
    debug(F111,"addmac nam",nam,namlen);
    if (!def) {				/* Watch out for null pointer */
	deflen = 0;
	debug(F111,"addmac def","(null pointer)",deflen);
    } else {
	deflen = (int)strlen(def);
	debug(F111,"addmac def",def,deflen);
    }
    if (deflen < 0) return(-1);		/* strlen() failure, fail. */
    if (namlen < 1) return(-1);		/* No name given, fail. */

    if (*nam == CMDQ) nam++;		/* Backslash quote? */
    if (*nam == '%') {			/* Yes, if it's a variable name, */
	delmac(nam);			/* Delete any old value. */
	if (!(c = *(nam + 1))) return(-1); /* Variable name letter or digit */
	if (deflen < 1) {		/* Null definition */
	    p = NULL;			/* Better not malloc or strcpy! */
	} else {			/* A substantial definition */
	    p = malloc(deflen + 1);	/* Allocate space for it */
	    if (!p) {
		printf("?addmac malloc error 2\n");
		return(-1);
	    } else strcpy(p,def);	/* Copy definition into new space */
	}

	/* Now p points to the definition, or is a null pointer */

	if (p)
	  debug(F110,"addmac p",p,0);
	else
	  debug(F110,"addmac p","(null pointer)",0);

	if (c >= '0' && c <= '9') {	/* Digit variable */
	    if (maclvl < 0) {		/* Are we calling or in a macro? */
		g_var[c] = p;		/* No, it's a global "top level" one */
		debug(F101,"addmac numeric global maclvl","",maclvl);
	    } else {			/* Yes, it's a macro argument */
		char **q;
		m_arg[maclvl][c - '0'] = p; /* Assign the value */
		debug(F101,"addmac macro arg maclvl","",maclvl);
#ifdef COMMENT
		q = a_ptr[0];		/* Copy pointer to macro arg vector */
		q[c - '0'] = p;
#endif /* COMMENT */
	    }
	} else {			/* It's a global variable */
	    if (c < 33 || c > GVARS) return(-1);
	    if (isupper(c)) c = (char) tolower(c);
	    g_var[c] = p;		/* Put pointer in global-var table */
	    debug(F100,"addmac global","",0);
	}
	return(0);
    } else if (*nam == '&') {		/* An array reference? */
	char **q;
	if ((y = arraynam(nam,&x,&z)) < 0) /* If syntax is bad */
	  return(-1);			/* return -1. */
	if (chkarray(x,z) < 0)		/* If array not declared or */
	  return(-2);			/* subscript out of range, ret -2 */
	delmac(nam);			/* Delete any current definition. */
	x -= ARRAYBASE;			/* Convert name letter to index. */
	if ((q = a_ptr[x]) == NULL)	/* If array not declared, */
	  return(-3);			/* return -3. */
	if (deflen > 0) {
	    if ((p = malloc(deflen+1)) == NULL) { /* Allocate space */
		printf("addmac macro error 7: %s\n",nam);
		return(-4);		/* for new def, return -4 on fail. */
	    }
	    strcpy(p,def);		/* Copy definition into new space. */
	} else p = NULL;
	q[z] = p;			/* Store pointer to it. */
	return(0);			/* Done. */
    } else debug(F110,"addmac macro def",nam,0);

/* Not a macro argument or a variable, so it's a macro definition */

    lower(nam);				/* Lowercase the name */
    if (mxlook(mactab,nam,nmac) > -1)	/* Look up, requiring exact match */
      delmac(nam);			/* if it's there, delete it. */
    if (deflen < 1)
      return(0);
    debug(F111,"addmac table size",nam,nmac);
    for (y = 0;				/* Find the alphabetical slot */
	 y < MAC_MAX && mactab[y].kwd != NULL && strcmp(nam,mactab[y].kwd) > 0;
	 y++);
    if (y == MAC_MAX) {			/* No more room. */
	debug(F101,"addmac table overflow","",y);
	return(-1);
    } else debug(F111,"addmac position",nam,y);
    if (mactab[y].kwd != NULL) {	/* Must insert */
	for (i = nmac; i > y; i--) {	/* Move the rest down one slot */
	    mactab[i].kwd = mactab[i-1].kwd;
	    mactab[i].mval = mactab[i-1].mval;
	    mactab[i].flgs = mactab[i-1].flgs;
	}
    }
    p = malloc(namlen + 1);		/* Allocate space for name */
    if (!p) {
	printf("?addmac malloc error 3: %s\n",nam);
	return(-1);
    }
    strcpy(p,nam);			/* Copy name into new space */
    mactab[y].kwd = p;			/* Add pointer to table */

    if (deflen > 0) {			/* Same deal for definition */
	p = malloc(deflen + 1);		/* but watch out for null pointer */
	if (p == NULL) {
	    printf("?addmac malloc error 5: %s\n", nam);
	    if (mactab[y].kwd) {
		free(mactab[y].kwd);
		mactab[y].kwd = NULL;
	    }
	    return(-1);
	} else strcpy(p,def);		/* Copy the definition */
    } else p = NULL;
    mactab[y].mval = p;
    mactab[y].flgs = 0;
    nmac++;				/* Count this macro */
    return(y);
}

int
delmac(nam) char *nam; {		/* Delete the named macro */
    int i, x, z;
    char *p, c;

    if (!nam) return(0);		/* Watch out for null pointer */
    debug(F110,"delmac nam",nam,0);
    if (*nam == CMDQ) nam++;
    if (*nam == '%') {			/* If it's a variable name */
	if (!(c = *(nam+1))) return(0);	/* Get variable name letter or digit */
	p = (char *)0;			/* Initialize value pointer */
	if (maclvl > -1 && c >= '0' && c <= '9') { /* Digit? */
	    p = m_arg[maclvl][c - '0'];	/* Get pointer from macro-arg table */
	    m_arg[maclvl][c - '0'] = NULL; /* Zero the table pointer */
	} else {			/* It's a global variable */
	    if (c < 33 || c > GVARS) return(0);
	    p = g_var[c];		/* Get pointer from global-var table */
	    g_var[c] = NULL;		/* Zero the table entry */
	}
	if (p) {
	    debug(F110,"delmac def",p,0);
	    free(p);			/* Free the storage */
	    p = NULL;
	} else debug(F110,"delmac def","(null pointer)",0);
	return(0);
    }
	    
    if (*nam == '&') {			/* An array reference? */
	char **q;
	if (arraynam(nam,&x,&z) < 0)	/* If syntax is bad */
	  return(-1);			/* return -1. */
	x -= ARRAYBASE;			/* Convert name to number. */
	if ((q = a_ptr[x]) == NULL)	/* If array not declared, */
	  return(-2);			/* return -2. */
	if (z > a_dim[x])		/* If subscript out of range, */
	  return(-3);			/* return -3. */
	if (q[z]) {			/* If there is an old value, */
	    debug(F110,"delmac def",q[z],0);
	    if (x != 0)			/* Macro arg vector is just a copy */
	      free(q[z]);		/* Others are real so free them */
	    q[z] = NULL;
	} else debug(F110,"delmac def","(null pointer)",0);
    }

   /* Not a variable or an array, so it must be a macro. */

    if ((x = mlook(mactab,nam,nmac)) < 0) { /* Look it up */
	debug(F111,"delmac mlook",nam,x);
	return(x);
    }
    if (mactab[x].kwd) {		/* Free the storage for the name */
	free(mactab[x].kwd);
	mactab[x].kwd = NULL;
    }
    if (mactab[x].mval) {		/* and for the definition */
	free(mactab[x].mval);
	mactab[x].mval = NULL;
    }
    for (i = x; i < nmac; i++) {	/* Now move up the others. */
	mactab[i].kwd = mactab[i+1].kwd;
	mactab[i].mval = mactab[i+1].mval;
	mactab[i].flgs = mactab[i+1].flgs;
    }
    nmac--;				/* One less macro */
    mactab[nmac].kwd = NULL;		/* Delete last item from table */
    mactab[nmac].mval = NULL;
    mactab[nmac].flgs = 0;
    return(0);
}

VOID
initmac() {				/* Init macro & variable tables */
    int i, j, x;

    nmac = 0;				/* No macros */
    for (i = 0; i < MAC_MAX; i++) {	/* Initialize the macro table */
	mactab[i].kwd = NULL;
	mactab[i].mval = NULL;
	mactab[i].flgs = 0;
    }
    x = (MAXARGLIST + 1) * sizeof(char **);
    for (i = 0; i < MACLEVEL; i++) {	/* Init the macro argument tables */
	m_xarg[i] = (char **) malloc(x);
	mrval[i] = NULL;		/* Macro return value */
	/* Pointer to entire argument vector, level i, for \&_[] array */
	for (j = 0; j <= MAXARGLIST; j++) { /* Macro argument list */
	    if (j < 10)			/* For the \%0..\%9 variables */
	      m_arg[i][j] = NULL;	/* Pointer to arg j, level i. */
	    if (m_xarg[i])		/* For \&_[] - all args. */
	      m_xarg[i][j] = NULL;
	}
    }
    for (i = 0; i < GVARS; i++) {	/* And the global variables table */
	g_var[i] = NULL;
    }
    /* And the table of arrays */
    for (i = 0; i < (int) 'z' - ARRAYBASE + 1; i++) {
	a_ptr[i] = (char **) NULL;	/* Null pointer for each */
	a_dim[i] = 0;			/* and a dimension of zero */
	for (j = 0; j < CMDSTKL; j++) {
	    aa_ptr[j][i] = (char **) NULL;
	    aa_dim[j][i] = 0;
	}
    }
}

int
popclvl() {				/* Pop command level, return cmdlvl */
    struct localvar * v;
    int i;
    debug(F101,"popclvl cmdlvl","",cmdlvl);
    if (cmdlvl > 0) {
	if (v = localhead[cmdlvl]) { /* Did we save any variables? */
	    while (v) {			/* Yes */
		if (v->lv_value)	/* Copy old ones back */
		  addmac(v->lv_name,v->lv_value);
		else
		  delmac(v->lv_name);
		v = v->lv_next;
	    }
	    freelocal(cmdlvl);		/* Free local storage */
	    for (i = 0; i < 28; i++) {	/* Free any local arrays */
		if (aa_ptr[cmdlvl][i]) {
		    dclarray((char)(i+ARRAYBASE),0);
		    a_ptr[i] = aa_ptr[cmdlvl][i];
		    a_dim[i] = aa_dim[cmdlvl][i];
		    aa_ptr[cmdlvl][i] = (char **)NULL;
		    aa_dim[cmdlvl][i] = 0;
		}
	    }		
	}
    }
    if (cmdlvl < 1) {			/* If we're already at top level */
	cmdlvl = 0;			/* just make sure all the */
	tlevel = -1;			/* stack pointers are set right */
	maclvl = -1;			/* and return */
    } else if (cmdstk[cmdlvl].src == CMD_TF) { /* Reading from TAKE file? */
	debug(F101,"popclvl tlevel","",tlevel);
	if (tlevel > -1) {		/* Yes, */
	    fclose(tfile[tlevel]);	/* close it */
	    if (tfnam[tlevel]) {	/* free storage for name */
		free(tfnam[tlevel]);
		tfnam[tlevel] = NULL;
	    }
	    tlevel--;			/* and pop take level */
	    cmdlvl--;			/* and command level */
	} else tlevel = -1;
    } else if (cmdstk[cmdlvl].src == CMD_MD) { /* In a macro? */
	debug(F101,"popclvl maclvl","",maclvl);
	if (maclvl > -1) {		/* Yes, */
	    int i;
	    char **q;
	    debug(F111,"popclvl mac 1",macx[maclvl],maclvl);
	    debug(F111,"popclvl mac 2",macp[maclvl],maclvl);
	    macp[maclvl] = "";		/* set macro pointer to null string */
	    debug(F111,"popclvl mac 3",macp[maclvl],maclvl);
	    *cmdbuf = '\0';		/* clear the command buffer */
	    debug(F111,"popclvl mac 4",mrval[maclvl+1],maclvl);
	    if (maclvl+1 < MACLEVEL) {
		if (mrval[maclvl+1]) {	/* Free any deeper return values. */
		    free(mrval[maclvl+1]);
		    mrval[maclvl+1] = NULL;
		}
	    }
	    debug(F111,"popclvl mac 6",mrval[maclvl+1],maclvl);
	    maclvl--;			/* Pop macro level */
	    cmdlvl--;			/* and command level */
#ifdef COMMENT
	    q = a_ptr[0];
	    debug(F101,"popclvl mac 7","",maclvl);
	    if (maclvl > -1)
	      for (i = 0; i < 10; i++)	/* Restore previous arg vector */
		q[i] = m_arg[maclvl][i];
#else
	    if (maclvl > -1) {
		a_ptr[0] = m_xarg[maclvl];
		a_dim[0] = n_xarg[maclvl];
	    }
#endif /* COMMENT */
	} else maclvl = -1;
    }
#ifndef MAC
    if (cmdlvl < 1) {			/* If back at top level */
	if (cmdint)
	  conint(trap,stptrap);		/* Fix interrupts */
	else
	  connoi();
	bgchk();			/* Check background status */
	concb((char)escape);		/* Go into cbreak mode */
    }
#endif /* MAC */
    return(cmdlvl < 1 ? 0 : cmdlvl);	/* Return command level */
}
#else /* No script programming language */
int popclvl() {				/* Just close current take file. */
    if (tlevel > -1) {			/* if any... */
	if (tfnam[tlevel]) {
	    free(tfnam[tlevel]);
	    tfnam[tlevel] = NULL;
	}
	fclose(tfile[tlevel--]);
    }
    if (tlevel == -1) {			/* And if back at top level */
	if (cmdint)
	  conint(trap,stptrap);		/* Fix interrupts */
	else
	  connoi();
        bgchk();			/* and background status */
        concb((char)escape);		/* and go back into cbreak mode. */
    }
    return(tlevel + 1);
}
#endif /* NOSPL */

/* STOP - get back to C-Kermit prompt, no matter where from. */

int
dostop() {
    while (popclvl()) ;		/* Pop all macros & take files */
#ifndef NOSPL
    while (cmpop() > -1);	/* And all recursive cmd pkg invocations */
#endif /* NOSPL */
    cmini(ckxech);		/* Clear the command buffer. */
    return(0);
}

/* Close the given log */

int
doclslog(x) int x; {
    int y;
    switch (x) {
#ifdef DEBUG
      case LOGD:
	if (deblog <= 0) {
	    printf("?Debugging log wasn't open\n");
	    return(0);
	}
	debug(F100,"Debug Log Closed","",0L);
	*debfil = '\0';
	deblog = 0;
	return(zclose(ZDFILE));
#endif /* DEBUG */

      case LOGP:
	if (pktlog <= 0) {
	    printf("?Packet log wasn't open\n");
	    return(0);
	}
	*pktfil = '\0';
	pktlog = 0;
	return(zclose(ZPFILE));
 
#ifndef NOLOCAL
      case LOGS:
	if (seslog <= 0) {
	    printf("?Session log wasn't open\n");
	    return(0);
	}
	*sesfil = '\0';
	seslog = 0;
	return(zclose(ZSFILE));
#endif /* NOLOCAL */
 
#ifdef TLOG
      case LOGT:
	if (tralog <= 0) {
	    if (msgflg) printf("?Transaction log wasn't open\n");
	    return(0);
	}
	tlog(F100,"Transaction Log Closed","",0L);
	*trafil = '\0';
	tralog = 0;
	return(zclose(ZTFILE));
#endif /* TLOG */
 
#ifndef NOSPL
      case LOGW:			/* WRITE file */
      case LOGR:			/* READ file */
	y = (x == LOGR) ? ZRFILE : ZWFILE;
	if (chkfn(y) < 1)		/* If no file to close */
	  return(1);			/* succeed silently. */
	return(zclose(y));		/* Otherwise, close the file. */
#endif /* NOSPL */

      default:
	printf("\n?Unexpected log designator - %d\n", x);
	return(0);
    }
}

static int slc = 0;			/* Screen line count */

char *
showoff(x) int x; {
    return( x ? "on" : "off");
}

char *
showooa(x) int x; {
    switch (x) {
      case SET_OFF:  return("off");
      case SET_ON:   return("on");
      case SET_AUTO: return("automatic");
      default:       return("(unknown)");
    }
}

#ifdef GEMDOS
isxdigit(c) int c; {
    return(isdigit(c) ||
	   (c >= 'a' && c <= 'f') ||
	   (c >= 'A' && c <= 'F'));
}
#endif /* GEMDOS */

#ifndef NOSETKEY
#ifdef OS2
static struct keytab shokeytab[] = {	/* SHOW KEY modes */
    "all",    1, 0,
    "one",    0, 0
};
static int nshokey = (sizeof(shokeytab) / sizeof(struct keytab));

#define SHKEYDEF TT_MAX+5
struct keytab shokeymtab[] = {
    "aixterm",   TT_AIXTERM, 0,         /* IBM AIXterm */
    "ansi-bbs",  TT_ANSI,    0,		/* ANSI.SYS (BBS) */
    "at386",     TT_AT386,   0,		/* Unixware ANSI */
    "avatar/0+", TT_ANSI,    0,         /* AVATAR/0+ */
    "ba80",      TT_BA80,    0,         /* Nixdorf BA80 */
    "be",        TT_BEOS,    CM_INV|CM_ABR,
    "beos-ansi", TT_BEOS,    CM_INV,    /* BeOS ANSI */
    "beterm",    TT_BEOS,    0,         /* BeOS Console */
    "d200",     TT_DG200,   CM_INV|CM_ABR, /* Data General DASHER 200 */
    "d210",     TT_DG210,   CM_INV|CM_ABR, /* Data General DASHER 210 */
    "d217",     TT_DG217,   CM_INV|CM_ABR, /* Data General DASHER 217 */
    "default",   SHKEYDEF,   0,
    "dg200",     TT_DG200,   0,		/* Data General DASHER 200 */
    "dg210",     TT_DG210,   0,    	/* Data General DASHER 210 */
    "dg217",     TT_DG217,   0,    	/* Data General DASHER 217 */
    "emacs",     TT_KBM_EMACS,   0,     /* Emacs mode */ 
    "h19",       TT_H19,     CM_INV,	/* Heath-19 */
    "heath19",   TT_H19,     0,		/* Heath-19 */
    "hebrew",    TT_KBM_HEBREW, 0,      /* Hebrew mode */
    "hft",       TT_HFT,     0,         /* IBM HFT */
    "hp2621a",   TT_HP2621,  0,		/* HP 2621A */
    "hpterm",    TT_HPTERM,  0,		/* HP TERM */
    "hz1500",    TT_HZL1500, 0,    	/* Hazeltine 1500 */
    "ibm3151",   TT_IBM31,   CM_INV,    /* IBM 3101-xx,3161 */
    "linux",     TT_LINUX,   0,         /* Linux */
    "qansi",     TT_QANSI,   0,         /* QNX ANSI */
    "qnx",       TT_QNX,     0,         /* QNX */
    "russian",   TT_KBM_RUSSIAN, 0,     /* Russian mode */
    "scoansi",   TT_SCOANSI, 0,		/* SCO ANSI */
    "sni-97801", TT_97801,   0,         /* Sinix 97801 */
#ifdef OS2PM
#ifdef COMMENT
    "tek4014", TT_TEK40, 0,
#endif /* COMMENT */
#endif /* OS2PM */
    "tty",     TT_NONE,  0,
    "tvi910+", TT_TVI910, 0,
    "tvi925",  TT_TVI925, 0,
    "tvi950",  TT_TVI950, 0,
    "vc404",   TT_VC4404, 0,
    "vc4404",  TT_VC4404, CM_INV,
    "vip7809", TT_VIP7809, 0,
    "vt100",   TT_VT100, 0,
    "vt102",   TT_VT102, 0,
    "vt220",   TT_VT220, 0,
    "vt320",   TT_VT320, 0,
    "vt52",    TT_VT52,  0,
    "wp",      TT_KBM_WP, 0,
    "wy30",    TT_WY30,  0,
    "wy370",   TT_WY370, 0,
    "wy50",    TT_WY50,  0,
    "wy60",    TT_WY60,  0,
    "wyse30",  TT_WY30,  CM_INV,
    "wyse370", TT_WY370, CM_INV,
    "wyse50",  TT_WY50,  CM_INV,
    "wyse60",  TT_WY60,  CM_INV
};
int nshokeym = (sizeof(shokeymtab) / sizeof(struct keytab));
#endif /* OS2 */

VOID
#ifdef OS2
shokeycode(c,m) int c, m; 
#else
shokeycode(c) int c; 
#endif
/* shokeycode */ {
    KEY ch;
    CHAR *s;
#ifdef OS2
    int i;
    con_event km;
#else /* OS2 */
    int km;
#endif /* OS2 */

#ifdef OS2
    extern int mskkeys;
    extern int tt_type_mode;
    char * mstr = "";

    if (c >= KMSIZE) {
	bleep(BP_FAIL);
	return;
    }
#else /* OS2 */
    printf(" Key code \\%d => ", c);
#endif /* OS2 */

#ifndef OS2
    km = mapkey(c);

#ifndef NOKVERBS
    if (IS_KVERB(km)) {			/* \Kverb? */
	int i, kv;
	kv = km & ~(F_KVERB);
	printf("Verb: ");
	for (i = 0; i < nkverbs; i++)
	  if (kverbs[i].kwval == kv) {
	      printf("\\K%s",kverbs[i].kwd);
	      break;
	  }
	printf("\n");
    } else
#endif /* NOKVERBS */
      if (IS_CSI(km)) {
	  int xkm = km & 0xFF;
	  if (xkm <= 32 || xkm >= 127)
	    printf("String: \\{27}[\\{%d}\n",xkm);
	  else 
	    printf("String: \\{27}[%c\n",xkm);
      } else if (IS_ESC(km)) {
	  int xkm = km & 0xFF;
	  if (xkm <= 32 || xkm >= 127)
	    printf("String: \\{27}\\{%d}\n",xkm);
	  else 
	    printf("String: \\{27}%c\n",xkm);
      } else if (macrotab[c]) {		/* See if there's a macro */
	  printf("String: ");		/* If so, display its definition */
	  s = macrotab[c];
	  shostrdef(s);
	  printf("\n");
#ifndef NOKVERBS
    } else if (km >= 0x100) {		/* This means "undefined" */
	printf("Undefined\n");
#endif /* NOKVERBS */
    } else {				/* No macro, show single character */
	printf("Character: ");
	ch = km;

/* Watcom C says "Comparison result is always 0" */

	if (ch < 32 || ch == 127 || ch > 255
#ifndef NEXT
#ifndef AUX
#ifndef XENIX
#ifndef OS2
	    || (ch > 127 && ch < 160)
#endif /* OS2 */
#endif /* XENIX */
#endif /* AUX */
#endif /* NEXT */
	    )
/*
  These used to be %d, but gcc 1.93 & later complain about type mismatches.
  %u is supposed to be totally portable.
*/
	  printf("\\%u",(unsigned int) ch);
	else printf("%c \\%u",(CHAR) (ch & 0xff),(unsigned int) ch);
	if (ch == (KEY) c)
	  printf(" (self, no translation)\n");
	else
	  printf("\n");
    }
#else /* OS2 */
    if ( m < 0 ) {
        km = mapkey(c);
        mstr = "default";
    } else {
        km = maptermkey(c,m);
        for ( i=0;i<nshokeym;i++ ) {
            if ( m == shokeymtab[i].kwval )
            {
                mstr = shokeymtab[i].kwd;
                break;
            }
        }
    }
    s = keyname(c);
    debug(F111,"shokeycode mstr",mstr,m);
    debug(F111,"shokeycode keyname",s,c);
    printf(" %sKey code \\%d %s (%s) => ", 
            mskkeys ? "mskermit " : "",
            mskkeys ? cktomsk(c) : c,
	    s == NULL ? "" : s, mstr);

    switch (km.type) {
#ifndef NOKVERBS
      case kverb: {
	  int i, kv;
	  kv = km.kverb.id & ~(F_KVERB);
	  printf("Verb: ");
	  for (i = 0; i < nkverbs; i++) {
	      if (kverbs[i].kwval == kv) {
		  printf("\\K%s",kverbs[i].kwd);
		  break;
	      }
	  }
	  printf("\n");
	  break;
      }
#endif /* NOKVERBS */
      case csi: {
	  int xkm = km.csi.key & 0xFF;
	  if (xkm <= 32 || xkm >= 127)
	    printf("String: \\{27}[\\{%d}\n",xkm);
	  else 
	    printf("String: \\{27}[%c\n",xkm);
	  break;
      }
      case esc: {
	  extern int tt_type;
	  int xkm = km.esc.key & 0xFF;
	  if (xkm <= 32 || xkm >= 127)
	    printf("String: \\{%d}\\{%d}\n",ISDG200(tt_type)?30:27,xkm);
	  else 				    
	    printf("String: \\{%d}%c\n",ISDG200(tt_type)?30:27,xkm);
	  break;
      }
      case macro: {
	  printf("String: ");		/* Macro, display its definition */
	  shostrdef(km.macro.string);
	  printf("\n");
	  break;
      }
      case literal: {
          printf("Literal string: ");	/* Literal, display its definition */
          shostrdef(km.literal.string);
          printf("\n");
          break;
      }
      case error: {
	  if ( c >= 0x100 ) {
	      printf("Undefined\n");
	  }
	  else {
	      printf("Character: ");
	      ch = c;
	      if (ch < 32 || ch == 127 || ch > 255
#ifndef NEXT
#ifndef AUX
#ifndef XENIX
#ifndef OS2
		   || (ch > 127 && ch < 160)
#endif /* OS2 */
#endif /* XENIX */
#endif /* AUX */
#endif /* NEXT */
		   )
/*
  These used to be %d, but gcc 1.93 & later complain about type mismatches.
  %u is supposed to be totally portable.
*/
		  printf("\\%u",(unsigned int) ch);
	      else printf("%c \\%u",(CHAR) (ch & 0xff),(unsigned int) ch);
	      printf(" (self, no translation)\n");
	  }
	  break;
      }
      case key: {
	  printf("Character: ");
	  ch = km.key.scancode;
	  if (ch < 32 || ch == 127 || ch > 255
#ifndef NEXT
#ifndef AUX
#ifndef XENIX
#ifndef OS2
	      || (ch > 127 && ch < 160)
#else
               || (ch > 127)
#endif /* OS2 */
#endif /* XENIX */
#endif /* AUX */
#endif /* NEXT */
	      )
/*
  These used to be %d, but gcc 1.93 & later complain about type mismatches.
  %u is supposed to be totally portable.
*/
	    printf("\\%u",(unsigned int) ch);
	  else printf("%c \\%u",(CHAR) (ch & 0xff),(unsigned int) ch);
	  if (ch == (KEY) c)
	    printf(" (self, no translation)\n");
	  else
	    printf("\n");
	  break;
      }
    }
#endif /* OS2 */
}
#endif /* NOSETKEY */

VOID
shostrdef(s) CHAR * s; {
    CHAR ch;
    while (ch = *s++) {
	if (ch < 32 || ch == 127 || ch == 255
/*
  Systems whose native character sets have graphic characters in C1...
*/
#ifndef NEXT				/* NeXT */
#ifndef AUX				/* Macintosh */
#ifndef XENIX				/* IBM PC */
#ifdef OS2 
/* 
  It doesn't matter whether the local host can display 8-bit characters
  or not, they are not portable among character-sets and fonts.  Who
  knows what is going to be displayed 
*/
	    || (ch > 127)
#else /* OS2 */
	    || (ch > 127 && ch < 160)
#endif /* OS2 */
#endif /* XENIX */
#endif /* AUX */
#endif /* NEXT */
	    )
	  printf("\\{%d}",ch);		/* Display control characters */
	else putchar((char) ch);	/* in backslash notation */
    }
}

#define xxdiff(v,sys) strncmp(v,sys,strlen(sys))

#ifndef NOSHOW
VOID
shover() {
#ifdef OS2
    extern char ckxsystem[];
#endif /* OS2 */
    extern long xvernum;
    extern char *ck_patch;
    printf("\nVersions:\n %s\n",versio);
    printf(" Numeric: %ld\n",vernum);
#ifdef OS2
    printf(" Operating System: %s\n", ckxsystem);
#else /* OS2 */
    printf(" Built for: %s\n", ckxsys);
#ifdef CK_UTSNAME
    if (unm_nam[0])
      printf(" Running on: %s %s %s %s\n", unm_nam,unm_ver,unm_rel,unm_mch);
#endif /* CK_UTSNAME */
    printf(" Patches: %s\n", *ck_patch ? ck_patch : "(none)");
#endif /* OS2 */
    printf(xxdiff(ckxv,ckxsys) ? " %s for%s\n" : " %s\n",ckxv,ckxsys);
    printf(xxdiff(ckzv,ckzsys) ? " %s for%s\n" : " %s\n",ckzv,ckzsys);
    printf(" %s\n",protv);
    printf(" %s\n",fnsv);
    printf(" %s\n %s\n",cmdv,userv);
#ifndef NOCSETS
    printf(" %s\n",xlav);
#endif /* NOCSETS */
#ifndef MAC
    printf(" %s\n",connv);
#endif /* MAC */
#ifndef NODIAL
    printf(" %s\n",dialv);
#endif /* NODIAL */
#ifndef NOSCRIPT
    printf(" %s\n",loginv);
#endif /* NOSCRIPT */
#ifdef NETCONN
    printf(" %s\n",cknetv);
#ifdef OS2
    printf(" %s\n",ckonetv);
#ifdef CK_NETBIOS
    printf(" %s\n",ckonbiv);
#endif /* CK_NETBIOS */
#ifdef OS2MOUSE
    printf(" %s\n",ckomouv);
#endif /* OS2MOUSE */
#endif /* OS2 */
#endif /* NETCONN */
    printf("\n");
}

#ifdef CK_LABELED
VOID
sholbl() {
#ifdef VMS
    printf("VMS Labeled File Features:\n");
    printf(" acl %s (ACL info %s)\n",
	   showoff(lf_opts & LBL_ACL),
	   lf_opts & LBL_ACL ? "preserved" : "discarded");
    printf(" backup-date %s (backup date/time %s)\n",
	   showoff(lf_opts & LBL_BCK),
	   lf_opts & LBL_BCK ? "preserved" : "discarded");
    printf(" name %s (original filename %s)\n",
	   showoff(lf_opts & LBL_NAM),
	   lf_opts & LBL_NAM ? "preserved" : "discarded");
    printf(" owner %s (original file owner id %s)\n",
	   showoff(lf_opts & LBL_OWN),
	   lf_opts & LBL_OWN ? "preserved" : "discarded");
    printf(" path %s (original file's disk:[directory] %s)\n",
	   showoff(lf_opts & LBL_PTH),
	   lf_opts & LBL_PTH ? "preserved" : "discarded");
#else
#ifdef OS2
    printf("OS/2 Labeled File features (attributes):\n");
    printf(" archive:   %s\n", showoff(lf_opts & LBL_ARC));
    printf(" extended:  %s\n", showoff(lf_opts & LBL_EXT));
    printf(" hidden:    %s\n", showoff(lf_opts & LBL_HID));
    printf(" read-only: %s\n", showoff(lf_opts & LBL_RO ));
    printf(" system:    %s\n", showoff(lf_opts & LBL_SYS));
#endif /* OS2 */
#endif /* VMS */
}
#endif /* CK_LABELED */

VOID
shotcs(csl,csr) int csl, csr; {		/* Show terminal character set */
#ifndef NOCSETS
#ifdef OS2
    extern struct _vtG G[4], *GL, *GR;

    printf(" Terminal character-sets:\n");
#ifndef CKOUNI
    printf("    Local: %s\n",
        csl == FC_TRANSP ? "transparent" : fcsinfo[csl].keyword );
    printf("   Remote: %sG0: %s (%s)\n",
        GL == &G[0] ? "GL->" : GR == &G[0] ? "GR->" : "    ",
        G[0].designation == FC_TRANSP ? "transparent" :
        G[0].designation == FC_DECSPEC ? "dec-special" :
	G[0].designation == FC_DECTECH ? "dec-technical" :
        fcsinfo[G[0].designation].keyword,
        G[0].designation == FC_TRANSP ? "" :
        G[0].size == cs94 ? "94 chars" :
        G[0].size == cs96 ? "96 chars" : "multi-byte" );
    printf("           %sG1: %s (%s)\n",
        GL == &G[1] ? "GL->" : GR == &G[1] ? "GR->" : "    ",
        G[1].designation == FC_TRANSP ? "transparent" :
        G[1].designation == FC_DECSPEC ? "dec-special" :
	G[1].designation == FC_DECTECH ? "dec-technical" :
	fcsinfo[G[1].designation].keyword,
        G[1].designation == FC_TRANSP ? "" :
        G[1].size == cs94 ? "94 chars" :
        G[1].size == cs96 ? "96 chars" : "multi-byte" );
    printf("           %sG2: %s (%s)\n",
        GL == &G[2] ? "GL->" : GR == &G[2] ? "GR->" : "    ",
        G[2].designation == FC_TRANSP ? "transparent" :
        G[2].designation == FC_DECSPEC ? "dec-special" :
	G[2].designation == FC_DECTECH ? "dec-technical" :
        fcsinfo[G[2].designation].keyword,
        G[2].designation == FC_TRANSP ? "" :
        G[2].size == cs94 ? "94 chars" :
        G[2].size == cs96 ? "96 chars" : "multi-byte" );
    printf("           %sG3: %s (%s)\n",
        GL == &G[3] ? "GL->" : GR == &G[3] ? "GR->" : "    ",
        G[3].designation == FC_TRANSP ? "transparent" :
        G[3].designation == FC_DECSPEC ? "dec-special" :
	G[3].designation == FC_DECTECH ? "dec-technical" :
        fcsinfo[G[3].designation].keyword,
        G[3].designation == FC_TRANSP ? "" :
        G[3].size == cs94 ? "94 chars" :
        G[3].size == cs96 ? "96 chars" : "multi-byte" );
#else /* CKOUNI */
    printf("    Local: %s%s\n",
	   isunicode() ? "Unicode/" : "",
	   csl == TX_TRANSP ? "transparent" :
	   csl == TX_UNDEF ? "undefined" : txrinfo[csl]->keywd );
    printf("   Remote: %sG0: %s (%s)\n",
	   GL == &G[0] ? "GL->" : GR == &G[0] ? "GR->" : "    ",
	   txrinfo[G[0].designation]->keywd,
	   G[0].size == cs94 ? "94 chars" :
	   G[0].size == cs96 ? "96 chars" : "multi-byte" );
    printf("           %sG1: %s (%s)\n",
	   GL == &G[1] ? "GL->" : GR == &G[1] ? "GR->" : "    ",
	   txrinfo[G[1].designation]->keywd,
	   G[1].size == cs94 ? "94 chars" :
	   G[1].size == cs96 ? "96 chars" : "multi-byte" );
    printf("           %sG2: %s (%s)\n",
	   GL == &G[2] ? "GL->" : GR == &G[2] ? "GR->" : "    ",
	   txrinfo[G[2].designation]->keywd,
	   G[2].size == cs94 ? "94 chars" :
	   G[2].size == cs96 ? "96 chars" : "multi-byte" );
    printf("           %sG3: %s (%s)\n",
	   GL == &G[3] ? "GL->" : GR == &G[3] ? "GR->" : "    ",
	   txrinfo[G[3].designation]->keywd,
	   G[3].size == cs94 ? "94 chars" :
	   G[3].size == cs96 ? "96 chars" : "multi-byte" );
#endif /* CKOUNI */
#else /* OS2 */
#ifndef MAC
    char *s;
#ifdef CK_ANSIC
    int gettcs(int, int);
#else
    int gettcs();
#endif /* CK_ANSIC */

    printf(" Terminal character-set: ");
    if (csl == csr) {			/* No translation */
	printf("transparent\n");
    } else {				/* Translation */
	printf("%s (remote) %s (local)\n",
	       fcsinfo[csr].keyword,fcsinfo[csl].keyword);
	if (csr != csl) {
	    switch(gettcs(csr,csl)) {
	      case TC_USASCII:  s = "ascii";        break;
	      case TC_1LATIN:   s = "latin1-iso";   break;
	      case TC_2LATIN:   s = "latin2-iso";   break;
	      case TC_CYRILL:   s = "cyrillic-iso"; break;
	      case TC_JEUC:     s = "japanese-euc"; break;
	      case TC_HEBREW:   s = "hebrew-iso";   break;
	      case TC_GREEK:    s = "greek-iso";    break;
	      default:          s = "transparent";  break;
	    }
	    if (strcmp(s,fcsinfo[csl].keyword) &&
		strcmp(s,fcsinfo[csr].keyword))
	      printf("                         (via %s)\n",s);
	}
    }
#endif /* MAC */
#endif /* OS2 */
#endif /* NOCSETS */
}

#ifdef OS2
extern char htab[];
void
shotabs() {
    int i;
    printf("Tab Stops:\n\n");
    for ( i = 1; i <= 70; i++ )   
        printf("%c",htab[i]=='T'?'T':'-');
    printf("\n1.......10........20........30........40........50........60\
........70\n\n");
    for ( ; i <= 140; i++ )
        printf("%c",htab[i]=='T'?'T':'-');
    printf("\n........80........90.......100.......110.......120.......130\
.......140\n\n");
    for ( ; i <= 210; i++ )
        printf("%c",htab[i]=='T'?'T':'-');
    printf("\n.......150.......160.......170.......180.......190.......200\
.......210\n\n");
    for ( ; i <= 255; i++ )
        printf("%c",htab[i]=='T'?'T':'-');
    printf("\n.......220.......230.......240.......250..255\n");
}
#endif /* OS2 */

#ifdef OS2MOUSE
void
shomou() {
    int button, event, id, i;
    char * name = "";

    printf("Mouse settings:\n");
    printf("   Active:         %s\n\n",showoff(tt_mouse));

    for ( button = 0; button < MMBUTTONMAX; button++ )
      for ( event = 0; event < MMEVENTSIZE; event++ )
	if ( mousemap[button][event].type != error )
	  switch ( mousemap[button][event].type ) {
	    case key:
	      printf("   %s = Character: %c \\%d\n",
		     mousename(button,event),
		     mousemap[button][event].key.scancode,
		     mousemap[button][event].key.scancode );
	      break;
	    case kverb:
	      id = mousemap[button][event].kverb.id & ~(F_KVERB);
	      if ( id != K_IGNORE ) {
		  for ( i = 0; i< nkverbs; i++)
		    if ( id == kverbs[i].kwval ) {
			name = kverbs[i].kwd;
			break;
		    }
		  printf("   %s = Kverb: \\K%s\n",
			 mousename(button,event),
			 name
			 );
	      }
	      break;
	    case macro:
	      printf("   %s = Macro: ",
		     mousename(button,event) );
	      shostrdef(mousemap[button][event].macro.string);
	      printf("\n");
	      break;
	  }
}
#endif /* OS2MOUSE */

#ifndef NOLOCAL
VOID
shotrm() {
    char *s;

#ifdef PCFONTS
    int i;
    char *font;

    if ( IsOS2FullScreen() ) {		/* Determine the font name */
        if ( !os2LoadPCFonts() ) {
            for ( i=0; i <ntermfont; i++ ) {
                if ( tt_font == termfont[i].kwval ) {
		    font = termfont[i].kwd;
		    break;
		}       
	    }
	} else {
            font = "(DLL not available)";
	}
    } else {
        font =     "(full screen only)";
    }
#endif /* PCFONTS */

#ifndef OS2
    printf("\n");
#endif /* OS2 */

    printf("Terminal parameters:\n");
    printf(" %19s: %1d%-12s  %13s: %1d%-14s\n",
	   "Bytesize: Command",
           (cmdmsk == 0377) ? 8 : 7, 
           " bits","Terminal",
           (cmask == 0377) ? 8 : 7," bits");
#ifdef OS2
    printf(" %19s: %-13s","Type",
	   (tt_type >= 0 && tt_type <= max_tt) ?
	   tt_info[tt_type].x_name :
	   "unknown" );
    if (tt_type >= 0 && tt_type <= max_tt)
      if (strlen(tt_info[tt_type].x_id))
	printf("  %13s: <ESC>%s","ID",tt_info[tt_type].x_id);
    printf("\n");
#else
    s = getenv("TERM");
    printf(" %19s: %-13s\n","Type", s ? s : "(unknown)");
#endif /* OS2 */
    printf(" %19s: %-13s  %13s: %-15s\n","Echo",
	   duplex ? "local" : "remote","Locking-shift",showoff(sosi));
    printf(" %19s: %-13s  %13s: %-15s\n","Newline-mode",
	   showoff(tnlm),"Cr-display",tt_crd ? "crlf" : "normal");
#ifdef OS2
    printf(" %19s: %-13s  %13s: %-15s\n","Cursor",
	   (tt_cursor == 2) ? "full" :
	   (tt_cursor == 1) ? "half" : "underline",
#ifdef CK_AUTODL            
	   "autodownload",autodl ? "on" : "off"
#else /* CK_AUTODL */
	   "", ""
#endif /* CK_AUTODL */
	   );
#endif /* OS2 */
#ifdef OS2
    printf(" %19s: %-13s  %13s: %-15s\n","Arrow-keys",
	   tt_arrow ? "application" : "cursor",
           "Keypad-mode", tt_keypad ? "application" : "numeric"
	   );

    /* Just to make sure we are using current info */
    updanswerbk();

    /*
       This line doesn't end with '\n' because the answerback string
       is terminated with a newline
    */
    printf(" %19s: %-13s  %13s: %-15s","Answerback",
	   showoff(tt_answer),"response",answerback);
    switch ( tt_bell ) {
      case XYB_NONE:
	s = "none";
	break;
      case XYB_VIS:
	s= "visible";
	break;
      case XYB_AUD | XYB_BEEP:
	s="beep";
	break;
      case XYB_AUD | XYB_SYS:
	s="system sounds";
	break;
      default:
	s="(unknown)";
    }
    printf(" %19s: %-13s  %13s: %-15s\n","Bell",s,
	   "Wrap",showoff(tt_wrap));
    printf(" %19s: %-13d  %13s: %-15d\n","Transmit-timeout",tt_ctstmo,
	   "Output-pacing",tt_pacing);
    printf(" %19s: %-13s  %13s: %-15d\n","Roll-mode",
	   tt_roll[VTERM]?"insert":"overwrite","Scrollback", tt_scrsize[VTERM]
	   );
#endif /* OS2 */

#ifdef CK_APC
    if (apcstatus == APC_ON) s = "on";
    else if (apcstatus == APC_OFF) s = "off";
    else if (apcstatus == APC_UNCH) s = "unchecked";
    printf(" %19s: %-13s  %13s: %-15s\n",
	   "APC", s,
#ifdef OS2
#ifdef PCFONTS
	   "Font",font
#else /* PCFONTS */
	   "",""
#endif /* PCFONTS */
#else
#ifdef CK_AUTODL
	   "Autodownload", autodl ? "on" : "off"
#else
	   "",""
#endif /* CK_AUTODL */
#endif /* OS2 */
	   );
#endif /* CK_APC */

#ifdef OS2                               
    {
        char cpbuf[50];
	int cplist[8], cps;
	cps = os2getcplist(cplist, sizeof(cplist));
	sprintf(cpbuf,"%3d,%3d,%3d,%3d", 
		cps > 1 ? cplist[1] : 0, cps > 2 ? cplist[2] : 0,
		cps > 3 ? cplist[3] : 0, cps > 4 ? cplist[4] : 0 );
	printf(" %19s: %-13d  %13s: %-15s\n","Code-page: active",
	       os2getcp(),"available",cpbuf);
    }
#endif /* OS2 */

#ifdef CK_TTGWSIZ			/* Console terminal screen size */
#ifdef OS2
    if ( tt_cols[VTERM] < 0 || tt_rows[VTERM] < 0 )
      ttgwsiz();			/* Try to get latest size */
    printf(" %19s: %-13d  %13s: %-15d\n","Height",tt_rows[VTERM],
           "Width",tt_cols[VTERM]);
#else /* OS2 */
    ttgwsiz();				/* Try to get latest size */
    printf(" %19s: %-13d  %13s: %-15d\n","Height",tt_rows, "Width", tt_cols);
#endif /* OS2 */
#else
#endif /* CK_TTGWSIZ */

#ifdef OS2
    if (updmode == tt_updmode)
      if (updmode == TTU_FAST)
	s = "fast (fast)";
      else
	s = "smooth (smooth)";
    else
      if (updmode == TTU_FAST)
	s = "fast (smooth)";
      else
	s = "smooth (fast)";

    printf(" %19s: %-13s  %13s: %-15d\n","Screen-update: mode",s,
	   "update freq",tt_update);
#endif /* OS2 */
    printf(" %19s: %-13s  %13s: %-15s\n","Debug",
	   showoff(debses),"Session log", seslog? sesfil : "(none)" ); 
#ifdef OS2
    {
        USHORT row, col;
        char * colors[16] = {
            "black","blue","green","cyan","red","magenta","brown","lgray",
            "dgray","lblue","lgreen","lcyan","lred","lmagent","yellow","white"
	};
        printf("\n Color:");
#ifndef ONETERMUPD
        GetCurPos( &row, &col );
        WrtCharStrAtt("border",    6, row, 9, &colorborder );
	WrtCharStrAtt("debug",     5, row, 17, &colordebug );
        WrtCharStrAtt("helptext",  8, row, 25, &colorhelp );
	WrtCharStrAtt("reverse",   7, row, 34, &colorreverse );
        WrtCharStrAtt("select",    6, row, 42, &colorselect );
        WrtCharStrAtt("status",    6, row, 50, &colorstatus );
        WrtCharStrAtt("terminal",  8, row, 58, &colornormal );
	WrtCharStrAtt("underline",  9, row, 67, &colorunderline );
#endif /* ONETERMUPD */
        row = VscrnGetCurPos(VCMD)->y+1;
        VscrnWrtCharStrAtt(VCMD, "border",    6, row, 9, &colorborder );
	VscrnWrtCharStrAtt(VCMD, "debug",     5, row, 17, &colordebug );
        VscrnWrtCharStrAtt(VCMD, "helptext",  8, row, 25, &colorhelp );
	VscrnWrtCharStrAtt(VCMD, "reverse",   7, row, 34, &colorreverse );
        VscrnWrtCharStrAtt(VCMD, "select",    6, row, 42, &colorselect );
        VscrnWrtCharStrAtt(VCMD, "status",    6, row, 50, &colorstatus );
        VscrnWrtCharStrAtt(VCMD, "terminal",  8, row, 58, &colornormal );
	VscrnWrtCharStrAtt(VCMD, "underline",  9, row, 67, &colorunderline );
        printf( "\n" );

        /* Foreground color names */
        printf("%6s: %-8s%-8s%-9s%-8s%-8s%-8s%-9s%-9s\n","fore",
		"",
		colors[colordebug&0x0F],
		colors[colorhelp&0x0F],
		colors[colorreverse&0x0F],
		colors[colorselect&0x0F],
		colors[colorstatus&0x0F],
		colors[colornormal&0x0F],
		colors[colorunderline&0x0F] );

        /* Background color names */
        printf("%6s: %-8s%-8s%-9s%-8s%-8s%-8s%-9s%-9s\n","back",
		colors[colorborder],
		colors[colordebug>>4],
		colors[colorhelp>>4],
		colors[colorreverse>>4],
		colors[colorselect>>4],
		colors[colorstatus>>4],
		colors[colornormal>>4],
		colors[colorunderline>>4] );
    }
#endif /* OS2 */
    printf("\n");
    printf(" CONNECT-mode escape character: %d (Ctrl-%c, %s): %s\n",
	   escape,ctl(escape),(escape == 127 ? "DEL" : ccntab[escape]),
	   nm[tt_escape]
	   );
#ifdef OS2
    printf(" See SHOW CHARACTER-SETS for character-set info\n");
#else /* OS2 */
#ifndef NOCSETS
    shotcs(tcsl,tcsr);		/* Show terminal character sets */
#endif /* NOCSETS */
#endif /* OS2 */

#ifdef UNIX
#ifndef NOJC
    printf(" %19s: %-13s\n\n","Suspend", showoff(suspend));
#endif /* NOJC */
#endif /* UNIX */
}

VOID
shmdmlin() {				/* Briefly show modem & line */
#ifndef NODIAL
#ifndef MINIDIAL
#ifdef OLDTBCODE
    extern int tbmodel;
    _PROTOTYP( char * gtbmodel, (void) );
#endif /* OLDTBCODE */
#endif /* MINIDIAL */
#endif /* NODIAL */
    if (local)
#ifdef OS2
      printf(" Port: %s, Modem type: ",ttname);
#else
      printf(" Line: %s, Modem type: ",ttname);
#endif /* OS2 */
    else
      printf(
#ifdef OS2
" Communication device not yet selected with SET PORT\n Modem type: "
#else
" Communication device not yet selected with SET LINE\n Modem type: "
#endif /* OS2 */
	     );
#ifndef NODIAL
    printf("%s",gmdmtyp());
#ifndef MINIDIAL
#ifdef OLDTBCODE
    if (tbmodel) printf(" (%s)",gtbmodel()); /* Telebit model info */
#endif /* OLDTBCODE */
#endif /* MINIDIAL */
#else
    printf("(disabled)");
#endif /* NODIAL */
}

#ifdef CK_TAPI
void
shotapi(int option) {
    int rc=0,k ;
    char *s=NULL;
    LPDEVCFG        lpDevCfg = NULL;
    LPCOMMCONFIG    lpCommConfig = NULL;
    LPMODEMSETTINGS lpModemSettings = NULL;
    DCB *           lpDCB = NULL;
    extern struct keytab * tapiloctab;	/* Microsoft TAPI Locations */
    extern int ntapiloc;
    extern struct keytab * tapilinetab;	/* Microsoft TAPI Line Devices */
    extern int ntapiline;
    extern int tttapi;			/* TAPI in use */
    extern int tapipass;		/* TAPI Passthrough mode */
    extern int tapiconv;		/* TAPI Conversion mode */
    extern int tapilights;
    extern int tapipreterm;
    extern int tapipostterm;
    extern int tapimanual;
    extern int tapiinactivity;
    extern int tapibong;
    extern int tapiusecfg;
    extern char tapiloc[];
    extern int tapilocid;

    switch (option) {
      case 0:
	printf("TAPI Settings:\n");
	printf("  Line:                      %s\n",
	       tttapi ? ttname : "(none in use)");

	cktapiBuildLocationTable(&tapiloctab, &ntapiloc);
	if (tapilocid == -1)
	  tapilocid = cktapiGetCurrentLocationID();

	/* Find the current tapiloc entry */
	/* and use it as the default. */
	for (k = 0; k < ntapiloc; k++) {
	    if (tapiloctab[k].kwval == tapilocid) 
	      break;
	}   
	if (k >= 0 && k < ntapiloc)
	  s = tapiloctab[k].kwd;
	else
	  s = "(unknown)";
	printf("  Location:                  %s\n",s);
	printf("  Modem-dialing:             %s\n",tapipass?"off":"on");
	printf("  Phone-number-conversions:  %s\n",
		tapiconv==CK_ON?"on":tapiconv==CK_AUTO?"auto":"off");
	printf("  Modem-lights:              %s %s\n",tapilights?"on ":"off",
		tapipass?"(n/a)":"");
	printf("  Predial-terminal:          %s %s\n",tapipreterm?"on ":"off",
		tapipass?"(n/a)":"");
	printf("  Postdial-terminal:         %s %s\n",tapipostterm?"on ":"off",
		tapipass?"(n/a)":"");
	printf("  Manual-dial:               %s %s\n",tapimanual?"on ":"off",
		tapipass?"(n/a)":"");
	printf("  Inactivity-timeout:        %d seconds %s\n",tapiinactivity,
		tapipass?"(n/a)":"");
	printf("  Wait-for-bong:             %d seconds %s\n",tapibong,
		tapipass?"(n/a)":"");
	printf("  Use-windows-configuration: %s %s\n",
		tapiusecfg?"on ":"off", tapipass?"(n/a)":"");
	printf("\n");
    
#ifdef BETATEST
	if ( tapipass ) {
printf("K-95 uses the TAPI Line in an exclusive mode.  Other applications\n");
printf("may open the device but may not place calls nor answer calls.\n");
printf("Dialing is performed using the K-95 dialing procedures.  SET MODEM\n");
printf("TYPE TAPI after the SET TAPI LINE command to activate the modem\n");
printf("definition associated with the active TAPI LINE device.\n\n");
	}
	else {
printf("K-95 uses the TAPI Line in a cooperative mode.  Other applications\n");
printf("may open the device, place and answer calls.  Dialing is performed\n");
printf("by TAPI.  K-95 SET MODEM commands are not used.\n\n");
	}

	if ( tapiconv == CK_ON || 
	     tapiconv == CK_AUTO && !tapipass ) {
printf(
"Phone numbers are converted from canonical to dialable form by TAPI\n");
printf("using the dialing rules specified in the TAPI Dialing Properties\n");
printf("dialog.\n\n");

	} else {

printf(
"Phone numbers are converted from canonical to dialable form by K-95\n");
printf(
"using the dialing rules specified with the SET DIAL commands.  TAPI\n");
printf(
"Dialing Properties are imported automaticly upon startup and whenever\n");
printf("the TAPI Dialing Properties are altered or when the TAPI Location\n");
printf("is changed.\n\n");
        }
#endif /* BETATEST */

	if (tapipass) {
	    printf("Type SHOW MODEM to see MODEM configuration.\n");
	    if ( tapiconv == CK_ON )
	      printf("Type SHOW DIAL to see DIAL-related items.\n");
	} else {
	    if (tapiconv == CK_ON || tapiconv == CK_AUTO)
	      printf("Type SHOW DIAL to see DIAL-related items.\n");
	}
	break;
      case 1:
	cktapiDisplayTapiLocationInfo();
	break;
      case 2:
        rc = cktapiGetModemSettings(&lpDevCfg,&lpModemSettings,
				     &lpCommConfig,&lpDCB);
        if (rc) {
	    cktapiDisplayModemSettings(lpDevCfg,lpModemSettings,
					 lpCommConfig,lpDCB);
	} else {
	    printf("?Unable to retrieve Modem Settings\n");
	}
        break;
      case 3: {
	  HANDLE hModem = GetModemHandleFromLine( NULL );
	  if (hModem)
	    DisplayCommProperties(hModem);
	  else
	    printf("?Unable to retrieve a valid Modem Handle\n");
	  CloseHandle(hModem);
	  break;
      }
    }
    printf("\n");
}
#endif /* CK_TAPI */
#endif /* NOLOCAL */

#ifdef PATTERNS
static VOID
shopat() {
    extern char * binpatterns[], * txtpatterns[];
    extern int patterns;
    char **p, *s;
    int i, j, k, n, flag, width;
#ifdef CK_TTGWSIZ
    ttgwsiz();				/* Try to get latest size */
#ifdef OS2
    width = tt_cols[VCMD];
#else /* OS2 */
    width = tt_cols;
#endif /* OS2 */
    if (width < 1)
#endif /* CK_TTGWSIZ */
      width = 80;
    printf("\n");
    printf(" Set file type:            %s\n",gfmode(binary,1));
    printf(" Set file patterns:        %s", showoff(patterns));
#ifdef CK_LABELED
    if (binary == XYFT_L)
      printf(" (but SET FILE TYPE LABELED overrides)\n");
    else
#endif /* CK_LABELED */
#ifdef VMS
    if (binary == XYFT_I)
      printf(" (but SET FILE TYPE IMAGE overrides)\n");
    else
#endif /* VMS */
      printf("\n");
    printf(" Maximum patterns allowed: %d\n", FTPATTERNS);
    for (k = 0; k < 2; k++) {		/* For each kind of patter */
	printf("\n");
	if (k == 0) {			/* binary... */
	    printf(" File binary-patterns: ");
	    p = binpatterns;
	} else {			/* text... */
	    printf(" File text-patterns:   ");
	    p = txtpatterns;
	}
	if (!p[0]) {
	    printf("(none)\n");	
	} else {
	    printf("\n ");
	    n = 2;
	    for (i = 0; i < FTPATTERNS; i++) { /* For each pattern */
		if (!p[i])		/* Done */
		  break;
		s = p[i];		/* Look for embedded space */
		for (j = 0, flag = 1; *s; s++, j++) /* and also get length */
		  if (*s == SP)
		    flag = 3;
		n += j + flag;		/* Length of this line */
		if (n >= width - 1) {
		    printf("\n ");
		    n = j+2;
		} 
		printf(flag == 3 ? " {%s}" : " %s", p[i]);
	    }
	    if (n > 2)
	      printf("\n");
	}
    }
    printf("\n");
}
#endif /* PATTERNS */

#ifndef NOSPL
static VOID
shooutput() {
    printf(" Output pacing:          %d (milliseconds)\n",pacing);
    printf(" Output special-escapes: %s\n", showoff(outesc));
}

static VOID
shoinput() {
#ifdef CK_AUTODL
    printf(" Input autodownload:     %s\n", showoff(inautodl));
#endif /* CK_AUTODL */
    printf(" Input cancellation:     %s\n", showoff(inintr));
    printf(" Input case:             %s\n", inpcas[cmdlvl] ?
	   "observe" : "ignore");
    printf(" Input buffer-length:    %d\n", inbufsize);
    printf(" Input echo:             %s\n", showoff(inecho));
    printf(" Input silence:          %d (seconds)\n", insilence);
#ifdef OS2
    printf(" Input terminal:         %s\n", showoff(interm));
#endif /* OS2 */
    printf(" Input timeout:          %s\n", intime[cmdlvl] ?
	   "quit" : "proceed");
    if (instatus < 0)
      printf(" Last INPUT:             -1 (INPUT command not yet given)\n");
    else
      printf(" Last INPUT:             %d (%s)\n", instatus,i_text[instatus]);
}
#endif /* NOSPL */

int
doshow(x) int x; {
    int y, z, i; long zz;
    char *s;
#ifdef OS2
    extern int os2gks;
    extern int tt_kb_mode;
#endif /* OS2 */

#ifndef NOSETKEY
    if (x == SHKEY) {			/* SHOW KEY */
        int c;
#ifdef OS2 
        if ((x = cmkey(shokeytab,nshokey,"How many keys should be shown?",
                        "one",xxstring)) < 0) return(x);
	switch ( tt_kb_mode ) {
	case KBM_EM:
	    s = "emacs";
	    break;
	case KBM_HE:
	    s = "hebrew";
	    break;
	case KBM_RU:
	    s = "russian";
	    break;
	case KBM_EN:
	default:
	    s = "default";
	    break;
	}
        if ((z = cmkey(shokeymtab,nshokeym,"Which definition should be shown?",
                        s,xxstring)) < 0) return(z);
	if ( z == SHKEYDEF )
	    z = -1;
#endif /* OS2 */
        if ((y = cmcfm()) < 0) return(y);
#ifdef MAC
	printf("Not implemented\n");
	return(0);
#else /* Not MAC */
#ifdef OS2
        if (x) {
	    con_event evt;
	    for (c = 0; c < KMSIZE; c++) {
		evt = (z < 0) ? mapkey(c) : maptermkey(c,z);
		if (evt.type != error) {
		    shokeycode(c,z);
		}
	    }
        } else {
#endif /* OS2 */
	    printf(" Press key: ");
#ifdef UNIX
#ifdef NOSETBUF
	    fflush(stdout);
#endif /* NOSETBUF */
#endif /* UNIX */
	    conbin((char)escape);	/* Put terminal in binary mode */
#ifdef OS2
	    os2gks = 0;			/* Raw scancode processing */
#endif /* OS2 */
	    c = congks(0);		/* Get character or scan code */
#ifdef OS2
	    os2gks = 1;			/* Cooked scancode processing */
#endif /* OS2 */
	    concb((char)escape);	/* Restore terminal to cbreak mode */
	    if (c < 0) {		/* Check for error */
		printf("?Error reading key\n");
		return(0);
	    }
#ifndef OS2
/*
  Do NOT mask when it can be a raw scan code, perhaps > 255
*/
	    c &= cmdmsk;		/* Apply command mask */
#endif /* OS2 */
	    printf("\n");
#ifdef OS2
	    shokeycode(c,z);
#else /* OS2 */
	    shokeycode(c);
#endif /* OS2 */
#ifdef OS2 
        }
#endif /* OS2 */
	return(1);
#endif /* MAC */
    }
#ifndef NOKVERBS
    if (x == SHKVB) {			/* SHOW KVERBS */
	if ((y = cmcfm()) < 0) return(y);	    
	printf("\nThe following %d keyboard verbs are available:\n\n",nkverbs);
	kwdhelp(kverbs,nkverbs,"","\\K","",3,0);
	printf("\n");
	return(1);
    }
#ifdef OS2
    if (x == SHUDK) {			/* SHOW UDKs */
	extern void showudk(void);
	if ((y = cmcfm()) < 0) return(y);
	showudk();
	return(1);
    }
#endif /* OS2 */
#endif /* NOKVERBS */
#endif /* NOSETKEY */

#ifndef NOSPL
    if (x == SHMAC) {			/* SHOW MACRO */
	struct FDB kw, fl, cm;
	for (y = 0; y < nmac; y++) {	/* copy the macro table */
	    mackey[y].kwd = mactab[y].kwd; /* into a regular keyword table */
	    mackey[y].kwval = y;	/* with value = pointer to macro tbl */
	    mackey[y].flgs = mactab[y].flgs;
	}
	/* parse name as keyword */
    cmfdbi(&kw,				/* First FDB - command switches */
	   _CMKEY,			/* fcode */
	   "Macro name",		/* hlpmsg */
	   "",				/* default */
	   "",				/* addtl string data */
	   nmac,			/* addtl numeric data 1: tbl size */
	   0,				/* addtl numeric data 2: 4 = cmswi */
	   xxstring,			/* Processing function */
	   mackey,			/* Keyword table */
	   &fl				/* Pointer to next FDB */
	   );
    cmfdbi(&fl,				/* 2nd FDB - command to send from */
	   _CMFLD,			/* fcode */
	   "Pattern",			/* hlpmsg */
	   "",				/* default */
	   "",				/* addtl string data */
	   0,				/* addtl numeric data 1 */
	   0,				/* addtl numeric data 2 */
	   xxstring,
	   NULL,
	   &cm
	   );
    cmfdbi(&cm,				/* 4th FDB - Confirmation */
	   _CMCFM,			/* fcode */
	   "",				/* hlpmsg */
	   "",				/* default */
	   "",				/* addtl string data */
	   0,				/* addtl numeric data 1 */
	   0,				/* addtl numeric data 2 */
	   NULL,
	   NULL,
	   NULL
	   );
	
	x = cmfdb(&kw);
	if (x < 0) return(x);
	switch (cmresult.fcode) {
	  case _CMKEY:
	  case _CMFLD:
	    strcpy(line,atmbuf);
	    if ((x = cmcfm()) < 0)
	      return(x);
	    break;
	  case _CMCFM:	    
	    line[0] = NUL;
	  default:
	    break;
	}    
	s = line;
	if (*line) {
	    slc = 0;			/* Initial SHO MAC line number */
	    x = mlook(mactab,s,nmac);	/* Look up what they typed */
	    switch (x) {
	      case -3:			/* Nothing to look up */
		return(0);
	      case -1:			/* Not found */
		printf("%s - not found\n",s);
		return(0);
	      case -2:			/* Ambiguous, matches more than one */
		y = (int)strlen(line);
		slc = 1;
		for (x = 0; x < nmac; x++)
		  if (!strncmp(mactab[x].kwd,line,y))
		    if (shomac(mactab[x].kwd,mactab[x].mval) < 0) break;
		return(1);
	      default:			/* Matches one exactly */
		shomac(mactab[x].kwd,mactab[x].mval);
		return(1);
	    }
	} else {			/* They want to see them all */
	    printf("Macros:\n");
	    slc = 1;
	    for (y = 0; y < nmac; y++)
	      if (shomac(mactab[y].kwd,mactab[y].mval) < 0) break;
	    return(1);
	}
    }
#endif /* NOSPL */

/*
  Other SHOW commands only have two fields.  Get command confirmation here,
  then handle with big switch() statement.
*/
#ifndef NOSPL
    if (x != SHBUI)
#endif /* NOSPL */
      if ((y = cmcfm()) < 0)
	return(y);
    switch (x) {

#ifdef ANYX25
#ifndef IBMX25
      case SHPAD:
	shopad(0);
	break;
#endif /* IBMX25 */
#endif /* ANYX25 */

      case SHNET:
#ifndef NETCONN
	printf(" No network support in this version of C-Kermit.\n");
#else
	shonet();
#endif /* NETCONN */
	break;

      case SHPAR:
	shopar();
	break;
 
      case SHATT:
	shoatt();
	break;
 
#ifndef NOSPL
      case SHCOU:
	printf(" %d\n",count[cmdlvl]);
	break;
#endif /* NOSPL */

#ifndef NOSERVER
      case SHSER:			/* Show Server */
	i = 0;
#ifndef NOFRILLS
	printf("Function           Status:\n");
	i++;
	printf(" GET                %s\n",nm[en_get]);
	i++;
	printf(" SEND               %s\n",nm[en_sen]);
	i++;
	printf(" MAIL               %s\n",nm[en_mai]);
	i++;
	printf(" PRINT              %s\n",nm[en_pri]);
	i++;
#ifndef NOSPL
	printf(" REMOTE ASSIGN      %s\n",nm[en_asg]);
	i++;
#endif /* NOSPL */
	printf(" REMOTE CD/CWD      %s\n",nm[en_cwd]);
	i++;
#ifdef ZCOPY
	printf(" REMOTE COPY        %s\n",nm[en_cpy]);
	i++;
#endif /* ZCOPY */
	printf(" REMOTE DELETE      %s\n",nm[en_del]);
	printf(" REMOTE DIRECTORY   %s\n",nm[en_dir]);
	printf(" REMOTE HOST        %s\n",nm[en_hos]);
	i += 3;
#ifndef NOSPL
	printf(" REMOTE QUERY       %s\n",nm[en_que]);
	i++;
#endif /* NOSPL */
	printf(" REMOTE MKDIR       %s\n",nm[en_mkd]);
	printf(" REMOTE RMDIR       %s\n",nm[en_rmd]);
	printf(" REMOTE RENAME      %s\n",nm[en_ren]);
	printf(" REMOTE SET         %s\n",nm[en_set]);	    
	printf(" REMOTE SPACE       %s\n",nm[en_spa]);	    
	printf(" REMOTE TYPE        %s\n",nm[en_typ]);	    
	printf(" REMOTE WHO         %s\n",nm[en_who]);
	printf(" BYE                %s\n",nm[en_bye]);
	printf(" FINISH             %s\n",nm[en_fin]);
	i += 9;
#endif /* NOFRILLS */
	if (i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
	printf("Server timeout:     %d\n",srvtim);
	if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
	printf("Server display:     %s\n", showoff(srvdis));
	if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
        printf("Server login:       ");
	if (!x_user) {
	    printf("(none)\n");
	} else {
	    char *s;
	    printf("\"%s\", \"%s\", \"%s\"\n",
		   x_user,
		   x_passwd ? x_passwd : "",
		   x_acct ? x_acct : ""
		   );
	}	    
	if (++i > cmd_rows - 3) { if (!askmore()) return(1); else i = 0; }
	printf("Server get-path:");
	if (ngetpath == 0) {
	    printf("    (none)\n");
	} else {
	    printf("\n");
	    i += 3;
	    for (x = 0; x < ngetpath; x++) {
		if (getpath[x]) printf(" %d. %s\n", x, getpath[x]);
		if (++i > (cmd_rows - 3)) { /* More than a screenful... */
		    if (!askmore())
		      break;
		    else
		      i = 0;
		}
	    }
	}
	break;
#endif /* NOSERVER */

      case SHSTA:			/* Status of last command */
	printf( " %s\n", success ? "SUCCESS" : "FAILURE" );
	return(0);			/* Don't change it */

#ifdef MAC
      case SHSTK: {			/* Stack for MAC debugging */
	  long sp;

	  sp = -1;
	  loadA0 ((char *)&sp);		/* set destination address */
	  SPtoaA0();			/* move SP to destination */
	  printf("Stack at 0x%x\n", sp);
	  show_queue();			/* more debugging */
	  break; 
      }
#endif /* MAC */

#ifdef OS2
      case SHTAB:			/* SHOW TABS */
        shotabs();
        break;
#endif /* OS2 */

#ifndef NOLOCAL
      case SHTER:			/* SHOW TERMINAL */
	shotrm();
	break;
#endif /* NOLOCAL */

#ifdef OS2
      case SHVSCRN:			/* SHOW Virtual Screen - for debug */
	shovscrn();
        break;
#endif /* OS2 */

#ifdef OS2MOUSE
      case SHMOU:			/* SHOW MOUSE */
        shomou();
        break;
#endif /* OS2MOUSE */

#ifndef NOFRILLS
      case SHVER:
	shover();
	break;
#endif /* NOFRILLS */
 
#ifndef NOSPL
      case SHBUI:			/* Built-in variables */
	if ((y = cmtxt("Variable name or pattern","",&s,xxstring)) < 0)
	  return(y);
	strcpy(line,s);
	if (line[0]) strcat(line,"*");

      case SHFUN:			/* or built-in functions */
#ifdef CK_TTGWSIZ
#ifdef OS2
	if (tt_cols[VTERM] < 0 || tt_rows[VTERM] < 0)
	  ttgwsiz();
#else /* OS2 */
	if (ttgwsiz() > 0) {		/* Get current screen size */
	    if (tt_rows > 0 && tt_cols > 0) {
		cmd_rows = tt_rows;
		cmd_cols = tt_cols;
	    }
	}
#endif /* OS2 */
#endif /* CK_TTGWSIZ */

	if (x == SHFUN) {		/* Functions */
	    printf("\nThe following functions are available:\n\n");
	    kwdhelp(fnctab,nfuncs,"","\\F","()",3,0);
	    printf("\n");
#ifndef NOHELP
	    printf(
"HELP FUNCTION <name> gives the calling conventions of the given function.\n");
	    printf(
"Specify the part of the name after the \"\\F\", e.g. \"help func \
substring\".\n\n");
#endif /* NOHELP */
	    break;
	} else {			/* Variables */
	    i = 0;
	    for (y = 0; y < nvars; y++) {
		if ((vartab[y].flgs & CM_INV))
		  continue;
		if (line[0])
		  if (!ckmatch(line,vartab[y].kwd,0))
		    continue;
		s = nvlook(vartab[y].kwd);
		printf(" \\v(%s) = ",vartab[y].kwd);
		if (vartab[y].kwval == VN_NEWL) { /* \v(newline) */
		    while (*s)		/* Show control chars symbolically */
		      printf("\\{%d}",*s++);
		    printf("\n");
		} else if (vartab[y].kwval == VN_IBUF  || /* \v(input) */
			   vartab[y].kwval == VN_QUE   || /* \v(query) */
#ifdef OS2
			   vartab[y].kwval == VN_SELCT || /* \v(select) */
#endif /* OS2 */
			   (vartab[y].kwval >= VN_M_AAA && /* modem ones */
			    vartab[y].kwval <= VN_M_ZZZ)
			   ) {
		    int r = 12;	/* This one can wrap around */
		    char buf[10];
		    while (*s) {
			if (isprint(*s)) {
			    buf[0] = *s;
			    buf[1] = NUL;
			    r++;
			} else {
			    sprintf(buf,"\\{%d}",*s);
			    r += (int) strlen(buf);
			}
			if (r >= cmd_cols - 1) {
			    printf("\n");
			    r = 0;
			    i++;
			}
			printf("%s",buf);
			s++;
		    }
		    printf("\n");
		} else
		  printf("%s\n",s);
		if (++i > (cmd_rows - 3)) { /* More than a screenful... */
		    if ((y >= nvars - 1) || !askmore())
		      break;
		    else
		      i = 0;
		}
	    }
	}
	break;

      case SHVAR:			/* Global variables */
	x = 0;				/* Variable count */
	slc = 1;			/* Screen line count for "more?" */
	for (y = 33; y < GVARS; y++)
	  if (g_var[y]) {
	      if (x++ == 0) printf("Global variables:\n");
	      sprintf(line," \\%%%c",y);
	      if (shomac(line,g_var[y]) < 0) break;
	  }
	if (!x) printf(" No variables defined\n");
	break;

      case SHARG:			/* Args */
	if (maclvl > -1) {
	    printf("Macro arguments at level %d\n",maclvl);
	    for (y = 0; y < 10; y++)
	      if (m_arg[maclvl][y])
		printf(" \\%%%d = %s\n",y,m_arg[maclvl][y]);
	} else {
	    printf(" No macro arguments at top level\n");
	}
	break;

      case SHARR:			/* Arrays */
	x = 0;
	for (y = 0; y < (int) 'z' - ARRAYBASE + 1; y++)
	  if (a_ptr[y]) {
	      if (x == 0) printf("Declared arrays:\n");
	      x = 1;
	      printf(" \\&%c[%d]\n",
		     (y == 1) ? 64 : y + ARRAYBASE, a_dim[y]);
	  }
	if (!x) printf(" No arrays declared\n");
	break;
#endif /* NOSPL */

      case SHPRO:			/* Protocol parameters */
	shoparp();
#ifdef COMMENT
/* moved to shoparp() */
	if (protocol == PROTO_K) {
#ifdef XFRCAN
	    printf("\n Cancellation: %s",showoff(xfrcan));
	    if (xfrcan) printf(" %d %d\n", xfrchr, xfrnum);
	    else printf("\n");
#endif /* XFRCAN */
	    printf(" Send / Receive Pause:   %d (msec)\n\n",pktpaus);
	}
#endif /* COMMENT */
	printf("\n");
	break;

#ifndef NOLOCAL
      case SHCOM:			/* Communication parameters */
	printf("\n");
	shoparc();
#ifdef OS2
	{
	    int i;
	    char *s = "(unknown)";
	    for (i = 0; i < nprty; i++)
	      if (prtytab[i].kwval == priority) {
		  s = prtytab[i].kwd;
		  break;
	      }
	    printf(" Priority: %s\n", s );
	}
#endif /* OS2 */

	printf("\n");
#ifdef NETCONN
	if (!network) {
#endif /* NETCONN */
	    shomdm();
	    printf("\n");
#ifdef NETCONN
	}
#endif /* NETCONN */

#ifdef COMMENT				/* No more space for this! */
#ifndef NODIAL
	printf("\n");
#ifdef NETCONN
	if (!network)
#endif /* NETCONN */
	  shodial();
#endif /* NODIAL */
#else  /* not COMMENT */
#ifndef NODIAL
	printf("Type SHOW DIAL to see DIAL-related items\n");
#ifdef CK_TAPI
        printf("Type SHOW TAPI to see TAPI-related items\n"); 
#endif /* CK_TAPI */
#endif /* NODIAL */
#endif /* COMMENT */
	break;
#endif /* NOLOCAL */

      case SHFIL:			/* File parameters */
	shofil();
	/* printf("\n"); */		/* (out o' space) */
	break;

#ifndef NOCSETS
      case SHLNG:			/* Languages */
	shoparl();
	break;
#endif /* NOCSETS */

#ifndef NOSPL
      case SHSCR:			/* Scripts */
	printf("\n");
	printf(" Command quoting:        %s\n", showoff(cmdgquo()));
	printf(" Take  echo:             %s\n", showoff(techo));
	printf(" Take  error:            %s\n", showoff(takerr[cmdlvl]));
	printf(" Macro echo:             %s\n", showoff(mecho));
	printf(" Macro error:            %s\n", showoff(merror[cmdlvl]));
        printf(" Function diagnostics:   %s\n", showoff(fndiags));
        printf(" Function error:         %s\n", showoff(fnerror));
	shoinput();
	shooutput();
#ifndef NOSCRIPT
	printf(" Script echo:            %s\n", showoff(secho));
#endif /* NOSCRIPT */
	printf(" Command buffer length:  %d\n", CMDBL);
	printf(" Atom buffer length:     %d\n", ATMBL);
	printf("\n");
	break;
#endif /* NOSPL */

#ifndef NOXMIT
      case SHXMI:
	printf("\n");
	printf(" File type: %s\n", binary ? "binary" : "text");
#ifndef OS2
        printf(" See SHOW CHARACTER-SETS for character-set info\n");
#else /* OS2 */
#ifndef NOCSETS
	shotcs(tcsl,tcsr);
#endif /* NOCSETS */
#endif /* OS2 */
	printf(" Terminal echo: %s\n", duplex ? "local" : "remote");
	printf(" Transmit EOF: ");
	if (*xmitbuf == NUL) {
	    printf("(none)\n");
	} else {
	    char *p;
	    p = xmitbuf;
	    while (*p) {
		if (*p < SP)
		  printf("^%c",ctl(*p));
		else
		  printf("%c",*p);
		p++;
	    }
	    printf("\n");
	}
	if (xmitf)
	  printf(" Transmit Fill: %d (fill character for blank lines)\n",
		 xmitf);
	else
	  printf(" Transmit Fill: (none)\n");
	printf(" Transmit Linefeed: %s\n",
	       xmitl ? "on (send linefeeds too)" : "off");
	if (xmitp) 
	  printf(" Transmit Prompt: %d (host line end character)\n",xmitp);
	else
	  printf(" Transmit Prompt: (none)\n");
	printf(" Transmit Echo: %s\n", showoff(xmitx));
	printf(" Transmit Locking-Shift: %s\n", showoff(xmits));
	printf(" Transmit Pause: %d millisecond%s\n",
	       xmitw,
	       (xmitw == 1) ? "" : "s"
	       );
	printf(" Transmit Timeout: %d second%s\n",
	       xmitt,
	       (xmitt == 1) ? "" : "s"
	       );
	printf("\n");
	break;
#endif /* NOXMIT */

#ifndef NODIAL
      case SHMOD:			/* SHOW MODEM */
	shomodem();			/* Show SET MODEM items */
	break;
#endif /* NODIAL */

#ifndef MAC
      case SHDFLT:
	zsyscmd(PWDCMD);
	break;
#endif /* MAC */

#ifndef NOLOCAL
      case SHESC:
	printf(" Escape character: Ctrl-%c (ASCII %d, %s): %s\r\n",
	       ctl(escape), escape, (escape == 127 ? "DEL" : ccntab[escape]),
	   nm[tt_escape]
	   );
	break;
#endif /* NOLOCAL */

#ifndef NODIAL
      case SHDIA:			/* SHOW DIAL */
	shmdmlin();
	printf(", speed: ");
	if ((zz = ttgspd()) < 0) {
	    printf("unknown");
	} else {
	    if (zz == 8880) printf("75/1200"); else printf("%ld",zz);
	}
	if (carrier == CAR_OFF) s = "off";
	else if (carrier == CAR_ON) s = "on";
	else if (carrier == CAR_AUT) s = "auto";
	else s = "unknown";
	printf(", carrier: %s", s);
	if (carrier == CAR_ON) {
	    if (cdtimo) printf(", timeout: %d sec", cdtimo);
	    else printf(", timeout: none");
	}
	printf("\n");
	doshodial();
	if (local
#ifdef NETCONN
	    && !network
#endif /* NETCONN */
	    ) {
	    printf("Type SHOW MODEM to see modem settings.\n");
#ifdef CK_TAPI
            printf("Type SHOW TAPI to see TAPI-related items\n"); 
#endif /* CK_TAPI */
	    printf("Type SHOW COMMUNICATIONS to see modem signals.\n");
	}
	break;
#endif /* NODIAL */

#ifdef CK_LABELED
      case SHLBL:			/* Labeled file info */
	sholbl();
	break;
#endif /* CK_LABELED */

      case SHCSE:			/* Character sets */
#ifdef NOCSETS
	printf(
" Character set translation is not supported in this version of C-Kermit\n");
#else
	shocharset();
	printf("\n Unknown-Char-Set: %s\n",
	       unkcs ? "Keep" : "Discard");
#ifdef OS2
        printf("\n");
#endif /* OS2 */
        shotcs(tcsl,tcsr);
	printf("\n");
#endif /* NOCSETS */
	break;

      case SHFEA:			/* Features */
	shofea();
	break;

#ifdef CK_SPEED
      case SHCTL:			/* Control-Prefix table */
	shoctl();
	break;
#endif /* CK_SPEED */

      case SHEXI:
	printf("\n Exit warning %s\n", xitwarn ? 
	       (xitwarn == 1 ? "on" : "always") : "off");
	printf(" Exit on-disconnect: %s\n", showoff(exitonclose));
	printf(" Current exit status: %d\n\n", xitsta);
	break;

      case SHPRT: {
#ifdef PRINTSWI
	  extern int printtimo, printertype, noprinter;
	  extern char * printterm, * printsep;
#ifdef BPRINT
	  extern int printbidi;
#endif /* BPRINT */
#endif /* PRINTSWI */

#ifdef PRINTSWI
	  if (noprinter) {
	      printf("Printer: (none)\n\n");
	      break;
	  }
#endif /* PRINTSWI */

	  printf("Printer: %s%s\n",

		 printpipe ? "| " : "",
		 printername ? printername :
#ifdef OS2
		 "PRN"
#else
		 "(default)"
#endif /* OS2 */
		 );
#ifdef PRINTSWI
#ifdef BPRINT
	  if (printbidi) {
	      printf(" /BIDIRECTIONAL\n");
	      if (pportspeed > 0)
		printf(" /SPEED:%ld\n",pportspeed);
	      printf(" /PARITY:%s\n",parnam((char)pportparity));
	      printf(" /FLOW:%s\n",
		     pportflow == FLO_NONE ? "NONE" :
		     (pportflow == FLO_RTSC ? "RTS/CTS" : "XON/XOFF")
		     );
	  } else
	    printf(" /OUTPUT-ONLY\n");
#endif /* BPRINT */
	  switch (printertype) {
	    case PRT_NON: printf(" /NONE\n"); break;
	    case PRT_FIL: printf(" /FILE\n"); break;
	    case PRT_PIP: printf(" /PIPE\n"); break;
	    case PRT_DOS: printf(" /DOS-DEVICE\n"); break;
	    case PRT_WIN: printf(" /WINDOWS-QUEUE\n"); break;
	  }	      
	  printf(" /TIMEOUT:%d\n",printtimo);
          if (printterm) {
              printf(" /END-OF-JOB-STRING:");
              shostrdef(printterm);
              printf("\n");
          } else
	    printf(" /END-OF-JOB-STRING:(none)\n");
	  printf(" /JOB-HEADER-FILE:%s\n",printsep ? printsep : "(none)");
#endif /* PRINTSWI */
	  printf("\n");
	  break;
      }

      case SHCMD:
	printf(" Command bytesize: %d bits\n",
	       (cmdmsk == 0377) ? 8 : 7);
#ifdef CK_RECALL
	printf(" Command recall-buffer-size: %d\n",cm_recall);
#else
	printf(" Command recall-buffer not available in this version\n");
#endif /* CK_RECALL */
#ifdef CK_RECALL
	printf(" Command retry: %s\n",cm_retry ? "on" : "off");
#else
	printf(" Command retry not available in this version\n");
#endif /* CK_RECALL */
	printf(" Command interruption: %s\n", showoff(cmdint));
	printf(" Command quoting: %s\n", showoff(cmdgquo()));
	printf(" Command more-prompting: %s\n", showoff(xaskmore));
	printf(" Command height: %d\n", cmd_rows);
	printf(" Command width:  %d\n", cmd_cols);
	printf(" Maximum command length: %d\n", CMDBL);
#ifndef NOSPL
	printf(" Maximum number of macros: %d\n", MAC_MAX);
	printf(" Macros defined: %d\n", nmac);
	printf(" Maximum macro depth: %d\n", MACLEVEL);
	printf(" Maximum TAKE depth: %d\n", MAXTAKE);
#endif /* NOSPL */
#ifdef UNIX
#ifndef NOJC
	printf(" Suspend: %s\n", showoff(suspend));
#endif /* NOJC */
#endif /* UNIX */
	break;

#ifndef NOSPL
      case SHALRM:
	if (ck_alarm)
	  printf("Alarm at %s %s\n",alrm_date,alrm_time);
	else
	  printf("(no alarm set)\n");
	break;
#endif /* NOSPL */

#ifndef NOMSEND
      case SHSFL: {
	  extern struct filelist * filehead;
	  if (!filehead) {
	      printf("send-list is empty\n");
	  } else {
	      struct filelist * flp;
	      char * s;
	      flp = filehead;
	      while (flp) {
		  s = flp->fl_alias;
		  if (!s) s = "(none)";
		  printf("%s, mode: %s, alias: %s\n",
			 flp->fl_name,
			 gfmode(flp->fl_mode,0),
			 s
			 );
		  flp = flp->fl_next;
	      }
	  }
      }
      break;
#endif /* NOMSEND */

#ifdef CKXXCHAR
      case SHDBL:
	shodbl();
	break;
#endif /* CKXXCHAR */

#ifndef NOPUSH
#ifndef NOFRILLS
      case SHEDIT:
	if (!editor[0]) {
	    s = getenv("EDITOR");
	    if (s) strncpy(editor,s,CKMAXPATH);
	}
	printf("\n editor:  %s\n", editor[0] ? editor : "(none)");
	if (editor[0]) {
	    printf(" options: %s\n", editopts[0] ? editopts : "(none)");
	    printf(" file:    %s\n", editfile[0] ? editfile : "(none)");
        }
	printf("\n");
	break;

#ifdef BROWSER
      case SHBROWSE:
	if (!browser[0]) {
	    s = getenv("BROWSER");
	    if (s) strncpy(browser,s,CKMAXPATH);
	}
	printf("\n browser: %s\n", browser[0] ? browser : "(none)");
	if (browser[0]) {
	    printf(" options: %s\n", browsopts[0] ? browsopts : "(none)");
	    printf(" url:     %s\n", browsurl[0] ? browsurl : "(none)");
	}
	printf("\n");
	break;
#endif /* BROWSER */
#endif /*  NOFRILLS */
#endif /* NOPUSH */

#ifdef CK_TAPI
      case SHTAPI:			/* TAPI options */
	shotapi(0);
	break;
      case SHTAPI_L:			/* TAPI Locations */
	shotapi(1);
	break;
      case SHTAPI_M:			/* TAPI Modem */
	shotapi(2);
	break;
      case SHTAPI_C:			/* TAPI Comm */
	shotapi(3);
	break;
#endif /* CK_TAPI */

#ifdef TNCODE
      case SHTEL:			/* TELNET */
	printf("\n");
	shotel(0);
	printf("\n");
	break;
#endif /* TNCODE */

#ifndef NOSPL
      case SHINP:
	shoinput();
	break;
#endif /* NOSPL */

#ifdef CK_TRIGGER
      case SHTRIG: {
	  extern char * tt_trigger[], * triggerval;
	  int i;
	  if (!tt_trigger[0]) {
	      printf(" Triggers: (none)\n");
	  } else {
	      printf(" Triggers:\n");
	      for (i = 0; i < TRIGGERS; i++) {
		  if (!tt_trigger[i])
		    break;
		  printf("  \"%s\"\n",tt_trigger[i]);
	      }
	      printf(" Most recent trigger encountered: ");
	      if (triggerval)
		printf("\"%s\"\n",triggerval);
	      else
		printf("(none)\n");
	  }		   
	  break;
      }
#endif /* CK_TRIGGER */

      case SHLOG:
#ifndef MAC
#ifdef DEBUG
	printf("\n Debug log:       %s\n", deblog ? debfil : "(none)");
#endif /* DEBUG */
	printf(" Packet log:      %s\n",   pktlog ? pktfil : "(none)");
#ifndef NOLOCAL
	printf(" Session log:     %s\n",   seslog ? sesfil : "(none)");
#endif /* NOLOCAL */
#ifdef TLOG
	if (tralog) {
	    extern int tlogsep;
	    printf(" Transaction log: %s (%s)",
		   trafil,
		   tlogfmt ? "verbose" : "brief"
		   );
	    if (tlogfmt == 0)
	      printf(" (separator='%c')", (char)tlogsep);
	    printf("\n\n");
	} else
	  printf(" Transaction log: (none)\n\n");
#endif /* TLOG */
#endif /* MAC */
	break;

#ifndef NOSPL
      case SHOUTP:			/* OUTPUT */
	shooutput();
	break;
#endif /* NOSPL */

#ifdef PATTERNS
      case SHOPAT:			/* PATTERNS */
	shopat();
	break;
#endif /* PATTERNS */

#ifdef STREAMING
      case SHOSTR: {			/* STREAMING */
	  extern int streamrq, streamed, reliable, tsecs, clearrq, cleared;
	  extern long tfc; 
	  extern long tfcps;
	  printf("\n Reliable:     %s\n",showoff(reliable));
	  printf(" Clearchannel: %s\n",showooa(clearrq));
	  printf(" Streaming:    %s\n\n",showooa(streamrq));
	  if (streamrq == SET_OFF || streamrq == SET_AUTO && !reliable)
	    printf(" Streaming will not be requested and will not be done.\n");
	  else if (streamrq == SET_ON || streamrq == SET_AUTO && reliable)
	    printf(
" Streaming will be requested and will be done if the other Kermit agrees.\n");
	  printf(" Last transfer: %sstreaming%s, %ld cps.\n",
		 streamed > 0 ? "" : "no ",
		 cleared ? ", clearchannel" : "",
		 tfcps
		 );
	  printf("\n");
	  break;
      }
#endif /* STREAMING */
#ifdef CK_KERBEROS
      case SHOAUTH:
	return(sho_auth(x));
#endif /* CK_KERBEROS */

#ifdef BROWSER
      case SHOFTP: {
	  extern char ftpapp[], ftpopts[];
	  printf("\n ftp-client:  %s\n", ftpapp[0] ? ftpapp : "(none)");
	  if (ftpapp[0]) {
	      printf(" ftp options: %s\n", ftpopts[0] ? ftpopts : "(none)");
	  }
	  printf("\n");
	  break;
      }
#endif /* BROWSER */

      default:
	printf("\nNothing to show...\n");
	return(-2);
    }
    return(success = 1);
}

int
shoatt() {
    printf("Attributes: %s\n", showoff(atcapr));
    if (!atcapr) return(0);
    printf(" Blocksize: %s\n", showoff(atblki));
    printf(" Date: %s\n", showoff(atdati));
    printf(" Disposition: %s\n", showoff(atdisi));
    printf(" Encoding (Character Set): %s\n", showoff(atenci));
    printf(" Length: %s\n", showoff(atleni));
    printf(" Type (text/binary): %s\n", showoff(attypi));
    printf(" System ID: %s\n", showoff(atsidi));
    printf(" System Info: %s\n", showoff(atsysi));
#ifdef CK_PERMS
    printf(" Protection: %s\n", showoff(atlpri));
#endif /* CK_PERMS */
#ifdef STRATUS
    printf(" Format: %s\n", showoff(atfrmi));
    printf(" Creator: %s\n", showoff(atcrei));
    printf(" Account: %s\n", showoff(atacti));
#endif /* STRATUS */
    return(0);
}

#ifndef NOSPL
int					/* SHOW MACROS */
shomac(s1, s2) char *s1, *s2; {
    int x, n, pp;
    pp = 0;				/* Parenthesis counter */

    debug(F110,"shomac s1",s1,0);
    debug(F110,"shomac s2",s2,0);

    if (!s1)
      return(0);
    else
      printf("\n%s = ",s1);		/* Print blank line and macro name */
    slc++;				/* Count the line */
    n = (int)strlen(s1) + 4;		/* Width of current line */
    if (!s2) s2 = "(null definition)";

    while (x = *s2++) {			/* Loop thru definition */
	if (x == '(') pp++;		/* Treat commas within parens */
	if (x == ')') pp--;		/* as ordinary text */
	if (pp < 0) pp = 0;		/* Outside parens, */
	if (x == ',' && pp == 0) {	/* comma becomes comma-dash-NL. */
	    putchar(',');
	    putchar('-');
	    x = '\n';
	}
	putchar((CHAR)x);		/* Output the character */
	if (x == '\n') {		/* If it was a newline */
#ifdef UNIX
#ifdef NOSETBUF
	    fflush(stdout);
#endif /* NOSETBUF */
#endif /* UNIX */
	    putchar(' ');		/* Indent the next line 1 space */
	    while(*s2 == ' ') s2++;	/* skip past leading blanks */
	    n = 2;			/* restart the character counter */
	    slc++;			/* and increment the line counter. */
	} else if (++n > (cmd_cols - 1)) { /* If line is too wide */
	    putchar('-');		/* output a dash */
	    putchar(NL);		/* and a newline */
#ifdef UNIX
#ifdef NOSETBUF
	    fflush(stdout);
#endif /* NOSETBUF */
#endif /* UNIX */
	    n = 1;			/* and restart the char counter */
	    slc++;			/* and increment the line counter */
	}
	if (n < 3 && slc > (cmd_rows - 3)) { /* If new line and screen full */
	    if (!askmore()) return(-1);	/* ask if they want more. */
	    n = 1;			/* They do, start a new line */
	    slc = 0;			/* and restart line counter */
	}
    }
    putchar(NL);			/* End of definition */
    if (++slc > (cmd_rows - 3)) {
	if (!askmore()) return(-1);
	slc = 0;
    }
    return(0);
}
#endif /* NOSPL */
#endif /* NOSHOW */

int x_ifnum = 0;			/* Flag for IF NUMERIC active */

#ifndef NOSPL
/* Evaluate an arithmetic expression. */
/* Code adapted from ev, by Howie Kaye of Columbia U & others. */

static int xerror;
static char *cp;
static long tokval;
static char curtok;
static long expval;

#define LONGBITS (8*sizeof (long))
#define NUMBER 'N'
#define N_EOT 'E'

/*
 Replacement for strchr() and index(), neither of which seem to be universal.
*/

static char *
#ifdef CK_ANSIC
windex(char * s, char c)
#else
windex(s,c) char *s, c;
#endif /* CK_ANSIC */
/* windex */ {
    while (*s != NUL && *s != c) s++;
    if (*s == c) return(s); else return(NULL);
}

/*
 g e t t o k

 Returns the next token.  If token is a NUMBER, sets tokval appropriately.
*/
static char
gettok() {

    while (isspace(*cp))		/* Skip past leading spaces */
      cp++;

    switch (*cp) {
      case '$':				/* ??? */
      case '+':				/* Add */
      case '-':				/* Subtract or Negate */
      case '@':				/* Greatest Common Divisor */
      case '*':				/* Multiply */
      case '/':				/* Divide */
      case '%':				/* Modulus */
      case '<':				/* Left shift */
      case '>':				/* Right shift */
      case '&':				/* And */
      case '|':				/* Or */
      case '#':				/* Exclusive Or */
      case '~':				/* Not */
      case '^':				/* Exponent */
      case '!':				/* Factorial */
      case '(':				/* Parens for grouping */
      case ')': return(*cp++);		/* operator, just return it */
      case '\n':
      case '\0': return(N_EOT);		/* End of line, return that */
    }
    if (isxdigit(*cp)) {		/* Digit, must be a number */
	char tbuf[80],*tp;		/* Buffer to accumulate number */
	int radix = 10;			/* Default radix */
	for (tp = tbuf; isxdigit(*cp); cp++)
	  *tp++ = (char) (isupper(*cp) ? tolower(*cp) : *cp);
	*tp = '\0';			/* End number */
	switch(isupper(*cp) ? tolower(*cp) : *cp) { /* Examine break char */
	  case 'h':
	  case 'x': radix = 16; cp++; break; /* if radix signifier... */
	  case 'o':
	  case 'q': radix = 8; cp++; break;
	  case 't': radix = 2; cp++; break;
	}
	for (tp = tbuf, tokval = 0; *tp != '\0'; tp++)  {
	    int dig;
	    dig = *tp - '0';		/* Convert number */
	    if (dig > 10) dig -= 'a'-'0'-10;
	    if (dig >= radix) {
		xerror = 1;
		if (cmdlvl == 0 && !x_ifnum)
		  printf("invalid digit '%c' in number\n",*tp);
		return(NUMBER);
	    }
	    tokval = radix*tokval + dig;
	}
	return(NUMBER);
    }
    if (cmdlvl == 0 && !x_ifnum)
      printf("Invalid character '%c' in input\n",*cp);
    xerror = 1;
    cp++;
    return(gettok());
}

static long
#ifdef CK_ANSIC
expon(long x, long y)
#else
expon(x,y) long x,y;
#endif /* CK_ANSIC */
/* expon */ {
    long result = 1;
    int sign = 1;
    if (y < 0) return(0);
    if (x < 0) {
	x = -x;
	if (y & 1) sign = -1;
    }
    while (y != 0) {
	if (y & 1) result *= x;
	y >>= 1;
	if (y != 0) x *= x;
  }
  return(result * sign);
}

/*
 * factor ::= simple | simple ^ factor
 *
 */
_PROTOTYP( static VOID simple, (void) );

static VOID
factor() {
    long oldval;
    simple();
    if (curtok == '^') {
	oldval = expval;
	curtok = gettok();
	factor();
	expval = expon(oldval,expval);
    }
}

/*
 * termp ::= NULL | {*,/,%,&} factor termp
 *
 */
static VOID
termp() {
    while (curtok == '*' || curtok == '/' || curtok == '%' || curtok == '&') {
	long oldval;
	char op;
	op = curtok;
	curtok = gettok();		/* skip past operator */
	oldval = expval;
	factor();
	switch(op) {
	  case '*': expval = oldval * expval; break;
	  case '/':
	  case '%':
	    if (expval == 0) {
		if (!x_ifnum)
		  printf("?Divide by zero\n");
		expval = -1; /* No way to return a null integer */
	    } else
	      expval = (op == '/') ? (oldval / expval) : (oldval % expval);
	    break;
	  case '&':
	    expval = oldval & expval; break;
	}
    }
}

static long
#ifdef CK_ANSIC
fact(long x)
#else
fact(x) long x;
#endif /* CK_ANSIC */
/* fact */ {				/* factorial */
    long result = 1;
    while (x > 1)
      result *= x--;
    return(result);
}

/*
 * term ::= factor termp
 *
 */
static VOID
term() {
    factor();
    termp();
}

static long
#ifdef CK_ANSIC
gcd(long x, long y)
#else
gcd(x,y) long x,y;
#endif /* CK_ANSIC */
/* gcd */ {				/* Greatest Common Divisor */
    int nshift = 0;
    if (x < 0) x = -x;
    if (y < 0) y = -y;			/* validate arguments */
    if (x == 0 || y == 0) return(x + y);    /* this is bogus */
    
    while (!((x & 1) | (y & 1))) {	/* get rid of powers of 2 */
	nshift++;
	x >>= 1;
	y >>= 1;
    }
    while (x != 1 && y != 1 && x != 0 && y != 0) {
	while (!(x & 1)) x >>= 1;	/* eliminate unnecessary */
	while (!(y & 1)) y >>= 1;	/* powers of 2 */
	if (x < y) {			/* force x to be larger */
	    long t;
	    t = x;
	    x = y;
	    y = t;
	}
	x -= y;
    }
    if (x == 0 || y == 0) return((x + y) << nshift); /* gcd is non-zero one */
    else return((long) 1 << nshift);	/* else gcd is 1 */
}

/*
 * exprp ::= NULL | {+,-,|,...} term exprp
 *
 */
static VOID
exprp() {
    while (windex("+-|<>#@",curtok) != NULL) {
	long oldval;
	char op;
	op = curtok;
	curtok = gettok();		/* skip past operator */
	oldval = expval;
	term();
	switch(op) {
	  case '+' : expval = oldval + expval; break;
	  case '-' : expval = oldval - expval; break;
	  case '|' : expval = oldval | expval; break;
	  case '#' : expval = oldval ^ expval; break;
	  case '@' : expval = gcd(oldval,expval); break;
	  case '<' : expval = oldval << expval; break;
	  case '>' : expval = oldval >> expval; break;
	}
    }
}

/*
 * expr ::= term exprp
 *
 */
static VOID
expr() {
    term();
    exprp();
}

static long
xparse() {
    curtok = gettok();
    expr();
#ifdef COMMENT
    if (curtok == '$') {
	curtok = gettok();
	if (curtok != NUMBER) {
	    if (cmdlvl == 0 && !x_ifnum)
	      printf("illegal radix\n");
	    return(0);
	}
	curtok = gettok();
    }
#endif /* COMMENT */
    if (curtok != N_EOT) {
	if (cmdlvl == 0 && !x_ifnum)
	  printf("extra characters after expression\n");
	xerror = 1;
    }
    return(expval);
}

char *
evala(s) char *s; {
    char *p;				/* Return pointer */
    long v;				/* Numeric value */

    if (!s) return("");
    xerror = 0;				/* Start out with no error */
    cp = s;				/* Make the argument global */
    v = xparse();			/* Parse the string */
    p = numbuf;				/* Convert long number to string */
    sprintf(p,"%ld",v);
    return(xerror ? "" : p);		/* Return empty string on error */
}

/*
 * simplest ::= NUMBER | ( expr )
 *
 */
static VOID
simplest() {
    if (curtok == NUMBER) expval = tokval;
    else if (curtok == '(') {
	curtok = gettok();		/* skip over paren */
	expr();
	if (curtok != ')') {
	    if (cmdlvl == 0 && !x_ifnum)
	      printf("missing right parenthesis\n");
	    xerror = 1;
	}
    } else {
	if (cmdlvl == 0 && !x_ifnum)
	  printf("operator unexpected\n");
	xerror = 1;
    }
    curtok = gettok();
}

/*
 * simpler ::= simplest | simplest !
 *
 */
static VOID
simpler() {
    simplest();
    if (curtok == '!') {
	curtok = gettok();
	expval = fact(expval);
    }
}

/*
 * simple ::= {-,~} simpler | simpler
 *
 */

static VOID
simple() {
    if (curtok == '-' || curtok == '~') {
	int op = curtok;
	curtok = gettok();		/* skip over - sign */
	simpler();			/* parse the factor again */
	expval = op == '-' ? -expval : ~expval;
    } else simpler();
}

/*  D C L A R R A Y  --  Declare an array  */

int					/* Declare an array of size n */
#ifdef CK_ANSIC
dclarray(char a, int n)
#else
dclarray(a,n) char a; int n;
#endif /* CK_ANSIC */
/* dclarray */ {
    char **p; int i, n2;

    if (a > 63 && a < 91) a += 32;	/* Convert letters to lowercase */
    if (a < ARRAYBASE || a > 122)	/* Verify name */
      return(-1);
    a -= ARRAYBASE;			/* Convert name to number */
    if ((p = a_ptr[a]) != NULL) {	/* Delete old array of same name */
	n2 = a_dim[a];
	for (i = 0; i <= n2; i++) {	/* First delete its elements */
	    if (p[i]) {
		free(p[i]);
		p[i] = NULL;
	    }
	}
	free(a_ptr[a]);			/* Then the element list */
	a_ptr[a] = (char **) NULL;	/* Remove pointer to element list */
	a_dim[a] = 0;			/* Set dimension at zero. */
    }
    if (n == 0) return(0);		/* If dimension 0, just deallocate. */

    p = (char **) malloc((n+1) * sizeof(char **)); /* Allocate for new array */
    if (p == NULL) return(-1);		/* Check */
    a_ptr[a] = p;			/* Save pointer to member list */
    a_dim[a] = n;			/* Save dimension */
    for (i = 0; i <= n; i++)		/* Initialize members to null */
      p[i] = NULL;
    return(0);
}

/*  A R R A Y N A M  --  Parse an array name  */

/*
  Call with pointer to string that starts with the array reference.
  String may begin with either \& or just &.
  On success,
    Returns letter ID (always lowercase) in argument c,
      which can also be accent grave (` = 96; '@' is converted to grave);
    Dimension or subscript in argument n;
    IMPORTANT: These arguments must be provided by the caller as addresses
    of ints (not chars), for example:
      char *s; int x, y;
      arraynam(s,&x,&y);
  On failure, returns a negative number, with args n and c set to zero.
*/
int
arraynam(ss,c,n) char *ss; int *c; int *n; {
    int i, y, pp;
    char x;
    char *s, *p, *sx, *vnp;
    /* On stack to allow for recursive calls... */
    char vnbuf[ARRAYREFLEN+1];		/* Entire array reference */
    char ssbuf[ARRAYREFLEN+1];		/* Subscript in "plain text" */
    char sxbuf[16];			/* Evaluated subscript */

    *c = *n = 0;			/* Initialize return values */
    for (i = 0; i < (int)strlen(ss); i++) /* Check length */
      if (ss[i] == ']')
	break;
    if (i > ARRAYREFLEN) {
	printf("?Array reference too long - %s\n",ss);
	return(-9);
    }
    strncpy(vnbuf,ss,ARRAYREFLEN);
    vnp = vnbuf;
    if (vnbuf[0] == CMDQ && vnbuf[1] == '&') vnp++;
    if (*vnp != '&') {
	printf("?Not an array - %s\n",vnbuf);
	return(-9);
    }
    x = *(vnp + 1);			/* Fold case of array name */

    /* We don't use isupper & tolower here on purpose because these */
    /* would produce undesired effects with accented letters. */
    if (x > 63 && x < 91) x  = *(vnp + 1) = (char) (x + 32);
    if ((x < ARRAYBASE) || (x > 122) || (*(vnp+2) != '[')) {
	if (msgflg) {
	    printf("?Invalid format for array name - %s\n",vnbuf);
	    return(-9);
	} else
	  return(-2);
    }
    *c = x;				/* Return the array name */
    s = vnp+3;				/* Get dimension */

    p = ssbuf;    
    pp = 1;				/* Bracket counter */
    for (i = 0; i < ARRAYREFLEN && *s != NUL; i++) { /* Copy up to ] */
	if (*s == '[') pp++;
	if (*s == ']' && --pp == 0) break;
	*p++ = *s++;
    }
    if (*s != ']') {
	printf("?No closing bracket on array dimension - %s\n",vnbuf);
	return(-9);
    }
    *p--;				/* Trim whitespace from end */
    while (*p == SP || *p == HT)
      p--;
    p++;
    *p = NUL;				/* Terminate subscript with null */
    p = ssbuf;				/* Point to beginning of subscript */
    while (*p == SP || *p == HT)	/* Trim whitespace from beginning */
      p++;
    sx = sxbuf;				/* Where to put expanded subscript */
    y = 16;
    zzstring(p,&sx,&y);			/* Convert variables, etc. */
    sx = sxbuf;
    while (*sx == SP) sx++;
    debug(F110,"arraynam sx","",sx);
    if (!*sx)				/* Empty brackets... */
      return(-2);

    p = evala(sx);			/* Run it thru \fneval()... */
    if (p) if (*p) strcpy(sxbuf,p);	/* We know it has to be a number. */

    if (!chknum(sxbuf)) {		/* Make sure it's all digits */
	if (msgflg) {
	    printf("?Array dimension or subscript missing or not numeric\n");
	    return(-9);
	} else
	  return(-2);
    }
    if ((y = atoi(sxbuf)) < 0) {
        if (cmflgs == 0) printf("\n");
	if (msgflg) {
	    printf("?Array dimension or subscript not positive or zero\n");
	    return(-9);
	} else
	  return(-2);
    }
    *n = y;				/* Return the subscript or dimension */
    return(0);
}

int
chkarray(a,i) int a, i; {		/* Check if array is declared */
    int x;				/* and if subscript is in range */
    if (a == 64) a = 96;		/* Convert atsign to grave accent */
    x = a - ARRAYBASE;			/* Values must be in range 95-122 */
    if (x == 0 && maclvl < 0)		/* Macro arg vector but no macro */
      return(0);
    if (x < 0 || x > 'z' - ARRAYBASE)	/* Not in range */
      return(-2);
    if (a_ptr[x] == NULL) return(-1);	/* Not declared */
    if (i > a_dim[x]) return(-2);	/* Declared but out of range. */
    return(a_dim[x]);			/* All ok, return dimension */
}

#ifdef COMMENT				/* This isn't used. */
char *
arrayval(a,i) int a, i; {		/* Return value of \&a[i] */
    int x; char **p;			/* (possibly NULL) */
    if (a == 64) a = 96;		/* Convert atsign to grave accent */
    x = a - ARRAYBASE;			/* Values must be in range 95-122 */
    if (x < 0 || x > 27) return(NULL);	/* Not in range */
    if ((x > 0) && (p = a_ptr[x]) == NULL) /* Array not declared */
      return(NULL);
    if (i > a_dim[x])			/* Subscript out of range. */
      return(NULL);
    return(p[i]);			/* All ok, return pointer to value. */
}
#endif /* COMMENT */

int
pusharray(x,z) int x, z; {
    int y;
    debug(F101,"pusharray x","",x);
    debug(F101,"pusharray z","",z);
    y = chkarray(x,z);
    debug(F101,"pusharray y","",y);
    if (y < 0) {			/* Check if declared, etc. */
	return(0);			/* Nothing to push */
    }
    x -= ARRAYBASE;			/* Convert name letter to index. */
    aa_ptr[cmdlvl][x] = a_ptr[x];
    aa_dim[cmdlvl][x] = y;
    a_ptr[x] = (char **) NULL;
    a_dim[x] = 0;
    return(0);
}

/*  P A R S E V A R  --  Parse a variable name or array reference.  */
/*
 Call with:
   s  = pointer to candidate variable name or array reference.
   *c = address of integer in which to return variable ID.
   *i = address of integer in which to return array subscript.
 Returns:
   -2:  syntax error in variable name or array reference.
    1:  successful parse of a simple variable, with ID in c.
    2:  successful parse of an array reference, w/ID in c and subscript in i.
*/
int
parsevar(s,c,i) char *s; int *c, *i; {
    char *p;
    int x,y,z;

    p = s;
    if (*s == CMDQ) s++;		/* Point after backslash */

    if (*s != '%' && *s != '&') {	/* Make sure it's % or & */
	printf("?Not a variable name - %s\n",p);
	return(-9);
    }
    if ((int)strlen(s) < 2) {
	printf("?Incomplete variable name - %s\n",p);
	return(-9);
    }
    if (*s == '%' && *(s+2) != '\0') {
	printf("?Only one character after '%%' in variable name, please\n");
	return(-9);
    }
    if (*s == '&' && *(s+2) != '[') {
	printf("?Array subscript expected - %s\n",p);
	return(-9);
    }
    if (*s == '%') {			/* Simple variable. */
	y = *(s+1);			/* Get variable ID letter/char */
	if (isupper(y)) y -= ('a'-'A');	/* Convert upper to lower case */
	*c = y;				/* Set the return values. */
	*i = -1;			/* No array subscript. */
	return(1);			/* Return 1 = simple variable */
    }
    if (*s == '&') {			/* Array reference. */
	y = arraynam(s,&x,&z);		/* Go parse it. */
	debug(F101,"parsevar arraynam","",y);
	if ((y) < 0) {			
	    if (y == -2)
	      return(pusharray(x,z));
	    if (y != -9)
	      printf("?Invalid array reference - %s\n",p);
	    return(-9);
	}
	if (chkarray(x,z) < 0) {	/* Check if declared, etc. */
	    printf("?Array not declared or subscript out of range\n");
	    return(-9);
	}
	*c = x;				/* Return array letter */
	*i = z;				/* and subscript. */
	return(2);
    }    
    return(-2);				/* None of the above. */
}

#define VALN 20

/* Get the numeric value of a variable */
/*
  Call with pointer to variable name, pointer to int for return value.
  Returns:
    0 on success with second arg containing the value.
   -1 on failure (bad variable syntax, variable not defined or not numeric).
*/
int
varval(s,v) char *s; int *v; {
    char valbuf[VALN+1];		/* s is pointer to variable name */
    char name[256];
    char *p;
    int y;

    if (*s != CMDQ) {			/* Handle macro names too */
	sprintf(name,"\\m(%s)", s);
	s = name;
    }
    p = valbuf;				/* Expand variable into valbuf. */
    y = VALN;
    if (zzstring(s,&p,&y) < 0) return(-1);
    p = valbuf;				/* Make sure value is numeric */
    if (chknum(p)) {			/* Convert numeric string to int */
	*v = atoi(p);			/* OK */
    } else {				/* Not OK */
	p = evala(p);			/* Maybe it's an expression */
	if (!chknum(p))			/* Did it evaluate? */
	  return(-1);			/* No, failure. */
	else				/* Yes, */
	  *v = atoi(p);			/* success */
    }
    return(0);    
}

/* Increment or decrement a variable */
/* Returns -1 on failure, 0 on success */

int
incvar(s,x,z) char *s; int x; int z; {	/* Increment a numeric variable */
    char valbuf[VALN+1];		/* s is pointer to variable name */
					/* x is amount to increment by */
    int n;				/* z != 0 means add */
					/* z = 0 means subtract */

    if (varval(s,&n) < 0)		/* Convert numeric string to int */
      return(-1);
    if (z)				/* Increment it by the given amount */
      n += x;
    else				/* or decrement as requested. */
      n -= x;
    sprintf(valbuf,"%d",n);		/* Convert back to numeric string */
    addmac(s,valbuf);			/* Replace old variable */
    return(0);
}

/* D O D O  --  Do a macro */

/*
  Call with x = macro table index, s = pointer to arguments.
  Returns 0 on failure, 1 on success.
*/

int
dodo(x,s,flags) int x; char *s; int flags; {
    int y;
#ifdef OS2
    extern int term_io;
    int term_io_sav = term_io;
#endif /* OS2 */

    debug(F101,"dodo maclvl","",maclvl);
    if (++maclvl >= MACLEVEL) {		/* Make sure we have storage */
        debug(F101,"dodo maclvl too deep","",maclvl);
	--maclvl;
	printf("Macros nested too deeply\n");
	return(0);
    }
    macp[maclvl] = mactab[x].mval;	/* Point to the macro body */ 
    macx[maclvl] = mactab[x].mval;	/* Remember where the beginning is */
    makestr(&(m_line[maclvl]),s);	/* Entire arg string for "\%*" */
    debug(F111,"do macro",macp[maclvl],maclvl);

    cmdlvl++;				/* Entering a new command level */
    if (cmdlvl >= CMDSTKL) {		/* Too many macros + TAKE files? */
        debug(F101,"dodo cmdlvl too deep","",cmdlvl);
	cmdlvl--;
	printf("?TAKE files and DO commands nested too deeply\n");
	return(0);
    }
#ifdef VMS
    conres();				/* So Ctrl-C, etc, will work. */
#endif /* VMS */
#ifdef OS2
    term_io = 0;			/* Disable terminal emulator I/O */
#endif /* OS2 */
    ifcmd[cmdlvl] = 0;
    iftest[cmdlvl] = 0;
    count[cmdlvl] = count[cmdlvl-1];	/* Inherit COUNT from previous level */
    intime[cmdlvl] = intime[cmdlvl-1];	/* Inherit previous INPUT TIMEOUT */
    inpcas[cmdlvl] = inpcas[cmdlvl-1];	/*   and INPUT CASE */
    takerr[cmdlvl] = takerr[cmdlvl-1];	/*   and TAKE ERROR */
    merror[cmdlvl] = merror[cmdlvl-1];	/*   and MACRO ERROR */
    cmdstk[cmdlvl].src = CMD_MD;	/* Say we're in a macro */
    cmdstk[cmdlvl].lvl = maclvl;	/* and remember the macro level */
    cmdstk[cmdlvl].ccflgs = flags;	/* set flags */
    mrval[maclvl] = NULL;		/* Initialize return value */

    debug(F110,"do macro",mactab[x].kwd,0);

/* Clear old %0..%9 arguments */

    addmac("%0",mactab[x].kwd);		/* Define %0 = name of macro */
    makestr(&(m_xarg[maclvl][0]),mactab[x].kwd);
    varnam[0] = '%';
    varnam[2] = '\0';
    for (y = 1; y < 10; y++) {		/* Clear args %1..%9 */
	varnam[1] = (char) (y + '0');
	delmac(varnam);
    }	

/* Assign the new args one word per arg, allowing braces to group words */

    xwords(s,MAXARGLIST,NULL,0);
#ifdef OS2
    term_io = term_io_sav;
#endif /* OS2 */
    return(1);
}

/* Insert "literal" quote around each comma-separated command to prevent */
/* its premature expansion.  Only do this if object command is surrounded */
/* by braces. */

static char* flit = "\\flit(";

int
litcmd(src,dest) char **src, **dest; {
    int bc = 0, pp = 0;
    char *s, *lp, *ss;
    char * ppp;

    s = *src;
    lp = *dest;
    ppp = *dest;

    debug(F110,"litcmd",s,0);

    while (*s == SP) s++;		/* strip extra leading spaces */
    debug(F110,"litcmd2",s,0);

    if (*s == '{') {

        pp = 0;				/* paren counter */
	bc = 1;				/* count leading brace */
	*lp++ = *s++;			/* copy it */
	debug(F110,"litcmd3",s,0);
	while (*s == SP) s++;		/* strip interior leading spaces */
	debug(F110,"litcmd4",s,0);
	ss = flit;			/* point to "\flit(" */
	while (*lp++ = *ss++);		/* copy it */

	debug(F110,"litcmd5",s,0);

	lp--;				/* back up over null */

	while (*s) {			/* go thru rest of text */
	    ss = flit;			/* point back to start of "\flit(" */
	    if (*s == '{') bc++;	/* count brackets */
	    if (*s == '(') pp++;	/* and parens */
	    if (*s == ')') pp--;
	    if (*s == '}') {		/* Closing brace. */
		if (--bc == 0) {	/* Final one? */
		    *lp++ = ')';	/* Add closing paren for "\flit()" */
		    *lp++ = *s++;
		    break;
		}
	    }
	    *lp = NUL;
	    debug(F110,"litcmd6",s,0);

#ifdef COMMENT
/* This was from before \flit() stopped breaking on commas... */
	    if (*s == ',' && pp == 0) {	/* comma not inside of parens */
		*lp++ = ')';		/* closing ) of \flit( */
		*lp++ = ',';		/* insert the comma */
		while (*lp++ = *ss++);	/* start new "\flit(" */
		lp--;			/* back up over null */
		s++;			/* skip over comma in source string */
		while (*s++ == SP);	/* eat leading spaces again. */
		s--;			/* back up over nonspace */
		continue;
	    }
#endif /* COMMENT */
            *lp++ = *s++;		/* Copy anything but comma here. */
        }
	*lp = NUL;
	debug(F110,"litcmd7",s,0);

    } else {				/* No brackets around, */
	while (*lp++ = *s++)		/* just copy. */
	  ;
	lp--;
	debug(F110,"litcmd8",s,0);
    }
    debug(F110,"litcmd9",s,0);

    *src = s;
    *dest = lp;
    if (bc) return(-1);
    else return(0);
}
#endif /* NOSPL */

/* Functions moved here from ckuusr.c to even out the module sizes... */

/*
  Breaks up string s -- IN PLACE! -- into a list of up to max words.
  Pointers to each word go into the array list[].
  max is the maximum number of words (pointers).
  If list is NULL, then they are added to the macro table.
  flag = 0 means the last field is to be one word, like all the other fields,
         so anything after it is discarded.
  flag = 1 means the last field extends to the end of the string, even if
         there are lots of words left, so the last field contains the
         remainder of the string.
*/
VOID
xwords(s,max,list,flag) char *s; int max; char *list[]; int flag; {
    char *p;
    int b, i, k, y, z;
#ifndef NOSPL
    int macro;
    macro = (list == NULL);
    debug(F101,"xwords macro","",macro);
#endif /* NOSPL */

#ifdef XWORDSDEBUG
    printf("XWORDS max=%d\n",max);
#endif /* XWORDSDEBUG */
    p = s;				/* Pointer to beginning of string */
    b = 0;				/* Flag for outer brace removal */
    k = 0;				/* Flag for in-word */
    y = 0;				/* Brace nesting level */
    z = 0;				/* "Word" counter, 0 thru max */

    if (list)
      for (i = 0; i <= max; i++)	/* Initialize pointers */
	list[i] = NULL;

    if (flag) max--;

    while (1) {				/* Go thru word list */
	if (!s || (*s == '\0')) {	/* No more characters? */
	    if (k != 0) {		/* Was I in a word? */
		if (z == max) break;	/* Yes, only go up to max. */
		z++;			/* Count this word. */
#ifdef XWORDSDEBUG
		printf("1 z++ = %d\n", z);
#endif /* XWORDSDEBUG */
#ifndef NOSPL
		if (macro) {		/* Doing macro args */
		    if (z < 10) {
			varnam[1] = (char) (z + '0'); /* Assign last arg */
			addmac(varnam,p);
		    }
		    if (z <= max) {
			makestr(&(m_xarg[maclvl][z]),p);
		    }
		} else {		/* Not doing macro args */
#endif /* NOSPL */
		    list[z] = p;	/* Assign pointer. */
#ifdef XWORDSDEBUG
		    printf("[1]LIST[%d]=\"%s\"\n",z,list[z]);
#endif /* XWORDSDEBUG */
#ifndef NOSPL
		}
#endif /* NOSPL */
		break;			/* And get out. */
	    } else break;		/* Was not in a word */
	}
	if (k == 0 && (*s == SP || *s == HT)) { /* Eat leading blanks */
	    s++;
	    continue;
	} else if (*s == '{') {		/* An opening brace */
	    if (k == 0 && y == 0) {	/* If leading brace */
		p = s+1;		/* point past it */
		b = 1;			/* and flag that we did this */
	    }
	    k = 1;			/* Flag that we're in a word */
	    y++;			/* Count the brace. */
	} else if (*s == '}') {		/* A closing brace. */
	    y--;			/* Count it. */
	    if (y == 0 && b != 0) {	/* If it matches the leading brace */
		*s = SP;		/* change it to a space */
		b = 0;			/* and we're not in braces any more */
	    } else if (y < 0) k = 1;	/* otherwise just start a new word. */
	} else if (*s != SP && *s != HT) { /* Nonspace means we're in a word */
	    if (k == 0) {		/* If we weren't in a word before, */
		p = s;			/* Mark the beginning */
		if (flag && z == max) {	/* Want last word to be remainder? */
		    z++;
#ifdef XWORDSDEBUG
		    printf("1 z++ = %d\n", z);
#endif /* XWORDSDEBUG */
		    list[z] = p;	/* Yes, point to it */
#ifdef XWORDSDEBUG
		    printf("[4]LIST[%d]=\"%s\"\n",z,list[z]);
#endif /* XWORDSDEBUG */
		    break;		/* and quit */
		}
		k = 1;			/* Set in-word flag */
	    }
	}
	/* If we're not inside a braced quantity, and we are in a word, and */
	/* we have hit whitespace, then we have a word. */
	if ((y < 1) && (k != 0) && (*s == SP || *s == HT)) { 
	    if (!flag || z < max)	/* if we don't want to keep rest */
	      *s = '\0';		/* terminate the arg with null */
	    k = 0;			/* say we're not in a word any more */
	    y = 0;			/* start braces off clean again */
	    if (z == max) break;	/* Only go up to max. */
	    z++;			/* count this arg */
#ifdef XWORDSDEBUG
	    printf("1 z++ = %d\n", z);
#endif /* XWORDSDEBUG */

#ifndef NOSPL
	    if (macro) {
		if (z < 10) {
		    varnam[1] = (char) (z + '0'); /* compute its name */
		    addmac(varnam,p);	/* add it to the macro table */
		}
		if (z <= max) {
		    makestr(&(m_xarg[maclvl][z]),p);
		}
	    } else {
#endif /* NOSPL */
		list[z] = p;
#ifdef XWORDSDEBUG
		printf("[2]LIST[%d]=\"%s\"\n",z,list[z]);
#endif /* XWORDSDEBUG */
#ifndef NOSPL
	    }
#endif /* NOSPL */
	    p = s+1;
	}
	s++;				/* Point past this character */
    }
    if ((z == 0) && (y > 1)) {		/* Extra closing brace(s) at end */
	z++;
#ifndef NOSPL
	if (macro) {
	    if (z < 10) {
		varnam[1] = z + '0';	/* compute its name */
		addmac(varnam,p);	/* Add rest of line to last arg */
	    }
	    if (z <= max) {
		makestr(&(m_xarg[maclvl][z]),p);
	    }
	} else {
#endif /* NOSPL */
	    list[z] = p;
#ifdef XWORDSDEBUG
	    printf("[3]LIST[%d]=\"%s\"\n",z,list[z]);
#endif /* XWORDSDEBUG */
#ifndef NOSPL
	}
#endif /* NOSPL */
    }
#ifndef NOSPL
    if (macro) {			/* Macro */
	macargc[maclvl] = z + 1;	/* Set \v(argc) variable */
	n_xarg[maclvl] = z + 1;		/* This is the actual number */
	a_ptr[0] = m_xarg[maclvl];	/* Point \&_[] at the args */
	a_dim[0] = z;			/* And give it this dimension */
    }
#endif /* NOSPL */
    return;
}

static char *prevdir = NULL;

int
docd(cx) int cx; {			/* Do the CD command */
    int x;
    extern int quiet;
    char *s, *p;
#ifdef MAC
    char temp[34];
#endif /* MAC */

#ifndef NOFRILLS
    if (cx == XXBACK) {
	if ((x = cmcfm()) < 0)
	cwdf = 1;
	if (prevdir) {
	    s = zgtdir();
	    if (!zchdir(prevdir)) {
		cwdf = 0;
		perror(s);
	    } else {
		free(prevdir);
		prevdir = malloc((int)strlen(s)+1);
		if (prevdir) strcpy(prevdir,s);
	    }
	}	    
	return(cwdf);
    }
#endif /* NOFRILLS */

#ifdef GEMDOS
    if ((x = cmdir("Name of local directory, or carriage return",homdir,&s,
		   NULL)) < 0 )
      return(x);
#else
#ifdef OS2
    if ((x = cmdirp("Name of PC disk and/or directory,\n\
       or press the Enter key for the default",homdir,&s,
		   getenv("CDPATH"),xxstring)) < 0 )
      return(x);
#else
#ifdef MAC
    strncpy(temp,homdir,32);
    x = strlen(temp);
    if (x > 0) if (temp[x-1] != ':') { temp[x] = ':'; temp[x+1] = NUL; }
    if ((x = cmtxt("Name of Macintosh volume and/or folder,\n\
 or press the Return key for the desktop on the boot disk",
		   temp,&s, xxstring)) < 0 )
      return(x);
#else
    if ((x = cmdirp("Carriage return for home directory,\n\
or name of directory on this computer",
#ifdef VMS
		    "SYS$LOGIN",	/* With no colon */
#else
		    homdir,		/* In VMS this is "SYS$LOGIN:" */
#endif /* VMS */
		    &s,
		    getenv("CDPATH"),
		    xxstring
		    )) < 0)
      return(x);
#endif /* MAC */
#endif /* OS2 */
#endif /* GEMDOS */
    strcpy(line,s);			/* Make a safe copy */
    s = line;
    debug(F110,"docd",s,0);
#ifndef MAC
    if ((x = cmcfm()) < 0)		/* Get confirmation */
      return(x);
#endif /* MAC */

#ifdef datageneral
    x = strlen(line);			/* homdir ends in colon, */
    if (x > 1 && line[x-1] == ':')	/* and "dir" doesn't like that... */
      line[x-1] = NUL;
#endif /* datageneral */

#ifdef MAC
    cwdf = 1;
    if (! zchdir(s)) {
	cwdf = 0;
	if (*s != ':') {		/* If it failed, */
	    char *p;			/* supply leading colon */
	    p = malloc((int)strlen(s) + 2); /* and try again... */
	    if (p) {
		strcpy(p,":");
		strcat(p,s);
		if (zchdir(p))
		  cwdf = 1;
		free(p);
		p = NULL;
	    }
	}
    }
    if (!cwdf)
      perror(s);
#else
    p = zgtdir();
    if (!zchdir(s)) {
	cwdf = 0;
	perror(s);
    } else cwdf = 1;
#endif /* MAC */

    if (cwdf) {
	if (prevdir) {
	    free(prevdir);
	    prevdir = NULL;
	}
	if (p) {
	    prevdir = malloc((int)strlen(p)+1);
	    if (prevdir) strcpy(prevdir,p);
	}
    }

#ifdef COMMENT
    if (!quiet && !cmdsrc())
      printf("%s\n", zgtdir());
#endif /* COMMENT */

    return(cwdf);
}

VOID
fixcmd() {			/* Fix command parser after interruption */
    dostop();			/* Back to top level (also calls conint()). */
    bgchk();			/* Check background status */
    if (*psave) {		/* If old prompt saved, */
	cmsetp(psave);		/* restore it. */
	*psave = NUL;
    }
    success = 0;		/* Tell parser last command failed */
}

#ifndef NOSHOW
int
prtopt(lines,s) int * lines; char *s; {	/* Print an option */
    static int x = 0;			/* (used by SHOW FEATURES) */
    int y, i;				/* Does word wrap. */
    if (!s) { x = 0; return(1); }	/* Call with null pointer to */
    y = (int)strlen(s) + 1;		/* reset horizontal position. */
    i = *lines;
    x += y;
    if (
#ifdef OS2
	x > ((cmd_cols > 40) ? (cmd_cols - 1) : 79)
#else /* OS2 */
	x > ((tt_cols > 40) ? (tt_cols - 1) : 79)
#endif /* OS2 */
	) {
	printf("\n");
	if (++i > (cmd_rows - 3)) {
	    if (!askmore())
	      return(0);
	    else
	      *lines = 0;
	}
	printf(" %s",s);
	x = y;
    } else printf(" %s",s);
    return(1);
}

int
shofea() {
    int flag = 0;
    int lines = 3;
    printf("%s\n",versio);
#ifdef OS2
#ifdef NT
    if (isWin95())
      printf("Windows 95.\n");
    else 
      printf("Windows NT.\n");
    lines++;
#else /* NT */
#ifdef M_I286
    printf("OS/2 16-bit.\n");
#else
    printf("OS/2 32-bit.\n");
#endif /* M_I286 */
    lines++;
#endif /* NT */
#endif /* OS2 */
    printf("\nMajor optional features included:\n");
    lines++;
#ifdef NETCONN
    printf(" Network support (type SHOW NET for further info)\n");
    lines++;
#ifdef CK_AUTHENTICATION
    printf(" Telnet Authentication Option\n");
#ifdef CK_KERBEROS
#ifdef NT
    printf(" Kerberos(TM) IV and Kerberos V authentication\n");
#else /* NT */
    printf(" Kerberos(TM) V authentication\n");
#endif /* NT */
    lines++;
#endif /* CK_KERBEROS */
#ifdef CK_SRP
    printf(" SRP(TM) (Secure Remote Password) protocol\n");
    lines++;
#endif /* CK_SRP */
#ifdef CK_ENCRYPTION
    printf(" Telnet Encryption Option\n");
    lines++;
#endif /* CK_ENCRYPTION */
#endif /* CK_AUTHENTICATION */
#endif /* NETCONN */
#ifdef CK_RTSCTS
    printf(" Hardware flow control\n");
    lines++;
#endif /* CK_RTSCTS */

#ifdef CK_XYZ
#ifdef XYZ_INTERNAL
    printf(" Built-in XYZMODEM protocols\n");
#else
    printf(" External XYZMODEM protocol support\n");
#endif /* XYZ_INTERNAL */
    lines++;
#endif /* CK_XYZ */

#ifndef NOCSETS
    printf(" Latin-1 (West European) character-set translation\n");
    lines++;
#ifdef LATIN2
    printf(" Latin-2 (East European) character-set translation\n");
    lines++;
#endif /* LATIN2 */
#ifdef CYRILLIC
    printf(" Cyrillic (Russian, Ukrainian, etc) character-set translation\n");
    lines++;
#endif /* CYRILLIC */
#ifdef GREEK
    printf(" Greek character-set translation\n");
    lines++;
#endif /* GREEK */
#ifdef HEBREW
    printf(" Hebrew character-set translation\n");
    lines++;
#endif /* HEBREW */
#ifdef KANJI
    printf(" Kanji (Japanese) character-set translation\n");
    lines++;
#endif /* KANJI */
#ifdef CKOUNI
    if (isunicode())
      printf(" Unicode support for ISO-2022 Terminal Emulation\n");
    else
      printf(" Unicode translation for Terminal Character-Sets\n");
#endif /* CKOUNI */
#endif /* NOCSETS */

#ifdef CK_REDIR
    printf(" REDIRECT command\n");
    lines++;
#endif /* CK_REDIR */
#ifdef CK_RESEND
    printf(" RESEND command\n");
    lines++;
#endif /* CK_RESEND */

#ifdef CK_CURSES
    printf(" Fullscreen file transfer display\n");
    lines++;
#endif /* CK_CURSES */

#ifdef CK_SPEED
    printf(" Control-character unprefixing\n");
    lines++;
#endif /* CK_SPEED */

#ifdef STREAMING
    printf(" Streaming\n");
    lines++;
#endif /* STREAMING */

#ifdef OS2MOUSE
    printf(" Mouse support\n");
    lines++;
#endif /* OS2MOUSE */

#ifdef CK_REXX
    printf(" REXX script language interface\n");
    lines++;
#endif /* CK_REXX */

    printf("\nMajor optional features not included:\n");
    lines++;
#ifndef CK_CURSES
#ifndef MAC
    printf(" No fullscreen file transfer display\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* MAC */
#endif /* CK_CURSES */

#ifdef NOSERVER
    printf(" No server mode\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOSERVER */

#ifdef NODEBUG
    printf(" No debugging\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NODEBUG */

#ifdef NOTLOG
    printf(" No transaction log\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOTLOG */

#ifdef NOHELP
    printf(" No built-in help\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOHELP */

#ifndef NETCONN
    printf(" No network support\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#else
#ifndef CK_AUTHENTICATION
    printf(" No Kerberos(TM) authentication\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    printf(" No SRP(TM) (Secure Remote Password) protocol\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    printf(" No encryption\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#else
#ifndef CK_ENCRYPTION
    printf(" No encryption\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* CK_ENCRYPTION */
#endif /* CK_AUTHENTICATION */
#endif /* NETCONN */

#ifdef NOMSEND
    printf(" No MSEND command\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOMSEND */

#ifdef NODIAL
    printf(" No DIAL command\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#else
#ifdef MINIDIAL
    printf(
	 " No DIAL command for modems other than Hayes, CCITT, and Unknown\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* MINIDIAL */
#endif /* NODIAL */

#ifndef CK_RTSCTS
#ifndef MAC
    printf(" No hardware flow control\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* MAC */
#endif /* CK_RTSCTS */

#ifdef NOXMIT
    printf(" No TRANSMIT command\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOXMIT */

#ifdef NOSCRIPT
    printf(" No SCRIPT command\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOSCRIPT */

#ifdef NOSPL
    printf(" No script programming features\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOSPL */

#ifndef CK_XYZ
    printf(" No built-in XYZMODEM protocols\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* CK_XYZ */

#ifdef NOCSETS
    printf(" No character-set translation\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#else

#ifndef LATIN2
    printf(" No Latin-2 character-set translation\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* LATIN2 */

#ifdef NOGREEK
    printf(" No Greek character-set translation\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOGREEK */

#ifdef NOHEBREW
    printf(" No Hebrew character-set translation\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOHEBREW */

#ifdef NOCYRIL
    printf(" No Cyrillic character-set translation\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOCYRIL */

#ifndef KANJI
    printf(" No Kanji character-set translation\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* KANJI */
#endif /* NOCSETS */

#ifdef NOCMDL
    printf(" No command-line arguments\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOCMDL */

#ifdef NOFRILLS
    printf(" No frills\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOFRILLS */

#ifdef NOPUSH
    printf(" No escape to system\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOPUSH */

#ifdef NOJC
#ifdef UNIX
    printf(" No UNIX job control\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* UNIX */
#endif /* NOJC */

#ifdef NOSETKEY
    printf(" No SET KEY command\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* NOSETKEY */

#ifndef PARSENSE
    printf(" No automatic parity detection\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* PARSENSE */

#ifndef CK_SPEED
    printf(" No control-character unprefixing\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* CK_SPEED */

#ifndef STREAMING
    printf(" No streaming\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* STREAMING */

#ifndef CK_REDIR
    printf(" No REDIRECT or PIPE command\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* CK_REDIR */

#ifndef CK_RESEND
    printf(" No RESEND command\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* CK_RESEND */

#ifdef OS2
#ifdef __32BIT__
#ifndef OS2MOUSE
    printf(" No Mouse support\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* __32BIT__ */
#endif /* OS2 */
#endif /* OS2MOUSE */

#ifdef OS2
#ifndef NT
#ifndef CK_REXX
    printf(" No REXX script language interface\n");
    if (++lines > cmd_rows - 3) { if (!askmore()) return(1); else lines = 0; }
    flag = 1;
#endif /* CK_REXX */
#endif /* NT */
#endif /* OS2 */

    if (flag == 0) {
	printf(" None\n");
	if (++lines > cmd_rows - 3)
	  { if (!askmore()) return(1); else lines = 0; }
    }

#ifdef CK_UTSNAME
    printf("\nHost info:\n");
    if (++lines > cmd_rows - 3)
      { if (!askmore()) return(1); else lines = 0; }
    printf(" Machine:    %s\n",unm_mch[0] ? unm_mch : "(unknown)");
    if (++lines > cmd_rows - 3)
      { if (!askmore()) return(1); else lines = 0; }
    printf(" Model:      %s\n",unm_mod[0] ? unm_mod : "(unknown)");
    if (++lines > cmd_rows - 3)
      { if (!askmore()) return(1); else lines = 0; }
    printf(" OS:         %s\n",unm_nam[0] ? unm_nam : "(unknown)");
    if (++lines > cmd_rows - 3)
      { if (!askmore()) return(1); else lines = 0; }
    printf(" OS Release: %s\n",unm_rel[0] ? unm_rel : "(unknown)");
    if (++lines > cmd_rows - 3)
      { if (!askmore()) return(1); else lines = 0; }
    printf(" OS Version: %s\n",unm_ver[0] ? unm_ver : "(unknown)");
    if (++lines > cmd_rows - 3)
      { if (!askmore()) return(1); else lines = 0; }
#endif /* CK_UTSNAME */

/*
  Print compile-time (-D) options, as well as C preprocessor
  predefined symbols that might affect us...
*/
#ifdef __DATE__				/* GNU and other ANSI */
#ifdef __TIME__
    printf("\nCompiled %s %s, options:\n", __DATE__, __TIME__);
#else
    printf("\nCompiled %s, options:\n", __DATE__);
#endif /* __TIME__ */
#else /* !__DATE__ */
    printf("\nCompiler options:\n");
#endif /* __DATE__ */
    lines++;

#ifdef MAC
#ifdef MPW
    if (!prtopt(&lines,"MPW")) return(0);
#else
#ifdef THINK_C
    if (!prtopt(&lines,"THINK_C")) return(0);
#endif /* THINK_C */
#endif /* MPW */
#endif /* MAC */

#ifdef __386__
    if (!prtopt(&lines,"__386__")) return(0);
#endif /* __386__ */

#ifdef DEBUG
#ifdef IFDEBUG
    if (!prtopt(&lines,"IFDEBUG")) return(0);
#else
    if (!prtopt(&lines,"DEBUG")) return(0);
#endif /* IFDEBUG */
#endif /* DEBUG */
#ifdef TLOG
    if (!prtopt(&lines,"TLOG")) return(0);
#endif /* TLOG */
#ifdef BIGBUFOK
    if (!prtopt(&lines,"BIGBUFOK")) return(0);
#endif /* BIGBUFOK */
#ifdef INBUFSIZE
    sprintf(line,"INBUFSIZE=%d",INBUFSIZE);
    if (!prtopt(&lines,line)) return(0);
#endif /* INBUFSIZE */
#ifdef OBUFSIZE
    sprintf(line,"OBUFSIZE=%d",OBUFSIZE);
    if (!prtopt(&lines,line)) return(0);
#endif /* OBUFSIZE */
#ifdef XFRCAN
    if (!prtopt(&lines,"XFRCAN")) return(0);
#endif /* XFRCAN */
#ifdef PIPESEND
    if (!prtopt(&lines,"PIPESEND")) return(0);
#endif /* PIPESEND */
#ifdef CK_SPEED
    if (!prtopt(&lines,"CK_SPEED")) return(0);
#endif /* CK_SPEED */
#ifdef CK_APC
    if (!prtopt(&lines,"CK_APC")) return(0);
#endif /* CK_APC */
#ifdef CK_AUTODL
    if (!prtopt(&lines,"CK_AUTODL")) return(0);
#endif /* CK_AUTODL */
#ifdef CK_MKDIR
    if (!prtopt(&lines,"CK_MKDIR")) return(0);
#endif /* CK_MKDIR */
#ifdef NOMKDIR
    if (!prtopt(&lines,"NOMKDIR")) return(0);
#endif /* NOMKDIR */
#ifdef CK_LABELED
    if (!prtopt(&lines,"CK_LABELED")) return(0);
#endif /* CK_LABELED */
#ifdef NODIAL
    if (!prtopt(&lines,"NODIAL")) return(0);
#endif /* NODIAL */
#ifdef MINIDIAL
    if (!prtopt(&lines,"MINIDIAL")) return(0);
#endif /* MINIDIAL */
#ifdef WHATAMI
    if (!prtopt(&lines,"WHATAMI")) return(0);
#endif /* WHATAMI */
#ifdef DYNAMIC
    if (!prtopt(&lines,"DYNAMIC")) return(0);
#endif /* IFDEBUG */
#ifndef NOSPL
    sprintf(line,"CMDDEP=%d",CMDDEP);
    if (!prtopt(&lines,line)) return(0);
#endif /* NOSPL */

    sprintf(line,"CKMAXPATH=%d",CKMAXPATH);
    if (!prtopt(&lines,line)) return(0);

#ifdef MAXGETPATH
    sprintf(line,"MAXGETPATH=%d",MAXGETPATH);
    if (!prtopt(&lines,line)) return(0);
#endif /* MAXGETPATH */

#ifdef CMDBL
    sprintf(line,"CMDBL=%d",CMDBL);
    if (!prtopt(&lines,line)) return(0);
#endif /* CMDBL */

#ifdef VNAML
    sprintf(line,"VNAML=%d",VNAML);
    if (!prtopt(&lines,line)) return(0);
#endif /* VNAML */

#ifdef ARRAYREFLEN
    sprintf(line,"ARRAYREFLEN=%d",ARRAYREFLEN);
    if (!prtopt(&lines,line)) return(0);
#endif /* ARRAYREFLEN */

#ifdef FORDEPTH
    sprintf(line,"FORDEPTH=%d",FORDEPTH);
    if (!prtopt(&lines,line)) return(0);
#endif /* FORDEPTH */

#ifdef MAXTAKE
    sprintf(line,"MAXTAKE=%d",MAXTAKE);
    if (!prtopt(&lines,line)) return(0);
#endif /* MAXTAKE */

#ifdef MACLEVEL
    sprintf(line,"MACLEVEL=%d",MACLEVEL);
    if (!prtopt(&lines,line)) return(0);
#endif /* MACLEVEL */

#ifdef MAC_MAX
    sprintf(line,"MAC_MAX=%d",MAC_MAX);
    if (!prtopt(&lines,line)) return(0);
#endif /* MAC_MAX */

#ifdef MINPUTMAX
    sprintf(line,"MINPUTMAX=%d",MINPUTMAX);
    if (!prtopt(&lines,line)) return(0);
#endif /* MINPUTMAX */

#ifdef MAXWLD
    sprintf(line,"MAXWLD=%d",MAXWLD);
    if (!prtopt(&lines,line)) return(0);
#else
#ifdef OS2
    if (!prtopt(&lines,"MAXWLD=unlimited")) return(0);
#endif /* OS2 */
#endif /* MAXWLD */

#ifdef MSENDMAX
    sprintf(line,"MSENDMAX=%d",MSENDMAX);
    if (!prtopt(&lines,line)) return(0);
#endif /* MSENDMAX */

#ifdef MAXDDIR
    sprintf(line,"MAXDDIR=%d",MAXDDIR);
    if (!prtopt(&lines,line)) return(0);
#endif /* MAXDDIR */

#ifdef MAXDNUMS
    sprintf(line,"MAXDNUMS=%d",MAXDNUMS);
    if (!prtopt(&lines,line)) return(0);
#endif /* MAXDNUMS */

#ifdef UNIX
    if (!prtopt(&lines,"UNIX")) return(0);
#endif /* UNIX */
#ifdef VMS
    if (!prtopt(&lines,"VMS")) return(0);
#ifdef __VMS_VER
    sprintf(line,"__VMS_VER=%d",__VMS_VER);
    if (!prtopt(&lines,line)) return(0);
#endif /* __VMS_VER */
#ifdef VMSV70
    if (!prtopt(&lines,"VMSV70")) return(0);
#endif /* VMSV70 */
#endif /* VMS */
#ifdef OLD_VMS
    if (!prtopt(&lines,"OLD_VMS")) return(0);
#endif /* OLD_VMS */
#ifdef vms
    if (!prtopt(&lines,"vms")) return(0);
#endif /* vms */
#ifdef VMSSHARE
    if (!prtopt(&lines,"VMSSHARE")) return(0);
#endif /* VMSSHARE */
#ifdef NOVMSSHARE
    if (!prtopt(&lines,"NOVMSSHARE")) return(0);
#endif /* NOVMSSHARE */
#ifdef datageneral
    if (!prtopt(&lines,"datageneral")) return(0);
#endif /* datageneral */
#ifdef apollo
    if (!prtopt(&lines,"apollo")) return(0);
#endif /* apollo */
#ifdef aegis
    if (!prtopt(&lines,"aegis")) return(0);
#endif /* aegis */
#ifdef A986
    if (!prtopt(&lines,"A986")) return(0);
#endif /* A986 */
#ifdef AMIGA
    if (!prtopt(&lines,"AMIGA")) return(0);
#endif /* AMIGA */
#ifdef CONVEX9
    if (!prtopt(&lines,"CONVEX9")) return(0);
#endif /* CONVEX9 */
#ifdef CONVEX10
    if (!prtopt(&lines,"CONVEX10")) return(0);
#endif /* CONVEX9 */
#ifdef MAC
    if (!prtopt(&lines,"MAC")) return(0);
#endif /* MAC */
#ifdef AUX
    if (!prtopt(&lines,"AUX")) return(0);
#endif /* AUX */
#ifdef OS2
    if (!prtopt(&lines,"OS2")) return(0);
#ifdef NT
    if (!prtopt(&lines,"NT")) return(0);
#endif /* NT */
#endif /* OS2 */
#ifdef OSK
    if (!prtopt(&lines,"OS9")) return(0);
#endif /* OSK */
#ifdef MSDOS
    if (!prtopt(&lines,"MSDOS")) return(0);
#endif /* MSDOS */
#ifdef DIRENT
    if (!prtopt(&lines,"DIRENT")) return(0);
#endif /* DIRENT */
#ifdef SDIRENT
    if (!prtopt(&lines,"SDIRENT")) return(0);
#endif /* SDIRENT */
#ifdef NDIR
    if (!prtopt(&lines,"NDIR")) return(0);
#endif /* NDIR */
#ifdef XNDIR
    if (!prtopt(&lines,"XNDIR")) return(0);
#endif /* XNDIR */
#ifdef MATCHDOT
    if (!prtopt(&lines,"MATCHDOT")) return(0);
#endif /* MATCHDOT */
#ifdef SAVEDUID
    if (!prtopt(&lines,"SAVEDUID")) return(0);
#endif /* SAVEDUID */
#ifdef RENAME
    if (!prtopt(&lines,"RENAME")) return(0);
#endif /* RENAME */
#ifdef CK_TMPDIR
    if (!prtopt(&lines,"CK_TMPDIR")) return(0);
#endif /* CK_TMPDIR */
#ifdef CK_PERMS
    if (!prtopt(&lines,"CK_PERMS")) return(0);
#endif /* CK_PERMS */
#ifdef NOCCTRAP
    if (!prtopt(&lines,"NOCCTRAP")) return(0);
#endif /* NOCCTRAP */
#ifdef NOCOTFMC
    if (!prtopt(&lines,"NOCOTFMC")) return(0);
#endif /* NOCOTFMC */
#ifdef CK_NEED_SIG
    if (!prtopt(&lines,"CK_NEED_SIG")) return(0);
#endif /* CK_NEED_SIG */
#ifdef CK_TTYFD
    if (!prtopt(&lines,"CK_TTYFD")) return(0);
#endif /* CK_TTYFD */
#ifdef NETCONN
    if (!prtopt(&lines,"NETCONN")) return(0);
#endif /* NETCONN */
#ifdef TCPSOCKET
    if (!prtopt(&lines,"TCPSOCKET")) return(0);
#ifdef NOTCPOPTS
    if (!prtopt(&lines,"NOTCPOPTS")) return(0);
#endif /* NOTCPOPTS */
#ifdef NOLISTEN
    if (!prtopt(&lines,"NOLISTEN")) return(0);
#endif /* NOLISTEN */
#ifdef SOL_SOCKET
    if (!prtopt(&lines,"SOL_SOCKET")) return(0);
#endif /* SOL_SOCKET */
#ifdef TCP_NODELAY
    if (!prtopt(&lines,"TDP_NODELAY")) return(0);
#endif /* TCP_NODELAY */
#ifdef HADDRLIST
    if (!prtopt(&lines,"HADDRLIST")) return(0);
#endif /* HADDRLIST */
#ifdef CK_SOCKS
    if (!prtopt(&lines,"CK_SOCKS")) return(0);
#endif /* CK_SOCKS */
#ifdef RLOGCODE
    if (!prtopt(&lines,"RLOGCODE")) return(0);
#endif /* RLOGCODE */
#ifdef NETCMD
    if (!prtopt(&lines,"NETCMD")) return(0);
#endif /* NETCMD */
#ifdef CK_ENVIRONMENT
    if (!prtopt(&lines,"CK_ENVIRONMENT")) return(0);
#endif /* CK_ENVIRONMENT */
#endif /* TCPSOCKET */
#ifdef CONGSPD
    if (!prtopt(&lines,"CONGSPD")) return(0);
#endif /* CONGSPDCK_SOCKS */
#ifdef SUNX25
    if (!prtopt(&lines,"SUNX25")) return(0);
#endif /* SUNX25 */
#ifdef IBMX25
    if (!prtopt(&lines,"IBMX25")) return;
#endif /* IBMX25 */
#ifdef HPX25
    if (!prtopt(&lines,"HPX25")) return;
#endif /* HPX25 */
#ifdef DECNET
    if (!prtopt(&lines,"DECNET")) return(0);
#endif /* DECNET */
#ifdef SUPERLAT
   if (!prtopt(&lines,"SUPERLAT")) return(0);
#endif /* SUPERLAT */
#ifdef NPIPE
    if (!prtopt(&lines,"NPIPE")) return(0);
#endif /* NPIPE */
#ifdef CK_NETBIOS
    if (!prtopt(&lines,"CK_NETBIOS")) return(0);
#endif /* CK_NETBIOS */
#ifdef ATT7300
    if (!prtopt(&lines,"ATT7300")) return(0);
#endif /* ATT7300 */
#ifdef ATT6300
    if (!prtopt(&lines,"ATT6300")) return(0);
#endif /* ATT6300 */
#ifdef HDBUUCP
    if (!prtopt(&lines,"HDBUUCP")) return(0);
#endif /* HDBUUCP */
#ifdef USETTYLOCK
    if (!prtopt(&lines,"USETTYLOCK")) return(0);
#endif /* USETTYLOCK */
#ifdef NOUUCP
    if (!prtopt(&lines,"NOUUCP")) return(0);
#endif /* NOUUCP */
#ifdef LONGFN
    if (!prtopt(&lines,"LONGFN")) return(0);
#endif /* LONGFN */
#ifdef RDCHK
    if (!prtopt(&lines,"RDCHK")) return(0);
#endif /* RDCHK */
#ifdef SELECT
    if (!prtopt(&lines,"SELECT")) return(0);
#endif /* SELECT */
#ifdef USLEEP
    if (!prtopt(&lines,"USLEEP")) return(0);
#endif /* USLEEP */
#ifdef NAP
    if (!prtopt(&lines,"NAP")) return(0);
#endif /* NAP */
#ifdef NAPHACK
    if (!prtopt(&lines,"NAPHACK")) return(0);
#endif /* NAPHACK */
#ifdef CK_POLL
    if (!prtopt(&lines,"CK_POLL")) return(0);
#endif /* CK_POLL */
#ifdef NOIEXTEN
    if (!prtopt(&lines,"NOIEXTEN")) return(0);
#endif /* NOIEXTEN */
#ifdef EXCELAN
    if (!prtopt(&lines,"EXCELAN")) return(0);
#endif /* EXCELAN */
#ifdef INTERLAN
    if (!prtopt(&lines,"INTERLAN")) return(0);
#endif /* INTERLAN */
#ifdef NOFILEH
    if (!prtopt(&lines,"NOFILEH")) return(0);
#endif /* NOFILEH */
#ifdef NOSYSIOCTLH
    if (!prtopt(&lines,"NOSYSIOCTLH")) return(0);
#endif /* NOSYSIOCTLH */
#ifdef DCLPOPEN
    if (!prtopt(&lines,"DCLPOPEN")) return(0);
#endif /* DCLPOPEN */
#ifdef NOSETBUF
    if (!prtopt(&lines,"NOSETBUF")) return(0);
#endif /* NOSETBUF */
#ifdef NOFDZERO
    if (!prtopt(&lines,"NOFDZERO")) return(0);
#endif /* NOFDZERO */
#ifdef NOPOPEN
    if (!prtopt(&lines,"NOPOPEN")) return(0);
#endif /* NOPOPEN */
#ifdef NOPARTIAL
    if (!prtopt(&lines,"NOPARTIAL")) return(0);
#endif /* NOPARTIAL */
#ifdef NOKVERBS
    if (!prtopt(&lines,"NOKVERBS")) return(0);
#endif /* NOKVERBS */
#ifdef NOSETREU
    if (!prtopt(&lines,"NOSETREU")) return(0);
#endif /* NOSETREU */
#ifdef LCKDIR
    if (!prtopt(&lines,"LCKDIR")) return(0);
#endif /* LCKDIR */
#ifdef ACUCNTRL
    if (!prtopt(&lines,"ACUCNTRL")) return(0);
#endif /* ACUCNTRL */
#ifdef BSD4
    if (!prtopt(&lines,"BSD4")) return(0);
#endif /* BSD4 */
#ifdef BSD44
    if (!prtopt(&lines,"BSD44")) return(0);
#endif /* BSD44 */
#ifdef BSD41
    if (!prtopt(&lines,"BSD41")) return(0);
#endif /* BSD41 */
#ifdef BSD43
    if (!prtopt(&lines,"BSD43")) return(0);
#endif /* BSD43 */
#ifdef BSD29
    if (!prtopt(&lines,"BSD29")) return(0);
#endif /* BSD29 */
#ifdef BSDI
    if (!prtopt(&lines,"BSDI")) return(0);
#endif /* BSDI */
#ifdef __bsdi__
    if (!prtopt(&lines,"__bsdi__")) return(0);
#endif /* __bsdi__ */
#ifdef __NetBSD__
    if (!prtopt(&lines,"__NetBSD__")) return(0);
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
    if (!prtopt(&lines,"__FreeBSD__")) return(0);
#endif /* __FreeBSD__ */
#ifdef __linux__
    if (!prtopt(&lines,"__linux__")) return(0);
#endif /* __linux__ */
#ifdef LINUX_HI_SPD
    if (!prtopt(&lines,"LINUX_HI_SPD")) return(0);
#endif /* LINUX_HI_SPD */
#ifdef LYNXOS
    if (!prtopt(&lines,"LYNXOS")) return(0);
#endif /* LYNXOS */
#ifdef V7
    if (!prtopt(&lines,"V7")) return(0);
#endif /* V7 */
#ifdef AIX370
    if (!prtopt(&lines,"AIX370")) return(0);
#endif /* AIX370 */
#ifdef RTAIX
    if (!prtopt(&lines,"RTAIX")) return(0);
#endif /* RTAIX */
#ifdef HPUX
    if (!prtopt(&lines,"HPUX")) return(0);
#endif /* HPUX */
#ifdef HPUXPRE65
    if (!prtopt(&lines,"HPUXPRE65")) return(0);
#endif /* HPUXPRE65 */
#ifdef DGUX
    if (!prtopt(&lines,"DGUX")) return(0);
#endif /* DGUX */
#ifdef DGUX430
    if (!prtopt(&lines,"DGUX430")) return(0);
#endif /* DGUX430 */
#ifdef DGUX540
    if (!prtopt(&lines,"DGUX540")) return(0);
#endif /* DGUX540 */
#ifdef sony_news
    if (!prtopt(&lines,"sony_news")) return(0);
#endif /* sony_news */
#ifdef CIE
    if (!prtopt(&lines,"CIE")) return(0);
#endif /* CIE */
#ifdef XENIX
    if (!prtopt(&lines,"XENIX")) return(0);
#endif /* XENIX */
#ifdef SCO_XENIX
    if (!prtopt(&lines,"SCO_XENIX")) return(0);
#endif /* SCO_XENIX */
#ifdef ISIII
    if (!prtopt(&lines,"ISIII")) return(0);
#endif /* ISIII */
#ifdef I386IX
    if (!prtopt(&lines,"I386IX")) return(0);
#endif /* I386IX */
#ifdef RTU
    if (!prtopt(&lines,"RTU")) return(0);
#endif /* RTU */
#ifdef PROVX1
    if (!prtopt(&lines,"PROVX1")) return(0);
#endif /* PROVX1 */
#ifdef PYRAMID
    if (!prtopt(&lines,"PYRAMID")) return(0);
#endif /* PYRAMID */
#ifdef TOWER1
    if (!prtopt(&lines,"TOWER1")) return(0);
#endif /* TOWER1 */
#ifdef UTEK
    if (!prtopt(&lines,"UTEK")) return(0);
#endif /* UTEK */
#ifdef ZILOG
    if (!prtopt(&lines,"ZILOG")) return(0);
#endif /* ZILOG */
#ifdef TRS16
    if (!prtopt(&lines,"TRS16")) return(0);
#endif /* TRS16 */
#ifdef MINIX
    if (!prtopt(&lines,"MINIX")) return(0);
#endif /* MINIX */
#ifdef C70
    if (!prtopt(&lines,"C70")) return(0);
#endif /* C70 */
#ifdef AIXPS2
    if (!prtopt(&lines,"AIXPS2")) return(0);
#endif /* AIXPS2 */
#ifdef AIXRS
    if (!prtopt(&lines,"AIXRS")) return(0);
#endif /* AIXRS */
#ifdef UTSV
    if (!prtopt(&lines,"UTSV")) return(0);
#endif /* UTSV */
#ifdef ATTSV
    if (!prtopt(&lines,"ATTSV")) return(0);
#endif /* ATTSV */
#ifdef SVR3
    if (!prtopt(&lines,"SVR3")) return(0);
#endif /* SVR3 */
#ifdef SVR4
    if (!prtopt(&lines,"SVR4")) return(0);
#endif /* SVR4 */
#ifdef DELL_SVR4
    if (!prtopt(&lines,"DELL_SVR4")) return(0);
#endif /* DELL_SVR4 */
#ifdef ICL_SVR4
    if (!prtopt(&lines,"ICL_SVR4")) return(0);
#endif /* ICL_SVR4 */
#ifdef OSF
    if (!prtopt(&lines,"OSF")) return(0);
#endif /* OSF */
#ifdef OSF1
    if (!prtopt(&lines,"OSF1")) return(0);
#endif /* OSF1 */
#ifdef __OSF
    if (!prtopt(&lines,"__OSF")) return(0);
#endif /* __OSF */
#ifdef __OSF__
    if (!prtopt(&lines,"__OSF__")) return(0);
#endif /* __OSF__ */
#ifdef __osf__
    if (!prtopt(&lines,"__osf__")) return(0);
#endif /* __osf__ */
#ifdef __OSF1
    if (!prtopt(&lines,"__OSF1")) return(0);
#endif /* __OSF1 */
#ifdef __OSF1__
    if (!prtopt(&lines,"__OSF1__")) return(0);
#endif /* __OSF1__ */
#ifdef PTX
    if (!prtopt(&lines,"PTX")) return(0);
#endif /* PTX */
#ifdef POSIX
    if (!prtopt(&lines,"POSIX")) return(0);
#endif /* POSIX */
#ifdef _POSIX_SOURCE
    if (!prtopt(&lines,"_POSIX_SOURCE")) return(0);
#endif /* _POSIX_SOURCE */
#ifdef _XOPEN_SOURCE
    if (!prtopt(&lines,"_XOPEN_SOURCE")) return(0);
#endif
#ifdef _ALL_SOURCE
    if (!prtopt(&lines,"_ALL_SOURCE")) return(0);
#endif
#ifdef _SVID3
    if (!prtopt(&lines,"_SVID3")) return(0);
#endif /* _SVID3 */
#ifdef Plan9
    if (!prtopt(&lines,"Plan9")) return(0);
#endif /* Plan9 */
#ifdef SOLARIS
    if (!prtopt(&lines,"SOLARIS")) return(0);
#endif /* SOLARIS */
#ifdef SUNOS4
    if (!prtopt(&lines,"SUNOS4")) return(0);
#endif /* SUNOS4 */
#ifdef SUN4S5
    if (!prtopt(&lines,"SUN4S5")) return(0);
#endif /* SUN4S5 */
#ifdef IRIX
    if (!prtopt(&lines,"IRIX")) return(0);
#endif /* IRIX */
#ifdef ENCORE
    if (!prtopt(&lines,"ENCORE")) return(0);
#endif /* ENCORE */
#ifdef ultrix
    if (!prtopt(&lines,"ultrix")) return(0);
#endif
#ifdef sxaE50
    if (!prtopt(&lines,"sxaE50")) return(0);
#endif
#ifdef mips
    if (!prtopt(&lines,"mips")) return(0);
#endif
#ifdef MIPS
    if (!prtopt(&lines,"MIPS")) return(0);
#endif
#ifdef vax
    if (!prtopt(&lines,"vax")) return(0);
#endif
#ifdef VAX
    if (!prtopt(&lines,"VAX")) return(0);
#endif
#ifdef alpha
    if (!prtopt(&lines,"alpha")) return(0);
#endif
#ifdef ALPHA
    if (!prtopt(&lines,"ALPHA")) return(0);
#endif
#ifdef __ALPHA
    if (!prtopt(&lines,"__ALPHA")) return(0);
#endif
#ifdef __alpha
    if (!prtopt(&lines,"__alpha")) return(0);
#endif
#ifdef __AXP
    if (!prtopt(&lines,"__AXP")) return(0);
#endif
#ifdef AXP
    if (!prtopt(&lines,"AXP")) return(0);
#endif
#ifdef axp
    if (!prtopt(&lines,"axp")) return(0);
#endif
#ifdef __ALPHA__
    if (!prtopt(&lines,"__ALPHA__")) return(0);
#endif
#ifdef __alpha__
    if (!prtopt(&lines,"__alpha__")) return(0);
#endif
#ifdef sun
    if (!prtopt(&lines,"sun")) return(0);
#endif
#ifdef sun3
    if (!prtopt(&lines,"sun3")) return(0);
#endif
#ifdef sun386
    if (!prtopt(&lines,"sun386")) return(0);
#endif
#ifdef _SUN
    if (!prtopt(&lines,"_SUN")) return(0);
#endif
#ifdef sun4
    if (!prtopt(&lines,"sun4")) return(0);
#endif
#ifdef sparc
    if (!prtopt(&lines,"sparc")) return(0);
#endif
#ifdef _CRAY
    if (!prtopt(&lines,"_CRAY")) return(0);
#endif /* _CRAY */
#ifdef NEXT33
    if (!prtopt(&lines,"NEXT33")) return(0);
#endif
#ifdef NEXT
    if (!prtopt(&lines,"NEXT")) return(0);
#endif
#ifdef NeXT
    if (!prtopt(&lines,"NeXT")) return(0);
#endif
#ifdef MACH
    if (!prtopt(&lines,"MACH")) return(0);
#endif
#ifdef sgi
    if (!prtopt(&lines,"sgi")) return(0);
#endif
#ifdef M_SYS5
    if (!prtopt(&lines,"M_SYS5")) return(0);
#endif
#ifdef __SYSTEM_FIVE
    if (!prtopt(&lines,"__SYSTEM_FIVE")) return(0);
#endif
#ifdef sysV
    if (!prtopt(&lines,"sysV")) return(0);
#endif
#ifdef M_XENIX				/* SCO Xenix V and UNIX/386 */
    if (!prtopt(&lines,"M_XENIX")) return(0);
#endif 
#ifdef M_UNIX				/* SCO UNIX */
    if (!prtopt(&lines,"M_UNIX")) return(0);
#endif
#ifdef _M_UNIX				/* SCO UNIX 3.2v4 = ODT 2.0 */
    if (!prtopt(&lines,"_M_UNIX")) return(0);
#endif
#ifdef CK_SCOV5
    if (!prtopt(&lines,"CK_SCOV5")) return(0);
#endif
#ifdef SCO_OSR504
    if (!prtopt(&lines,"SCO_OSR504")) return(0);
#endif
#ifdef M_I586
    if (!prtopt(&lines,"M_I586")) return(0);
#endif
#ifdef _M_I586
    if (!prtopt(&lines,"_M_I586")) return(0);
#endif
#ifdef i586
    if (!prtopt(&lines,"i586")) return(0);
#endif
#ifdef M_I486
    if (!prtopt(&lines,"M_I486")) return(0);
#endif
#ifdef _M_I486
    if (!prtopt(&lines,"_M_I486")) return(0);
#endif
#ifdef i486
    if (!prtopt(&lines,"i486")) return(0);
#endif
#ifdef M_I386
    if (!prtopt(&lines,"M_I386")) return(0);
#endif
#ifdef _M_I386
    if (!prtopt(&lines,"_M_I386")) return(0);
#endif
#ifdef i386
    if (!prtopt(&lines,"i386")) return(0);
#endif
#ifdef i286
    if (!prtopt(&lines,"i286")) return(0);
#endif
#ifdef M_I286
    if (!prtopt(&lines,"M_I286")) return(0);
#endif
#ifdef mc68000
    if (!prtopt(&lines,"mc68000")) return(0);
#endif
#ifdef mc68010
    if (!prtopt(&lines,"mc68010")) return(0);
#endif
#ifdef mc68020
    if (!prtopt(&lines,"mc68020")) return(0);
#endif
#ifdef mc68030
    if (!prtopt(&lines,"mc68030")) return(0);
#endif
#ifdef mc68040
    if (!prtopt(&lines,"mc68040")) return(0);
#endif
#ifdef M_68000
    if (!prtopt(&lines,"M_68000")) return(0);
#endif
#ifdef M_68010
    if (!prtopt(&lines,"M_68010")) return(0);
#endif
#ifdef M_68020
    if (!prtopt(&lines,"M_68020")) return(0);
#endif
#ifdef M_68030
    if (!prtopt(&lines,"M_68030")) return(0);
#endif
#ifdef M_68040
    if (!prtopt(&lines,"M_68040")) return(0);
#endif
#ifdef m68k
    if (!prtopt(&lines,"m68k")) return(0);
#endif
#ifdef m88k
    if (!prtopt(&lines,"m88k")) return(0);
#endif
#ifdef pdp11
    if (!prtopt(&lines,"pdp11")) return(0);
#endif
#ifdef iAPX
    if (!prtopt(&lines,"iAPX")) return(0);
#endif
#ifdef __hp9000s800
    if (!prtopt(&lines,"__hp9000s800")) return(0);
#endif
#ifdef __hp9000s700
    if (!prtopt(&lines,"__hp9000s700")) return(0);
#endif
#ifdef __hp9000s500
    if (!prtopt(&lines,"__hp9000s500")) return(0);
#endif
#ifdef __hp9000s300
    if (!prtopt(&lines,"__hp9000s300")) return(0);
#endif
#ifdef __hp9000s200
    if (!prtopt(&lines,"__hp9000s200")) return(0);
#endif
#ifdef AIX
    if (!prtopt(&lines,"AIX")) return(0);
#endif
#ifdef _AIXFS
    if (!prtopt(&lines,"_AIXFS")) return(0);
#endif
#ifdef u370
    if (!prtopt(&lines,"u370")) return(0);
#endif
#ifdef u3b
    if (!prtopt(&lines,"u3b")) return(0);
#endif
#ifdef u3b2
    if (!prtopt(&lines,"u3b2")) return(0);
#endif
#ifdef multimax
    if (!prtopt(&lines,"multimax")) return(0);
#endif
#ifdef balance
    if (!prtopt(&lines,"balance")) return(0);
#endif
#ifdef ibmrt
    if (!prtopt(&lines,"ibmrt")) return(0);
#endif
#ifdef _IBMRT
    if (!prtopt(&lines,"_IBMRT")) return(0);
#endif
#ifdef ibmrs6000
    if (!prtopt(&lines,"ibmrs6000")) return(0);
#endif
#ifdef _AIX
    if (!prtopt(&lines,"_AIX")) return(0);
#endif /* _AIX */
#ifdef _IBMR2
    if (!prtopt(&lines,"_IBMR2")) return(0);
#endif
#ifdef UNIXWARE
    if (!prtopt(&lines,"UNIXWARE")) return(0);
#endif
#ifdef QNX
    if (!prtopt(&lines,"QNX")) return(0);
#ifdef __QNX__
    if (!prtopt(&lines,"__QNX__")) return(0);
#ifdef __16BIT__
    if (!prtopt(&lines,"__16BIT__")) return(0);
#endif
#ifdef CK_QNX16
    if (!prtopt(&lines,"CK_QNX16")) return(0);
#endif
#ifdef __32BIT__
    if (!prtopt(&lines,"__32BIT__")) return(0);
#endif
#ifdef CK_QNX32
    if (!prtopt(&lines,"CK_QNX32")) return(0);
#endif
#endif /* __QNX__ */
#endif /* QNX */

#ifdef __STRICT_BSD__
    if (!prtopt(&lines,"__STRICT_BSD__")) return(0);
#endif
#ifdef __STRICT_ANSI__
    if (!prtopt(&lines,"__STRICT_ANSI__")) return(0);
#endif
#ifdef _ANSI_C_SOURCE
    if (!prtopt(&lines,"_ANSI_C_SOURCE")) return(0);
#endif
#ifdef __STDC__
    if (!prtopt(&lines,"__STDC__")) return(0);
#endif
#ifdef __DECC
    if (!prtopt(&lines,"__DECC")) return(0);
#ifdef __DECC_VER
    sprintf(line,"__DECC_VER=%d",__DECC_VER);
    if (!prtopt(&lines,line)) return(0);
#endif /* __DECC_VER */
#endif /* __DECC */
#ifdef __CRTL_VER
    sprintf(line,"__CRTL_VER=%d",__CRTL_VER);
    if (!prtopt(&lines,line)) return(0);
#endif /* __CRTL_VER */
#ifdef __GNUC__				/* gcc in ansi mode */
    if (!prtopt(&lines,"__GNUC__")) return(0);
#endif
#ifdef GNUC				/* gcc in traditional mode */
    if (!prtopt(&lines,"GNUC")) return(0);
#endif
#ifdef __WATCOMC__
    if (!prtopt(&lines,"__WATCOMC__")) return(0);
#endif
#ifdef CK_ANSIC
    if (!prtopt(&lines,"CK_ANSIC")) return(0);
#endif
#ifdef CK_ANSILIBS
    if (!prtopt(&lines,"CK_ANSILIBS")) return(0);
#endif
#ifdef _SC_JOB_CONTROL
    if (!prtopt(&lines,"_SC_JOB_CONTROL")) return(0);
#endif
#ifdef _POSIX_JOB_CONTROL
    if (!prtopt(&lines,"_POSIX_JOB_CONTROL")) return(0);
#endif
#ifdef CK_POSIX_SIG
    if (!prtopt(&lines,"CK_POSIX_SIG")) return(0);
#endif
#ifdef SVR3JC
    if (!prtopt(&lines,"SVR3JC")) return(0);
#endif
#ifdef _386BSD
    if (!prtopt(&lines,"_386BSD")) return(0);
#endif
#ifdef _BSD
    if (!prtopt(&lines,"_BSD")) return(0);
#endif
#ifdef USE_MEMCPY
    if (!prtopt(&lines,"USE_MEMCPY")) return(0);
#endif /* USE_MEMCPY */
#ifdef TERMIOX
    if (!prtopt(&lines,"TERMIOX")) return(0);
#endif /* TERMIOX */
#ifdef STERMIOX
    if (!prtopt(&lines,"STERMIOX")) return(0);
#endif /* STERMIOX */
#ifdef CK_CURSES
    if (!prtopt(&lines,"CK_CURSES")) return(0);
#endif /* CK_CURSES */
#ifdef CK_NEWTERM
    if (!prtopt(&lines,"CK_NEWTERM")) return(0);
#endif /* CK_NEWTERM */
#ifdef CK_WREFRESH
    if (!prtopt(&lines,"CK_WREFRESH")) return(0);
#endif /* CK_WREFRESH */
#ifdef CK_PCT_BAR
    if (!prtopt(&lines,"CK_PCT_BAR")) return(0);
#endif /* CK_PCT_BAR */
#ifdef CK_DTRCD
    if (!prtopt(&lines,"CK_DTRCD")) return(0);
#endif /* CK_DTRCD */
#ifdef CK_DTRCTS
    if (!prtopt(&lines,"CK_DTRCTS")) return(0);
#endif /* CK_DTRCTS */
#ifdef CK_RTSCTS
    if (!prtopt(&lines,"CK_RTSCTS")) return(0);
#endif /* CK_RTSCTS */
#ifdef POSIX_CRTSCTS
    if (!prtopt(&lines,"POSIX_CRTSCTS")) return(0);
#endif /* POSIX_CRTSCTS */
#ifdef CK_DSYSINI
    if (!prtopt(&lines,"CK_DSYSINI")) return(0);
#endif /* CK_DSYSINI */
#ifdef CK_SYSINI
    if (!prtopt(&lines,"CK_SYSINI")) return(0);
#endif /* CK_SYSINI */
#ifdef CK_INI_A
    if (!prtopt(&lines,"CK_INI_A")) return(0);
#endif /* CK_INI_A */
#ifdef CK_INI_B
    if (!prtopt(&lines,"CK_INI_B")) return(0);
#endif /* CK_INI_B */
#ifdef CK_TTGWSIZ
    if (!prtopt(&lines,"CK_TTGWSIZ")) return(0);
#endif /* CK_TTGWSIZ */
#ifdef CK_NAWS
    if (!prtopt(&lines,"CK_NAWS")) return(0);
#endif /* CK_NAWS */
#ifdef DCMDBUF
    if (!prtopt(&lines,"DCMDBUF")) return(0);
#endif /* DCMDBUF */
#ifdef CK_RECALL
    if (!prtopt(&lines,"CK_RECALL")) return(0);
#endif /* CK_RECALL */
#ifdef BROWSER
    if (!prtopt(&lines,"BROWSER")) return(0);
#endif /* BROWSER */
#ifdef CLSOPN
    if (!prtopt(&lines,"CLSOPN")) return(0);
#endif /* CLSOPN */
#ifdef STRATUS
    if (!prtopt(&lines,"STRATUS")) return(0);
#endif /* STRATUS */
#ifdef __VOS__
    if (!prtopt(&lines,"__VOS__")) return(0);
#endif /* __VOS__ */
#ifdef STRATUSX25
    if (!prtopt(&lines,"STRATUSX25")) return(0);
#endif /* STRATUSX25 */
#ifdef OS2MOUSE 
    if (!prtopt(&lines,"OS2MOUSE") ) return(0);
#endif /* OS2MOUSE */
#ifdef CK_REXX
    if (!prtopt(&lines,"CK_REXX") ) return(0);
#endif /* CK_REXX */
#ifdef CK_TIMERS
    if (!prtopt(&lines,"CK_TIMERS") ) return(0);
#endif /* CK_TIMERS */
#ifdef TTSPDLIST
    if (!prtopt(&lines,"TTSPDLIST") ) return(0);
#endif /* TTSPDLIST */
#ifdef CK_PERMS
    if (!prtopt(&lines,"CK_PERMS") ) return(0);
#endif /* CK_PERMS */
#ifdef CKTUNING
    if (!prtopt(&lines,"CKTUNING") ) return(0);
#endif /* CKTUNING */
#ifdef STREAMING
    if (!prtopt(&lines,"STREAMING") ) return(0);
#endif /* STREAMING */
#ifdef UNPREFIXZERO
    if (!prtopt(&lines,"UNPREFIXZERO") ) return(0);
#endif /* UNPREFIXZERO */
#ifdef NOFLOAT
    if (!prtopt(&lines,"NOFLOAT") ) return(0);
#else
#ifdef CKFLOAT
#ifdef GFTIMER
    if (!prtopt(&lines,"GFTIMER") ) return(0);
#endif /* GFTIMER */
#ifdef CKFLOAT_S
    sprintf(line,"CKFLOAT=%s",CKFLOAT_S);
    if (!prtopt(&lines,line)) return(0);
#else
    if (!prtopt(&lines,"CKFLOAT") ) return(0);
#endif /* CKFLOAT_S */
#endif /* CKFLOAT */
#endif /* NOFLOAT */

/* Sizes of data types */

    sprintf(line,"sizeofs: int=%d",sizeof(int));
    if (!prtopt(&lines,line)) return(0);
    sprintf(line,"long=%d",sizeof(long));
    if (!prtopt(&lines,line)) return(0);
    sprintf(line,"short=%d",sizeof(short));
    if (!prtopt(&lines,line)) return(0);
    sprintf(line,"char=%d",sizeof(char));
    if (!prtopt(&lines,line)) return(0);
    sprintf(line,"char*=%d",sizeof(char *));
    if (!prtopt(&lines,line)) return(0);
#ifdef LONG_MAX
    sprintf(line,"LONG_MAX=%d",LONG_MAX);
#endif /* LONG_MAX */
#ifdef CKFLOAT
    sprintf(line,"float=%d",sizeof(float));
    if (!prtopt(&lines,line)) return(0);
    sprintf(line,"double=%d",sizeof(double));
    if (!prtopt(&lines,line)) return(0);
#endif /* CKFLOAT */

    if (!prtopt(&lines,(char *)0)) return(0);
    printf("\n\n");

    return(0);
}
#endif /* NOSHOW */
#endif /* NOICP */