File: comm4.c

package info (click to toggle)
the 3.0-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,132 kB
  • ctags: 4,916
  • sloc: ansic: 63,656; sh: 1,566; makefile: 439
file content (3154 lines) | stat: -rw-r--r-- 100,903 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
/***********************************************************************/
/* COMM4.C - Commands P-S                                              */
/* This file contains all commands that can be assigned to function    */
/* keys or typed on the command line.                                  */
/***********************************************************************/
/*
 * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
 * Copyright (C) 1991-1999 Mark Hessling
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to:
 *
 *    The Free Software Foundation, Inc.
 *    675 Mass Ave,
 *    Cambridge, MA 02139 USA.
 *
 *
 * If you make modifications to this software that you feel increases
 * it usefulness for the rest of the community, please email the
 * changes, enhancements, bug fixes as well as any and all ideas to me.
 * This software is going to be maintained and enhanced as deemed
 * necessary by the community.
 *
 * Mark Hessling,  M.Hessling@qut.edu.au  http://www.lightlink.com/hessling/
 * PO Box 203, Bellara, QLD 4507, AUSTRALIA
 * Author of THE, a Free XEDIT/KEDIT editor and, Rexx/SQL
 * Maintainer of PDCurses: Public Domain Curses and, Regina Rexx interpreter
 * Use Rexx ? join the Rexx Language Association: http://www.rexxla.org
 */

static char RCSid[] = "$Id: comm4.c,v 1.1 1999/06/25 06:11:56 mark Exp mark $";

#include <the.h>
#include <proto.h>

/*man-start*********************************************************************
COMMAND
     popup - display popup menu

SYNTAX
     POPUP [MOUSE|TEXT|CENTER|CENTRE] /item1[/item2/...]
     POPUP ESCAPE keyname

DESCRIPTION
     The POPUP command allows the user to create and display a popup
     menu containing a list of selectable options.

     The location of the popup menu is specified by the first parameter.
     'MOUSE' specifies that the top left corner of the popup menu is to
     be displayed where the mouse

     On return from the popup menu, the following Rexx variables are set:

          popup.0 = 1
          popup.1 = Item selected or empty string if no item selected.

     The second form of the POPUP command allows the user to specify
     the keyname that can be used to quit from the popup window without
     making a selection.  By default 'q' will quit.

     If mouse support is available, an item is selectable by clicking
     the first mouse button on the item.  To quit from the popup window
     without making a selection, click the mouse outside the popup
     window, or on the border of the window.

     Keyboard keys that take effect in the POPUP command are CURU, CURD
     and ENTER.

COMPATIBILITY
     XEDIT: N/A
     KEDIT: First form is compatible. KEDIT does not require second form.

SEE ALSO
     <DIALOG>, <ALERT>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Popup(CHARTYPE *params)
#else
short Popup(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
#define POP_PARAMS  2
#define MAX_POPUP_LINES 100
/*--------------------------- local data ------------------------------*/
   CHARTYPE *word[POP_PARAMS+1];
   CHARTYPE strip[POP_PARAMS];
   unsigned short num_params=0;
   register short i=0,j=0;
   short rc=RC_OK,num_items=0,len=0;
   short height=0,width=0;
   int x,y;
   unsigned short begy,begx;
   CHARTYPE *args[MAX_POPUP_LINES],*ptr=NULL;
   CHARTYPE delim;
   bool invalid_item=FALSE;
#if defined(PDCURSES_MOUSE_ENABLED) || defined(NCURSES_MOUSE_VERSION)
   char location='M';
#else
   char location='C';
#endif
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
   trace_function("comm4.c:   Popup");
#endif
   if (blank_field(params))
   {
      display_error(3,params,FALSE);
#ifdef THE_TRACE
      trace_return();
#endif
      return(RC_INVALID_OPERAND);
   }
   strip[0]=STRIP_BOTH;
   strip[1]=STRIP_BOTH;
   num_params = param_split(params,word,POP_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
   if (num_params == 2
   &&  equal(word[0],(CHARTYPE *)"ESCAPE",6))
   {
      /*
       * Process the second form of this command
       */
      popup_escape_key = find_key_name(word[1]);
      if (popup_escape_key == -1)
      {
         display_error(13,word[1],FALSE);
#ifdef THE_TRACE
         trace_return();
#endif
         rc = RC_INVALID_OPERAND;
      }
#ifdef THE_TRACE
      trace_return();
#endif
      return rc;
   }
/*---------------------------------------------------------------------*/
/* The first form is only valid from a Rexx macro.                     */
/*---------------------------------------------------------------------*/
   if (!in_macro
   ||  !rexx_support)
   {
      display_error(53,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
      trace_return();
#endif
      return(RC_INVALID_ENVIRON);
   }
/*---------------------------------------------------------------------*/
/* Check if the first character of params is a the start of a keyword. */
/*---------------------------------------------------------------------*/
   if (*(params) == 'M'
   ||  *(params) == 'm'
   ||  *(params) == 'T'
   ||  *(params) == 't'
   ||  *(params) == 'C'
   ||  *(params) == 'c')
   {
      if (num_params < 2)
      {
         display_error(3,params,FALSE);
#ifdef THE_TRACE
         trace_return();
#endif
         return(RC_INVALID_OPERAND);
      }
      if (equal((CHARTYPE *)"mouse",word[0],5))
      {
         location = 'M';
      }
      else if (equal((CHARTYPE *)"text",word[0],4))
      {
         location = 'T';
      }
      else if (equal((CHARTYPE *)"center",word[0],5))
      {
         location = 'C';
      }
      else if (equal((CHARTYPE *)"centre",word[0],5))
      {
         location = 'C';
      }
      else
      {
         display_error(1,params,FALSE);
#ifdef THE_TRACE
         trace_return();
#endif
         return(RC_INVALID_OPERAND);
      }
      ptr = word[1];
   }
   else
      ptr = params;
/*---------------------------------------------------------------------*/
/* The first character is saved as the delimiter...                    */
/*---------------------------------------------------------------------*/
   delim = *(ptr);
   ptr++;                                /* throw away first delimiter */
   len = strlen((DEFCHAR *)ptr);
/*---------------------------------------------------------------------*/
/* Check that we have at least one menu item...                        */
/*---------------------------------------------------------------------*/
   if (len == 0)
      invalid_item = TRUE;
   else
   {
      if (len == 1 && (*(ptr) == delim))
         invalid_item = TRUE;
   }
   if (invalid_item)
   {
      display_error(1,ptr,FALSE);
#ifdef THE_TRACE
      trace_return();
#endif
      return(RC_INVALID_OPERAND);
   }
/*---------------------------------------------------------------------*/
/* Allow for no trailing delimiter...                                  */
/*---------------------------------------------------------------------*/
   if ((*(ptr+len-1) == delim))
      num_items = 0;
   else
      num_items = 1;
/*---------------------------------------------------------------------*/
/* Replace all / with nul character to give us seperate strings.       */
/*---------------------------------------------------------------------*/
   args[0] = ptr;
   for (i=0,j=1;i<len;i++)
   {
      if (*(ptr+i) == delim)
      {
         *(ptr+i) = '\0';
         num_items++;
         args[j++] = ptr+i+1;
      }
   }
/*---------------------------------------------------------------------*/
/* Ensure that the number of items fit on the screen...                */
/*---------------------------------------------------------------------*/
   height = num_items + 2;
   if (height > terminal_lines)
   {
      display_error(0,(CHARTYPE *)"too many rows",FALSE);
#ifdef THE_TRACE
      trace_return();
#endif
      return(RC_INVALID_OPERAND);
   }
/*---------------------------------------------------------------------*/
/* Work out the maximum width of the menu items...                     */
/*---------------------------------------------------------------------*/
   for (i=0;i<num_items;i++)
   {
      len = strlen((DEFCHAR *)args[i]);
      if ( len > width)
         width = len;
   }
   width += 4;
   if (width > terminal_cols)
   {
      display_error(0,(CHARTYPE *)"too many columns",FALSE);
#ifdef THE_TRACE
      trace_return();
#endif
      return(RC_INVALID_OPERAND);
   }
/*---------------------------------------------------------------------*/
/* If the location specified is MOUSE and this wasn't called from a    */
/* mouse key, or no mouse support is available, return an error.       */
/*---------------------------------------------------------------------*/
   switch(location)
   {
      case 'M':
#if defined(PDCURSES_MOUSE_ENABLED) || defined(NCURSES_MOUSE_VERSION)
         get_saved_mouse_pos(&y,&x);
#else
         x = y = -1;
#endif
         break;
      case 'C':
         x = (terminal_cols - width) / 2;
         y = (terminal_lines - height) / 2;
         break;
      case 'T':
         /*
          * Get the current window text position and get the
          * global offset from the window start coordinates.
          */
         getyx(CURRENT_WINDOW,y,x);
         getbegyx(CURRENT_WINDOW,begy,begx);
         y = (y + begy);
         x = (x + begx);
         break;
      default:
         break;
   }
/*---------------------------------------------------------------------*/
/* If the location specified is MOUSE and this wasn't called from a    */
/* mouse key, or no mouse support is available, return an error.       */
/*---------------------------------------------------------------------*/
   if (x == -1)
   {
      display_error(0,(CHARTYPE *)"No mouse support",FALSE);
#ifdef THE_TRACE
      trace_return();
#endif
      return(RC_INVALID_ENVIRON);
   }
/*---------------------------------------------------------------------*/
/* Make the window fit by adjusting the top left corner if it would    */
/* run over the right edge.                                            */
/*---------------------------------------------------------------------*/
   if (x + width > terminal_cols)
   {
      x = terminal_cols - width;
   }
   if (y + height > terminal_lines)
   {
      y = terminal_lines - height;
   }
   rc = execute_popup( y, x, height, width, num_items, args);
#ifdef THE_TRACE
   trace_return();
#endif
   return(rc);
}

/*man-start*********************************************************************
COMMAND
     preserve - save various editor settings

SYNTAX
     PREServe

DESCRIPTION
     The PRESERVE command saves various editing settings at the time
     the command is issued.  These settings can then be restored by
     using the <RESTORE> command.

     The following view level settings are saved:
         ARBCHAR
         ARROW
         CASE
         CMDLINE
         CURLINE
         DISPLAY
         HEX
         HEXSHOW
         HIGHLIGHT
         IDLINE
         IMPMACRO
         IMPOS
         INPUTMODE
         LINEND
         MACRO
         MARGINS
         MSGLINE
         MSGMODE
         NEWLINE
         NUMBER
         POSITION
         PREFIX
         SCALE
         SCOPE
         SHADOW
         STAY
         SYNONYM
         TABLINE
         TABS
         VERIFY
         VERSHIFT
         WORD
         WORDWRAP
         ZONE

     The following file level settings are saved:
         AUTOSAVE
         BACKUP
         COLOUR
         EOLOUT
         TABSOUT

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <RESTORE>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Preserve(CHARTYPE *params)
#else
short Preserve(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Preserve");
#endif
/*
 * Don't allow any parameters
 */
 if (!blank_field(params))
   {
    display_error(1,params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
/*
 * If we already have preserved settings, don't allocate more
 * memory, just use what's there...
 */
 if (CURRENT_VIEW->preserved_view_details == NULL)
   {
    /*
     * Allocate memory for preserved VIEW and FILE details
     */
    if ((CURRENT_VIEW->preserved_view_details = (PRESERVED_VIEW_DETAILS *)(*the_malloc)(sizeof(PRESERVED_VIEW_DETAILS))) == NULL)
      {
       display_error(30,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
       trace_return();
#endif
       return(RC_OUT_OF_MEMORY);
      }
    if ((CURRENT_FILE->preserved_file_details = (PRESERVED_FILE_DETAILS *)(*the_malloc)(sizeof(PRESERVED_FILE_DETAILS))) == NULL)
      {
       display_error(30,(CHARTYPE *)"",FALSE);
       (*the_free)(CURRENT_VIEW->preserved_view_details);
       CURRENT_VIEW->preserved_view_details = NULL;
#ifdef THE_TRACE
       trace_return();
#endif
       return(RC_OUT_OF_MEMORY);
      }
   }
 if ((CURRENT_FILE->preserved_file_details->attr = (COLOUR_ATTR *)(*the_malloc)(ATTR_MAX*sizeof(COLOUR_ATTR))) == NULL)
   {
    display_error(30,(CHARTYPE *)"",FALSE);
    (*the_free)(CURRENT_VIEW->preserved_view_details);
    CURRENT_VIEW->preserved_view_details = NULL;
    (*the_free)(CURRENT_FILE->preserved_file_details);
    CURRENT_FILE->preserved_file_details = NULL;
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_OUT_OF_MEMORY);
   }
/*
 * Save the VIEW details...
 */
 CURRENT_VIEW->preserved_view_details->arbchar_status              = CURRENT_VIEW->arbchar_status;
 CURRENT_VIEW->preserved_view_details->arbchar_single              = CURRENT_VIEW->arbchar_single;
 CURRENT_VIEW->preserved_view_details->arbchar_multiple            = CURRENT_VIEW->arbchar_multiple;
 CURRENT_VIEW->preserved_view_details->arrow_on                    = CURRENT_VIEW->arrow_on;
 CURRENT_VIEW->preserved_view_details->case_enter                  = CURRENT_VIEW->case_enter;
 CURRENT_VIEW->preserved_view_details->case_locate                 = CURRENT_VIEW->case_locate;
 CURRENT_VIEW->preserved_view_details->case_change                 = CURRENT_VIEW->case_change;
 CURRENT_VIEW->preserved_view_details->case_sort                   = CURRENT_VIEW->case_sort;
 CURRENT_VIEW->preserved_view_details->cmd_line                    = CURRENT_VIEW->cmd_line;
 CURRENT_VIEW->preserved_view_details->current_row                 = CURRENT_VIEW->current_row;
 CURRENT_VIEW->preserved_view_details->current_base                = CURRENT_VIEW->current_base;
 CURRENT_VIEW->preserved_view_details->current_off                 = CURRENT_VIEW->current_off;
 CURRENT_VIEW->preserved_view_details->display_low                 = CURRENT_VIEW->display_low;
 CURRENT_VIEW->preserved_view_details->display_high                = CURRENT_VIEW->display_high;
 CURRENT_VIEW->preserved_view_details->hex                         = CURRENT_VIEW->hex;
 CURRENT_VIEW->preserved_view_details->hexshow_on                  = CURRENT_VIEW->hexshow_on;
 CURRENT_VIEW->preserved_view_details->hexshow_base                = CURRENT_VIEW->hexshow_base;
 CURRENT_VIEW->preserved_view_details->hexshow_off                 = CURRENT_VIEW->hexshow_off;
 CURRENT_VIEW->preserved_view_details->highlight                   = CURRENT_VIEW->highlight;
 CURRENT_VIEW->preserved_view_details->highlight_high              = CURRENT_VIEW->highlight_high;
 CURRENT_VIEW->preserved_view_details->highlight_low               = CURRENT_VIEW->highlight_low;
 CURRENT_VIEW->preserved_view_details->id_line                     = CURRENT_VIEW->id_line;
 CURRENT_VIEW->preserved_view_details->imp_macro                   = CURRENT_VIEW->imp_macro;
 CURRENT_VIEW->preserved_view_details->imp_os                      = CURRENT_VIEW->imp_os;
 CURRENT_VIEW->preserved_view_details->inputmode                   = CURRENT_VIEW->inputmode;
 CURRENT_VIEW->preserved_view_details->linend_status               = CURRENT_VIEW->linend_status;
 CURRENT_VIEW->preserved_view_details->linend_value                = CURRENT_VIEW->linend_value;
 CURRENT_VIEW->preserved_view_details->macro                       = CURRENT_VIEW->macro;
 CURRENT_VIEW->preserved_view_details->margin_left                 = CURRENT_VIEW->margin_left;
 CURRENT_VIEW->preserved_view_details->margin_right                = CURRENT_VIEW->margin_right;
 CURRENT_VIEW->preserved_view_details->margin_indent               = CURRENT_VIEW->margin_indent;
 CURRENT_VIEW->preserved_view_details->margin_indent_offset_status = CURRENT_VIEW->margin_indent_offset_status;
 CURRENT_VIEW->preserved_view_details->msgline_base                = CURRENT_VIEW->msgline_base;
 CURRENT_VIEW->preserved_view_details->msgline_off                 = CURRENT_VIEW->msgline_off;
 CURRENT_VIEW->preserved_view_details->msgline_rows                = CURRENT_VIEW->msgline_rows;
 CURRENT_VIEW->preserved_view_details->msgmode_status              = CURRENT_VIEW->msgmode_status;
 CURRENT_VIEW->preserved_view_details->newline_aligned             = CURRENT_VIEW->newline_aligned;
 CURRENT_VIEW->preserved_view_details->number                      = CURRENT_VIEW->number;
 CURRENT_VIEW->preserved_view_details->position_status             = CURRENT_VIEW->position_status;
 CURRENT_VIEW->preserved_view_details->prefix                      = CURRENT_VIEW->prefix;
 CURRENT_VIEW->preserved_view_details->prefix_width                = CURRENT_VIEW->prefix_width;
 CURRENT_VIEW->preserved_view_details->prefix_gap                  = CURRENT_VIEW->prefix_gap;
 CURRENT_VIEW->preserved_view_details->scale_on                    = CURRENT_VIEW->scale_on;
 CURRENT_VIEW->preserved_view_details->scale_base                  = CURRENT_VIEW->scale_base;
 CURRENT_VIEW->preserved_view_details->scale_off                   = CURRENT_VIEW->scale_off;
 CURRENT_VIEW->preserved_view_details->scope_all                   = CURRENT_VIEW->scope_all;
 CURRENT_VIEW->preserved_view_details->shadow                      = CURRENT_VIEW->shadow;
 CURRENT_VIEW->preserved_view_details->stay                        = CURRENT_VIEW->stay;
 CURRENT_VIEW->preserved_view_details->synonym                     = CURRENT_VIEW->synonym;
 CURRENT_VIEW->preserved_view_details->tab_on                      = CURRENT_VIEW->tab_on;
 CURRENT_VIEW->preserved_view_details->tab_base                    = CURRENT_VIEW->tab_base;
 CURRENT_VIEW->preserved_view_details->tab_off                     = CURRENT_VIEW->tab_off;
 CURRENT_VIEW->preserved_view_details->tabsinc                     = CURRENT_VIEW->tabsinc;
 CURRENT_VIEW->preserved_view_details->numtabs                     = CURRENT_VIEW->numtabs;
 CURRENT_VIEW->preserved_view_details->verify_col                  = CURRENT_VIEW->verify_col;
 CURRENT_VIEW->preserved_view_details->verify_start                = CURRENT_VIEW->verify_start;
 CURRENT_VIEW->preserved_view_details->verify_end                  = CURRENT_VIEW->verify_end;
 CURRENT_VIEW->preserved_view_details->word                        = CURRENT_VIEW->word;
 CURRENT_VIEW->preserved_view_details->wordwrap                    = CURRENT_VIEW->wordwrap;
 CURRENT_VIEW->preserved_view_details->zone_start                  = CURRENT_VIEW->zone_start;
 CURRENT_VIEW->preserved_view_details->zone_end                    = CURRENT_VIEW->zone_end;
 memcpy(CURRENT_VIEW->preserved_view_details->tabs,CURRENT_VIEW->tabs,sizeof(CURRENT_VIEW->tabs));
/*
 * Save the FILE details...
 */
 CURRENT_FILE->preserved_file_details->autosave                  = CURRENT_FILE->autosave;
 CURRENT_FILE->preserved_file_details->backup                    = CURRENT_FILE->backup;
 CURRENT_FILE->preserved_file_details->eolout                    = CURRENT_FILE->eolout;
 CURRENT_FILE->preserved_file_details->tabsout_on                = CURRENT_FILE->tabsout_on;
 CURRENT_FILE->preserved_file_details->tabsout_num               = CURRENT_FILE->tabsout_num;
 memcpy(CURRENT_FILE->preserved_file_details->attr,CURRENT_FILE->attr,sizeof(CURRENT_FILE->attr));

#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     prevwindow - switch focus of editing session to another file

SYNTAX
     PREVWindow

DESCRIPTION
     The PREVWINDOW command moves the focus of the editing session to
     the other screen (if <SET SCREEN> 2 is in effect) or to the previous 
     file in the <ring>.

COMPATIBILITY
     XEDIT: N/A
     KEDIT: N/A

SEE ALSO
     <NEXTWINDOW>, <EDIT>, <SET SCREEN>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Prevwindow(CHARTYPE *params)
#else
short Prevwindow(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Prevwindow");
#endif
 if (strcmp((DEFCHAR *)params,"") != 0)
   {
    display_error(1,params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
 if (display_screens == 1)
   {
    rc = Xedit((CHARTYPE *)"-");
#ifdef THE_TRACE
    trace_return();
#endif
    return(rc);
   }
 post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
 current_screen = (current_screen == 0) ? 1 : 0;
 CURRENT_VIEW = CURRENT_SCREEN.screen_view;
 if (curses_started)
   {
    if (CURRENT_WINDOW_COMMAND != (WINDOW *)NULL)
      {
       wattrset(CURRENT_WINDOW_COMMAND,set_colour(CURRENT_FILE->attr+ATTR_CMDLINE));
       touchwin(CURRENT_WINDOW_COMMAND);
       wnoutrefresh(CURRENT_WINDOW_COMMAND);
      }
    if (CURRENT_WINDOW_ARROW != (WINDOW *)NULL)
      {
       wattrset(CURRENT_WINDOW_ARROW,set_colour(CURRENT_FILE->attr+ATTR_ARROW));
       redraw_window(CURRENT_WINDOW_ARROW);
       wnoutrefresh(CURRENT_WINDOW_ARROW);
      }
    if (statarea != (WINDOW *)NULL)
      {
       wattrset(statarea,set_colour(CURRENT_FILE->attr+ATTR_STATAREA));
       redraw_window(statarea);
      }
    if (CURRENT_WINDOW_IDLINE != (WINDOW *)NULL)
      {
       wattrset(CURRENT_WINDOW_IDLINE,set_colour(CURRENT_FILE->attr+ATTR_IDLINE));
       redraw_window(CURRENT_WINDOW_IDLINE);
      }
    if (display_screens > 1
    &&  !horizontal)
      {
       wattrset(divider,set_colour(CURRENT_FILE->attr+ATTR_DIVIDER));
       draw_divider();
       wnoutrefresh(divider);
      }
   }
 pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
 build_screen(current_screen);
 if (!line_in_view(current_screen,CURRENT_VIEW->focus_line))
   {
    CURRENT_VIEW->focus_line = CURRENT_VIEW->current_line;
    build_screen(current_screen);
   }
 display_screen(current_screen);

#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     print - send text to default printer or print spooler

SYNTAX
     PRint [target] [n]
     PRint LINE [text]
     PRint STRING [text]
     PRint FORMfeed
     PRint CLOSE

DESCRIPTION
     The PRINT command writes a portion of the current file to the default
     printer or print spooler, or text entered on the command line.
  
     PRINT [<'target'>] ['n']
        Sends text from the file contents up to the <'target'> to the printer
        followed by a CR/LF (DOS) or LF(UNIX) after each line.
        When ['n'] is specified, this sends a formfeed after ['n'] successive
        lines of text.
     PRINT 'LINE' ['text']
        Sends the remainder of the 'text' on the command line to the printer
        followed by a LF(UNIX), CR(MAC) or CR/LF (DOS).
     PRINT 'STRING' ['text']
        Sends the remainder of the 'text' on the command line to the printer
        without any trailing line terminator.
     PRINT 'FORMfeed'
         Sends a formfeed (^L) character to the printer.
     PRINT 'CLOSE'
         Closes the printer spooler.

COMPATIBILITY
     XEDIT: N/A
     KEDIT: Compatible.

SEE ALSO
     <SET PRINTER>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Print(CHARTYPE *params)
#else
short Print(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
#define PRT_PARAMS  2
 CHARTYPE *word[PRT_PARAMS+1];
 CHARTYPE strip[PRT_PARAMS];
 unsigned short num_params=0;
 short page_break=0;
 short rc=RC_OK;
 short target_type=TARGET_NORMAL|TARGET_ALL|TARGET_BLOCK_CURRENT|TARGET_SPARE;
 TARGET target;
#if defined(UNIX)
 CHARTYPE *line_term = (CHARTYPE *)"\n";
#else
 CHARTYPE *line_term = (CHARTYPE *)"\n\r";
#endif
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Print");
#endif
/*---------------------------------------------------------------------*/
/* Under Win32, startup the printing system, the first time this       */
/* command is called. This makes startup of THE faster.                */
/*---------------------------------------------------------------------*/
#ifdef WIN32
 if (!StartedPrinter)
 {
    StartTextPrnt();
    StartedPrinter = TRUE;
 }
#endif
/*---------------------------------------------------------------------*/
/* Split parameters up...                                              */
/*---------------------------------------------------------------------*/
 strip[0]=STRIP_BOTH;
 strip[1]=STRIP_NONE;
 num_params = param_split(params,word,PRT_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
 if (num_params == 0)
   {
    num_params = 1;
    word[0] = (CHARTYPE *)"1";
   }
/*---------------------------------------------------------------------*/
/* If first argument is LINE...                                        */
/*---------------------------------------------------------------------*/
 if (equal((CHARTYPE *)"line",word[0],4))
   {
    print_line(FALSE,0L,0L,0,(CHARTYPE *)word[1],line_term,0);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_OK);
   }
/*---------------------------------------------------------------------*/
/* If first argument is STRING...                                      */
/*---------------------------------------------------------------------*/
 if (equal((CHARTYPE *)"string",word[0],5))
   {
    print_line(FALSE,0L,0L,0,(CHARTYPE *)word[1],(CHARTYPE *)"",0);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_OK);
   }
/*---------------------------------------------------------------------*/
/* If first argument is FORMFEED...                                    */
/*---------------------------------------------------------------------*/
 if (equal((CHARTYPE *)"formfeed",word[0],4))
   {
    if (num_params > 1)
      {
       display_error(1,word[1],FALSE);
#ifdef THE_TRACE
       trace_return();
#endif
       return(RC_INVALID_OPERAND);
      }
    print_line(FALSE,0L,0L,0,(CHARTYPE *)"",(CHARTYPE *)"\f",0);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_OK);
   }
/*---------------------------------------------------------------------*/
/* If first argument is CLOSE...                                       */
/*---------------------------------------------------------------------*/
 if (equal((CHARTYPE *)"close",word[0],5))
   {
    if (num_params > 1)
      {
       display_error(1,word[1],FALSE);
#ifdef THE_TRACE
       trace_return();
#endif
       return(RC_INVALID_OPERAND);
      }
    print_line(TRUE,0L,0L,0,(CHARTYPE *)"",(CHARTYPE *)"",0);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_OK);
   }
/*---------------------------------------------------------------------*/
/* ...treat all other options as targets...                            */
/*---------------------------------------------------------------------*/
 initialise_target(&target);
 if ((rc = validate_target(params,&target,target_type,get_true_line(TRUE),TRUE,TRUE)) != RC_OK)
   {
    free_target(&target);
#ifdef THE_TRACE
    trace_return();
#endif
    return(rc);
   }
 if (target.spare == (-1))
    page_break = 0;
 else
   {
    if (!valid_positive_integer(strtrunc(target.rt[target.spare].string)))
      {
       display_error(4,word[0],FALSE);
#ifdef THE_TRACE
       trace_return();
#endif
       return(RC_INVALID_OPERAND);
      }
    page_break = atoi((DEFCHAR *)strtrunc(target.rt[target.spare].string));
   }
 print_line(FALSE,target.true_line,target.num_lines,page_break,
            (CHARTYPE *)"",line_term,target.rt[0].target_type);
 free_target(&target);
#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     put - write part of a file to another

SYNTAX
     PUT [target] [filename]

DESCRIPTION
     The PUT command writes a portion of the current file, defined by
     <'target'> to another file, either explicit or temporary.

     When no 'filename' is supplied the temporary file used for <PUT>
     and <GET> commands is overwritten.

     When a 'filename' is supplied the portion of the file written out
     is appended to the specified file.

     If 'CLIP:' is used in place of 'filename', the portion of the file
     specified by <'target'> is written to the clipboard.
     This option only available for Win32 ports of THE.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <PUTD>, <GET>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Put(CHARTYPE *params)
#else
short Put(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Put");
#endif
 rc = execute_put(params,FALSE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     putd - write part of a file to another and delete

SYNTAX
     PUTD [target] [filename]

DESCRIPTION
     The PUTD command writes a portion of the current file, defined by
     <'target'> to another file, either explicit or temporary, and then
     deletes the lines written.

     When no 'filename' is supplied the temporary file used for <PUT>
     and <GET> commands is overwritten.

     When a 'filename' is supplied the portion of the file written out
     is appended to the specified file.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <PUT>, <GET>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Putd(CHARTYPE *params)
#else
short Putd(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Putd");
#endif
 rc = execute_put(params,TRUE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     qquit - exit from the current file without saving changes

SYNTAX
     QQuit

DESCRIPTION
     The QQUIT command exits the user from the current file, whether
     changes made to the file have been saved or not.

     The previous file in the <ring> then becomes the current file.

     If the current file is the only file in the <ring>, THE terminates.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <QUIT>

STATUS
     Complete
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Qquit(CHARTYPE *params)
#else
short Qquit(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Qquit");
#endif
/*---------------------------------------------------------------------*/
/* No arguments are allowed; error if any are present.                 */
/*---------------------------------------------------------------------*/
 if (strcmp((DEFCHAR *)params,"") != 0)
   {
    display_error(1,(CHARTYPE *)params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
 post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
 free_view_memory(TRUE,TRUE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     query - display various option settings

SYNTAX
     Query item

DESCRIPTION
     The QUERY command displays the various settings for options set
     by THE.

     For a complete list of 'item's that can be extracted, see the section;
     <QUERY, EXTRACT and STATUS>.

     Results of the QUERY command are displayed at the top of the
     display window, and ignore the setting of <SET MSGLINE>.

COMPATIBILITY
     XEDIT: Compatible functionality, but not all options.
     KEDIT: Compatible functionality, but not all options.

SEE ALSO
     <STATUS>, <MODIFY>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Query(CHARTYPE *params)
#else
short Query(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
#define QUE_PARAMS  2
 CHARTYPE *word[QUE_PARAMS+1];
 CHARTYPE strip[QUE_PARAMS];
 unsigned short num_params=0;
 register short i=0;
 short itemno=0;
 CHARTYPE save_msgline_base = CURRENT_VIEW->msgline_base;
 short save_msgline_off = CURRENT_VIEW->msgline_off;
 ROWTYPE save_msgline_rows = CURRENT_VIEW->msgline_rows;
 bool save_msgmode_status = CURRENT_VIEW->msgmode_status;
 CHARTYPE item_type=0;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Query");
#endif
 strip[0]=STRIP_BOTH;
 strip[1]=STRIP_NONE;
 num_params = param_split(params,word,QUE_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
 if ((itemno = find_query_item(word[0],strlen((DEFCHAR *)word[0]),&item_type)) == (-1)
 || !(item_type & QUERY_QUERY))
 {
     display_error(1,params,FALSE);
#ifdef THE_TRACE
     trace_return();
#endif
     return(RC_INVALID_OPERAND);
 }

 itemno = get_item_values(1,itemno,(CHARTYPE *)word[1],QUERY_QUERY,0L,NULL,0L);
 /*
  * Save the current position and size of the message line so we can
  * restore it. Do it after we have queried the status, otherwise
  * the status of msgline will be stuffed!
  */
 CURRENT_VIEW->msgline_base   = POSITION_TOP;
 CURRENT_VIEW->msgline_off    = 1;
 CURRENT_VIEW->msgline_rows   = min(terminal_lines-1,itemno);
 CURRENT_VIEW->msgmode_status = TRUE;
 if (itemno != EXTRACT_ARG_ERROR
 &&  itemno != EXTRACT_VARIABLES_SET)
   {
    strcpy((DEFCHAR *)temp_cmd,"");
    for (i=0;i<itemno+1;i++)
      {
       strcat((DEFCHAR *)temp_cmd,(DEFCHAR *)item_values[i].value);
       strcat((DEFCHAR *)temp_cmd," ");
      }
    display_error(0,temp_cmd,TRUE);
   }
 CURRENT_VIEW->msgline_base   = save_msgline_base;
 CURRENT_VIEW->msgline_off    = save_msgline_off;
 CURRENT_VIEW->msgline_rows   = save_msgline_rows;
 CURRENT_VIEW->msgmode_status = save_msgmode_status;
#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     quit - exit from the current file if no changes made

SYNTAX
     QUIT

DESCRIPTION
     The QUIT command exits the user from the current file, provided
     that any changes made to the file have been saved, otherwise an
     error message is displayed.

     The previous file in the <ring> then becomes the current file.

     If the current file is the only file in the <ring>, THE terminates.

COMPATIBILITY
     XEDIT: Does not support return code option.
     KEDIT: Compatible.

SEE ALSO
     <QQUIT>

STATUS
     Complete
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Quit(CHARTYPE *params)
#else
short Quit(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Quit");
#endif
/*---------------------------------------------------------------------*/
/* No arguments are allowed; error if any are present.                 */
/*---------------------------------------------------------------------*/
 if (strcmp((DEFCHAR *)params,"") != 0)
   {
    display_error(1,(CHARTYPE *)params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
 post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
 if (CURRENT_FILE->save_alt > 0)
   {
    display_error(22,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_FILE_CHANGED);
   }
 free_view_memory(TRUE,TRUE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     readv - read keystrokes and pass to macro

SYNTAX
     READV Cmdline [initial text]
     READV KEY

DESCRIPTION
     The READV command allows a Rexx macro to interact with the user
     by accepting either individual keystrokes ('KEY') or a complete
     line of text ('Cmdline').

     The READV 'Cmdline' can take optional 'initial text' to be
     displayed on the command line.

     The 'macro' obtains the entered information by setting Rexx
     variables. These are set as follows.

     'KEY' option:

          readv.0 = 4
          readv.1 = name of key (empty if unknown)
          readv.2 = ASCII value of key (null if not an ASCII code)
          readv.3 = curses key value (or ASCII code if an ASCII code)
          readv.4 = shift status (see below)

     'CMDLINE' option:

          readv.0 = 1
          readv.1 = contents of command line

     While editting the command in READV 'Cmdline', any key redefinitions
     you have made will be in effect.  Therefore you can use your
     "normal" editting keys to edit the line.  THE will allow the 
     following commands to be executed while in READV 'Cmdline':

          <CURSOR> LEFT, <CURSOR> RIGHT, <CURSOR> DOWN, <CURSOR> UP,
          <SOS FIRSTCHAR>, <SOS ENDCHAR>, <SOS STARTENDCHAR>,
          <SOS DELEND>, <SOS DELCHAR>, <SOS DELCHAR>,
          <SOS TABB>, <SOS TABF>, <SOS TABWORDB>, <SOS TABWORDF>,
          <SOS UNDO>, <SOS DELWORD>, <SET INSERTMODE>, <TEXT>

     Either of the keys, ENTER, RETURN and NUMENTER will terminate
     READV 'Cmdline', irrespective of what THE commands have been
     assigned.

     The shift status of the key is an eight character string of
     0 or 1; each position represented by the following.

          Position
             1      1 if INSERTMODE is ON
             2      always 0
             3      always 0
             4      always 0
             5      1 if ALT key pressed
             6      1 if CTRL key pressed
             7      1 if SHIFT key pressed
             8      same as position 7

COMPATIBILITY
     XEDIT: Similar to READ CMDLINE option.
     KEDIT: Compatible.

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Readv(CHARTYPE *params)
#else
short Readv(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
#define REA_PARAMS  2
   CHARTYPE *word[REA_PARAMS+1];
   CHARTYPE strip[REA_PARAMS];
   unsigned short num_params=0;
   short rc=RC_OK,itemno=0,num_values=0;
   unsigned short y=0,x=0;
   CHARTYPE item_type=0;
   bool cursor_on_cmdline=FALSE;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
   trace_function( "comm4.c:   Readv" );
#endif
   if ( !in_macro
   ||   !rexx_support )
   {
      display_error( 53, (CHARTYPE *)"", FALSE );
#ifdef THE_TRACE
      trace_return();
#endif
      return( RC_INVALID_ENVIRON );
   }
   strip[0]=STRIP_BOTH;
   strip[1]=STRIP_NONE;
   num_params = param_split( params, word, REA_PARAMS, WORD_DELIMS, TEMP_PARAM, strip, FALSE );
   if ( num_params == 0 )
   {
      display_error( 1, params, FALSE );
#ifdef THE_TRACE
      trace_return();
#endif
      return( RC_INVALID_OPERAND );
   }

   getyx( CURRENT_WINDOW, y, x );
   (void)THERefresh( (CHARTYPE *)"" );
#if defined(USE_EXTCURSES)
   getyx( CURRENT_WINDOW, y, x );
   wmove( CURRENT_WINDOW, y, x );
   wrefresh( CURRENT_WINDOW );
#endif
   if ( equal( (CHARTYPE *)"key", word[0], 3) )
   {
      /*
       * Find the item in the list of valid extract options...
       */
      if ( ( itemno = find_query_item( (CHARTYPE *)"READV", 5, &item_type ) ) == (-1) )
      {
         display_error( 1, params, FALSE );
#ifdef THE_TRACE
         trace_return();
#endif
         return( RC_INVALID_OPERAND );
      }
      /*
       * Get the current settings for the valid item...
       */
      num_values = get_item_values( 1, itemno, NULL, QUERY_READV, 0L, NULL, 0L );
      /*
       * If the arguments to the item are invalid, return with an error.
       */
       if ( num_values == EXTRACT_ARG_ERROR )
      {
#ifdef THE_TRACE
          trace_return();
#endif
          return( RC_INVALID_OPERAND );
      }
      /*
       * If the Rexx variables have already been set, don't try to set them.
       */
      if ( num_values != EXTRACT_VARIABLES_SET )
         rc = set_extract_variables( itemno );
      if ( error_on_screen )
         clear_msgline( -1 );
   }
   else
   {
      if ( equal( (CHARTYPE *)"cmdline", word[0], 1 ) )
      {
         if ( CURRENT_VIEW->current_window == WINDOW_COMMAND )
            cursor_on_cmdline = TRUE;
         rc = readv_cmdline( word[1], NULL, -1 );
         set_rexx_variable( (CHARTYPE *)"READV", cmd_rec, cmd_rec_len, 1 );
         set_rexx_variable( (CHARTYPE *)"READV", (CHARTYPE *)"1", 1, 0 );
         wmove(CURRENT_WINDOW_COMMAND,0,0);
         my_wclrtoeol(CURRENT_WINDOW_COMMAND);
         memset(cmd_rec,' ',max_line_length);
         cmd_rec_len = 0;
         wmove(CURRENT_WINDOW_COMMAND,0,0);
         if ( !cursor_on_cmdline )
            THEcursor_home( TRUE );
      }
      else
      {
         display_error( 1, word[0], FALSE );
#ifdef THE_TRACE
         trace_return();
#endif
         return( RC_INVALID_OPERAND );
      }
   }
   initial = FALSE;
#ifdef THE_TRACE
   trace_return();
#endif
   return( rc );
}
/*man-start*********************************************************************
COMMAND
     recover - recover changed or deleted lines

SYNTAX
     RECover [n|*]

DESCRIPTION
     The RECOVER command restores the last 'n', or all '*' changed or 
     deleted lines back into the body of the file.

COMPATIBILITY
     XEDIT: Also recovers changes to lines, not just lines deleted.
     KEDIT: Compatible.

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Recover(CHARTYPE *params)
#else
short Recover(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
#define REC_PARAMS  2
 CHARTYPE strip[REC_PARAMS];
 CHARTYPE *word[REC_PARAMS+1];
 unsigned short num_params=0;
 short num=0;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Recover");
#endif
/*---------------------------------------------------------------------*/
/* Validate the parameters that have been supplied. The one and only   */
/* parameter should be a positive integer greater than zero or '*'.    */
/* If no parameter is supplied, 1 is assumed.                          */
/*---------------------------------------------------------------------*/
 strip[0]=STRIP_BOTH;
 strip[1]=STRIP_BOTH;
 num_params = param_split(params,word,REC_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
 switch(num_params)
   {
    case 0:
         num = 1;
         break;
    case 1:
         if (strcmp((DEFCHAR *)word[0],"*") == 0)
            num = 99;
         else
           {
            if (!valid_positive_integer(word[0]))
              {
               display_error(4,word[0],FALSE);
#ifdef THE_TRACE
               trace_return();
#endif
               return(RC_INVALID_OPERAND);
              }
            num = atoi((DEFCHAR *)word[0]);
           }
         break;
    default:
         display_error(1,word[1],FALSE);
#ifdef THE_TRACE
         trace_return();
#endif
         return(RC_INVALID_OPERAND);
    }
 get_from_recovery_list(num);
#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     redraw - redraw the current screen

SYNTAX
     REDRAW

DESCRIPTION
     The REDRAW command redraws the current contents of the screen.
     This is usually used when some outside influence has affected 
     the display.

COMPATIBILITY
     XEDIT: N/A
     KEDIT: N/A

SEE ALSO
     <REFRESH>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Redraw(CHARTYPE *params)
#else
short Redraw(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Redraw");
#endif
 if (strcmp((DEFCHAR *)params,"") != 0)
   {
    display_error(1,params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
 erase();
 refresh();
 restore_THE();
#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     refresh - refresh the contents of the current screen

SYNTAX
     REFRESH

DESCRIPTION
     The REFRESH command refreshes what is being displayed on the screen.
     This is usually used from within a <macro> to indicate the progress
     of the <macro>.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <REDRAW>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short THERefresh(CHARTYPE *params)
#else
short THERefresh(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 bool save_in_macro=in_macro;
 unsigned short y=0,x=0;
 LINETYPE new_focus_line=0L;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   THERefresh");
#endif
 if (strcmp((DEFCHAR *)params,"") != 0)
   {
    display_error(1,params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
 if (!curses_started)
   {
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_ENVIRON);
   }
 getyx(CURRENT_WINDOW,y,x);
 in_macro = FALSE;
 if (display_screens > 1)
   {
    prepare_view(other_screen);
    display_screen(other_screen);
    if (!horizontal)
      {
       touchwin(divider);
       wnoutrefresh(divider);
      }
   }
 show_statarea();
#if defined(HAVE_SLK_INIT)
 if (SLKx)
   {
    slk_touch();
    slk_noutrefresh();
   }
#endif
 CURRENT_VIEW->current_row = calculate_actual_row(CURRENT_VIEW->current_base,
                                                  CURRENT_VIEW->current_off,
                                                  CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE);
 build_screen(current_screen); 
 if (CURRENT_VIEW->current_window != WINDOW_COMMAND)
   {
    if (curses_started)
       getyx(CURRENT_WINDOW,y,x);
    if (!line_in_view(current_screen,CURRENT_VIEW->focus_line))
      {
       new_focus_line = get_focus_line_in_view(current_screen,CURRENT_VIEW->focus_line,y);
       post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
       CURRENT_VIEW->focus_line = new_focus_line;
       pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
      }
    y = get_row_for_focus_line(current_screen,CURRENT_VIEW->focus_line,CURRENT_VIEW->current_row);
    if (curses_started)
       wmove(CURRENT_WINDOW,y,x);
   }
 display_screen(current_screen);
 if (error_on_screen)
   expose_msgline();
 wmove(CURRENT_WINDOW,y,x);
 wrefresh(CURRENT_WINDOW);
 in_macro = save_in_macro;
#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     repeat - repeat the last command

SYNTAX
     REPEat [target]

DESCRIPTION
     The REPEAT command advances the current line and executes the
     last command. It is equivalent to <NEXT> 1 (or <UP> 1) and <=> for
     the specified number of times specified by <'target'>.

     To determine how many lines on which to execute the last command,
     THE uses the target to determine how many lines from the current
     position to the target.  This is the number of times the last
     command is executed.

     If the last command to be executed, changes the current line,
     (because it has a target specification), the next execution of
     the last command will begin from where the previous execution of
     last command ended.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

STATUS
     Complete
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Repeat(CHARTYPE *params)
#else
short Repeat(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 LINETYPE num_lines=0L;
 short rc=RC_OK;
 short direction=0;
 TARGET target;
 short target_type=TARGET_NORMAL;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Repeat");
#endif
 if (strcmp("",(DEFCHAR *)params) == 0)
    params = (CHARTYPE *)"+1";
 initialise_target(&target);
 if ((rc = validate_target(params,&target,target_type,get_true_line(TRUE),TRUE,TRUE)) != RC_OK)
   {
    free_target(&target);
#ifdef THE_TRACE
    trace_return();
#endif
    return(rc);
   }
 post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
/*---------------------------------------------------------------------*/
/* Determine in which direction we are working.                        */
/*---------------------------------------------------------------------*/
 if (target.num_lines < 0L)
   {
    direction = DIRECTION_BACKWARD;
    num_lines = target.num_lines * (-1L);
   }
 else
   {
    direction = DIRECTION_FORWARD;
    num_lines = target.num_lines;
   }
 free_target(&target);
/*---------------------------------------------------------------------*/
/* Repeat the last command until the number of lines has been reached  */
/* or the last command returns non-zero.                               */
/*---------------------------------------------------------------------*/
 in_repeat = TRUE;

 while(num_lines-- > 0)
   {
    rc = advance_current_or_focus_line((LINETYPE)direction);
    if (rc != RC_OK)
       break;
    rc = command_line(last_command_for_repeat,COMMAND_ONLY_FALSE);
    if (rc != RC_OK)
        break;
   }
 in_repeat = FALSE;
 display_screen(current_screen);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     replace - replace the current line with supplied text

SYNTAX
     Replace [text]

DESCRIPTION
     The REPLACE command replaces the <focus line> with the supplied
     'text'.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Replace(CHARTYPE *params)
#else
short Replace(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short len_params=0;
 LINETYPE true_line=0L;
 LINE *curr=NULL;
 SELECTTYPE current_select=0;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Replace");
#endif

 post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
 if (CURRENT_VIEW->hex)
   {
    if ((len_params = convert_hex_strings(params)) == (-1))
      {
       display_error(32,params,FALSE);
#ifdef THE_TRACE
       trace_return();
#endif
       return(RC_INVALID_OPERAND);
      }
   }
 else
   len_params = strlen((DEFCHAR *)params);
 true_line = get_true_line(TRUE);
 if (TOF(true_line)
 ||  BOF(true_line))
   {
    display_error(38,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_OUT_OF_MEMORY); /* ?? */
   }
 curr = lll_find(CURRENT_FILE->first_line,CURRENT_FILE->last_line,true_line,CURRENT_FILE->number_lines);
 current_select = curr->select;
 add_to_recovery_list(curr->line,curr->length);
 curr = delete_LINE(CURRENT_FILE->first_line,CURRENT_FILE->last_line,curr,DIRECTION_FORWARD);
 curr = curr->prev;
 if ((curr = add_LINE(CURRENT_FILE->first_line,curr,
                          params,len_params,current_select,TRUE)) == NULL)
   {
    display_error(30,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_OUT_OF_MEMORY);
   }
 increment_alt(CURRENT_FILE);

 pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);

 build_screen(current_screen); 
 display_screen(current_screen);

#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     reset - cancel the marked block or prefix commands or both

SYNTAX
     RESet ALL|Block|Prefix

DESCRIPTION
     The RESET command unmarks any marked <block> or outstanding prefix
     commands or both.

COMPATIBILITY
     XEDIT: Adds Block and All options.
     KEDIT: Compatible.

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Reset(CHARTYPE *params)
#else
short Reset(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
#define RES_PARAMS  1
 CHARTYPE *word[RES_PARAMS+1];
 CHARTYPE strip[RES_PARAMS];
 unsigned short num_params=0;
 THE_PPC *curr_ppc=NULL;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Reset");
#endif
 strip[0]=STRIP_BOTH;
 num_params = param_split(params,word,RES_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
 if (num_params > 1)
   {
    display_error(1,word[1],FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
/*---------------------------------------------------------------------*/
/* Reset the marked block, if any.                                     */
/*---------------------------------------------------------------------*/
 if (equal((CHARTYPE *)"block",word[0],1)
 ||  equal((CHARTYPE *)"all",word[0],3)
 ||  num_params == 0)
   {
    if (MARK_VIEW != (VIEW_DETAILS *)NULL)
      {
       MARK_VIEW->marked_line = MARK_VIEW->marked_col = FALSE;
       MARK_VIEW = (VIEW_DETAILS *)NULL;
       build_screen(current_screen); 
       display_screen(current_screen);
      }
   }
/*---------------------------------------------------------------------*/
/* Reset the pending prefix commands, if any.                          */
/*---------------------------------------------------------------------*/
 if (equal((CHARTYPE *)"prefix",word[0],1)
 ||  equal((CHARTYPE *)"all",word[0],3)
 ||  num_params == 0)
   {
    curr_ppc = CURRENT_FILE->first_ppc;
    while(curr_ppc != NULL)
       curr_ppc = delete_pending_prefix_command(curr_ppc,CURRENT_FILE,(LINE *)NULL);
    memset(pre_rec,' ',MAX_PREFIX_WIDTH+1);
    pre_rec_len = 0;
    build_screen(current_screen); 
    display_screen(current_screen);
   }
#ifdef THE_TRACE
 trace_return();
#endif
 return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
     restore - restore various editor settings

SYNTAX
     REStore

DESCRIPTION
     The RESTORE command restores various editing settings at the time
     the command is issued.  These settings must have been saved with
     the <PRESERVE> command.

     If an attempt is made to restore settings that have not been preserved,
     an error results.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <PRESERVE>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Restore(CHARTYPE *params)
#else
short Restore(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
 bool rebuild_screen=FALSE;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Restore");
#endif
/*
 * Don't allow any parameters
 */
 if (!blank_field(params))
   {
    display_error(1,params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
/*
 * If we don't have any preserved settings, return an error.
 */
 if (CURRENT_VIEW->preserved_view_details == NULL)
   {
    display_error(51,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
 /*
  * Before putting the settings back, we have to do some special things
  * with PREFIX, ARROW, CMDLINE, ID_LINE, ...
  */
 if (CURRENT_VIEW->prefix != CURRENT_VIEW->preserved_view_details->prefix
 ||  CURRENT_VIEW->prefix_width != CURRENT_VIEW->preserved_view_details->prefix_width
 ||  CURRENT_VIEW->prefix_gap != CURRENT_VIEW->preserved_view_details->prefix_gap
 ||  CURRENT_VIEW->arrow_on != CURRENT_VIEW->preserved_view_details->arrow_on
 ||  CURRENT_VIEW->cmd_line != CURRENT_VIEW->preserved_view_details->cmd_line
 ||  CURRENT_VIEW->id_line != CURRENT_VIEW->preserved_view_details->id_line)
    rebuild_screen = TRUE;
 /*
  * Restore the VIEW details...
  */
 CURRENT_VIEW->arbchar_status              = CURRENT_VIEW->preserved_view_details->arbchar_status;
 CURRENT_VIEW->arbchar_single              = CURRENT_VIEW->preserved_view_details->arbchar_single;
 CURRENT_VIEW->arbchar_multiple            = CURRENT_VIEW->preserved_view_details->arbchar_multiple;
 CURRENT_VIEW->arrow_on                    = CURRENT_VIEW->preserved_view_details->arrow_on;
 CURRENT_VIEW->case_enter                  = CURRENT_VIEW->preserved_view_details->case_enter;
 CURRENT_VIEW->case_locate                 = CURRENT_VIEW->preserved_view_details->case_locate;
 CURRENT_VIEW->case_change                 = CURRENT_VIEW->preserved_view_details->case_change;
 CURRENT_VIEW->case_sort                   = CURRENT_VIEW->preserved_view_details->case_sort;
 CURRENT_VIEW->cmd_line                    = CURRENT_VIEW->preserved_view_details->cmd_line;
 CURRENT_VIEW->current_row                 = CURRENT_VIEW->preserved_view_details->current_row;
 CURRENT_VIEW->current_base                = CURRENT_VIEW->preserved_view_details->current_base;
 CURRENT_VIEW->current_off                 = CURRENT_VIEW->preserved_view_details->current_off;
 CURRENT_VIEW->display_low                 = CURRENT_VIEW->preserved_view_details->display_low;
 CURRENT_VIEW->display_high                = CURRENT_VIEW->preserved_view_details->display_high;
 CURRENT_VIEW->hex                         = CURRENT_VIEW->preserved_view_details->hex;
 CURRENT_VIEW->hexshow_on                  = CURRENT_VIEW->preserved_view_details->hexshow_on;
 CURRENT_VIEW->hexshow_base                = CURRENT_VIEW->preserved_view_details->hexshow_base;
 CURRENT_VIEW->hexshow_off                 = CURRENT_VIEW->preserved_view_details->hexshow_off;
 CURRENT_VIEW->highlight                   = CURRENT_VIEW->preserved_view_details->highlight;
 CURRENT_VIEW->highlight_high              = CURRENT_VIEW->preserved_view_details->highlight_high;
 CURRENT_VIEW->highlight_low               = CURRENT_VIEW->preserved_view_details->highlight_low;
 CURRENT_VIEW->id_line                     = CURRENT_VIEW->preserved_view_details->id_line;
 CURRENT_VIEW->imp_macro                   = CURRENT_VIEW->preserved_view_details->imp_macro;
 CURRENT_VIEW->imp_os                      = CURRENT_VIEW->preserved_view_details->imp_os;
 CURRENT_VIEW->inputmode                   = CURRENT_VIEW->preserved_view_details->inputmode;
 CURRENT_VIEW->linend_status               = CURRENT_VIEW->preserved_view_details->linend_status;
 CURRENT_VIEW->linend_value                = CURRENT_VIEW->preserved_view_details->linend_value;
 CURRENT_VIEW->macro                       = CURRENT_VIEW->preserved_view_details->macro;
 CURRENT_VIEW->margin_left                 = CURRENT_VIEW->preserved_view_details->margin_left;
 CURRENT_VIEW->margin_right                = CURRENT_VIEW->preserved_view_details->margin_right;
 CURRENT_VIEW->margin_indent               = CURRENT_VIEW->preserved_view_details->margin_indent;
 CURRENT_VIEW->margin_indent_offset_status = CURRENT_VIEW->preserved_view_details->margin_indent_offset_status;
 CURRENT_VIEW->msgline_base                = CURRENT_VIEW->preserved_view_details->msgline_base;
 CURRENT_VIEW->msgline_off                 = CURRENT_VIEW->preserved_view_details->msgline_off;
 CURRENT_VIEW->msgline_rows                = CURRENT_VIEW->preserved_view_details->msgline_rows;
 CURRENT_VIEW->msgmode_status              = CURRENT_VIEW->preserved_view_details->msgmode_status;
 CURRENT_VIEW->newline_aligned             = CURRENT_VIEW->preserved_view_details->newline_aligned;
 CURRENT_VIEW->number                      = CURRENT_VIEW->preserved_view_details->number;
 CURRENT_VIEW->position_status             = CURRENT_VIEW->preserved_view_details->position_status;
 CURRENT_VIEW->prefix                      = CURRENT_VIEW->preserved_view_details->prefix;
 CURRENT_VIEW->prefix_width                = CURRENT_VIEW->preserved_view_details->prefix_width;
 CURRENT_VIEW->prefix_gap                  = CURRENT_VIEW->preserved_view_details->prefix_gap;
 CURRENT_VIEW->scale_on                    = CURRENT_VIEW->preserved_view_details->scale_on;
 CURRENT_VIEW->scale_base                  = CURRENT_VIEW->preserved_view_details->scale_base;
 CURRENT_VIEW->scale_off                   = CURRENT_VIEW->preserved_view_details->scale_off;
 CURRENT_VIEW->scope_all                   = CURRENT_VIEW->preserved_view_details->scope_all;
 CURRENT_VIEW->shadow                      = CURRENT_VIEW->preserved_view_details->shadow;
 CURRENT_VIEW->stay                        = CURRENT_VIEW->preserved_view_details->stay;
 CURRENT_VIEW->synonym                     = CURRENT_VIEW->preserved_view_details->synonym;
 CURRENT_VIEW->tab_on                      = CURRENT_VIEW->preserved_view_details->tab_on;
 CURRENT_VIEW->tab_base                    = CURRENT_VIEW->preserved_view_details->tab_base;
 CURRENT_VIEW->tab_off                     = CURRENT_VIEW->preserved_view_details->tab_off;
 CURRENT_VIEW->tabsinc                     = CURRENT_VIEW->preserved_view_details->tabsinc;
 CURRENT_VIEW->numtabs                     = CURRENT_VIEW->preserved_view_details->numtabs;
 CURRENT_VIEW->verify_col                  = CURRENT_VIEW->preserved_view_details->verify_col;
 CURRENT_VIEW->verify_start                = CURRENT_VIEW->preserved_view_details->verify_start;
 CURRENT_VIEW->verify_end                  = CURRENT_VIEW->preserved_view_details->verify_end;
 CURRENT_VIEW->word                        = CURRENT_VIEW->preserved_view_details->word;
 CURRENT_VIEW->wordwrap                    = CURRENT_VIEW->preserved_view_details->wordwrap;
 CURRENT_VIEW->zone_start                  = CURRENT_VIEW->preserved_view_details->zone_start;
 CURRENT_VIEW->zone_end                    = CURRENT_VIEW->preserved_view_details->zone_end;
 memcpy(CURRENT_VIEW->tabs,CURRENT_VIEW->preserved_view_details->tabs,sizeof(CURRENT_VIEW->preserved_view_details->tabs)); /* FGC */
/*
 * Restore the FILE details...
 */
 CURRENT_FILE->autosave                  = CURRENT_FILE->preserved_file_details->autosave;
 CURRENT_FILE->backup                    = CURRENT_FILE->preserved_file_details->backup;
 CURRENT_FILE->eolout                    = CURRENT_FILE->preserved_file_details->eolout;
 CURRENT_FILE->tabsout_on                = CURRENT_FILE->preserved_file_details->tabsout_on;
 CURRENT_FILE->tabsout_num               = CURRENT_FILE->preserved_file_details->tabsout_num;
 memcpy(CURRENT_FILE->attr,CURRENT_FILE->preserved_file_details->attr,sizeof(CURRENT_FILE->preserved_file_details->attr));
 /*
  * Free any memory for preserved VIEW and FILE details
  */
 (*the_free)(CURRENT_VIEW->preserved_view_details);
 CURRENT_VIEW->preserved_view_details = NULL;
 (*the_free)(CURRENT_FILE->preserved_file_details->attr);
 CURRENT_FILE->preserved_file_details->attr = NULL;
 (*the_free)(CURRENT_FILE->preserved_file_details);
 CURRENT_FILE->preserved_file_details = NULL;
 /*
  * Now that all the settings are back in place apply any screen
  * changes...
  */
 if (rebuild_screen)
   {
    set_screen_defaults();
    if (set_up_windows(current_screen) != RC_OK)
      {
#ifdef THE_TRACE
       trace_return();
#endif
       return(RC_OK);
      }
    build_screen(current_screen);
    display_screen(current_screen);
   }
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     rexx - execute Rexx instructions

SYNTAX
     REXX rexx instructions

DESCRIPTION
     The REXX command allows  the user to enter Rexx instructions
     from the command line.

COMPATIBILITY
     XEDIT: N/A
     KEDIT: N/A

SEE ALSO
     <MACRO>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short THERexx(CHARTYPE *params)
#else
short THERexx(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
 short macrorc=0;
 bool save_in_macro=in_macro;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   THERexx");
#endif
#ifdef NOREXX
#else
 if (rexx_support)
   {
/*---------------------------------------------------------------------*/
/* Set in_macro = TRUE to stop multiple show_page()s being performed.  */
/*---------------------------------------------------------------------*/
    in_macro = TRUE;
/*---------------------------------------------------------------------*/
/* Save the values of the cursor position for EXTRACT command..        */
/*---------------------------------------------------------------------*/
    get_cursor_position(&original_screen_line,&original_screen_column,
                     &original_file_line,&original_file_column);
    post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
    rc = execute_macro_instore(params, &macrorc, NULL, NULL, NULL, 0);
/*---------------------------------------------------------------------*/
/* Set in_macro = FALSE to indicate we are out of the macro and do a   */
/* show_page() now as long as there are still file(s) in the ring.     */
/*---------------------------------------------------------------------*/
    in_macro = save_in_macro;
    if (number_of_files > 0)
      {
       if (display_screens > 1)
         {
          build_screen(other_screen);
          display_screen(other_screen);
         }
       build_screen(current_screen);
       display_screen(current_screen);
      }
   }
#endif
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     rgtleft - scroll the screen to the left or right

SYNTAX
     RGTLEFT [n]

DESCRIPTION
     The RGTLEFT command scrolls the screen 'n' columns to the right
     if the value of <vershift> is less than or equal to 0, or if
     the value of <vershift> is greater than 0, the screen is
     scrolled 'n' columns to the left.

     If 'n' is not specified, the screen scrolls by three quarters the
     number of columns displayed.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <LEFT>, <RIGHT>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Rgtleft(CHARTYPE *params)
#else
short Rgtleft(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
 LINETYPE shift_val=0L;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Rgtleft");
#endif
/*---------------------------------------------------------------------*/
/* Validate only parameter, a positive integer. 3/4 if no argument.    */
/*---------------------------------------------------------------------*/
 if (blank_field(params))
    shift_val = min(CURRENT_SCREEN.cols[WINDOW_FILEAREA],
                  1 + CURRENT_VIEW->verify_end - CURRENT_VIEW->verify_start)*3/4;
 else
   {
    if (valid_positive_integer(params))
       shift_val = atol((DEFCHAR *)params);
   }
 if (shift_val == (-1))                            /* invalid argument */
   {
    display_error(1,params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
 if ((LINETYPE)CURRENT_VIEW->verify_col - (LINETYPE)CURRENT_VIEW->verify_start > 0)
    shift_val = -shift_val;
 CURRENT_VIEW->verify_col = max(1,CURRENT_VIEW->verify_col+shift_val);
 build_screen(current_screen);
 display_screen(current_screen);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     right - scroll the screen to the right

SYNTAX
     RIght [n|HALF|FULL]

DESCRIPTION
     The RIGHT command scrolls the screen to the right.

     If 'n' is supplied, the screen scrolls by that many columns.

     If 'HALF' is specified the screen is scrolled by half the number
     of columns in the <filearea>.

     If 'FULL' is specified the screen is scrolled by the number
     of columns in the <filearea>.

     If no parameter is supplied, the screen is scrolled by one
     column. 

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <LEFT>, <RGTLEFT>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Right(CHARTYPE *params)
#else
short Right(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
 LINETYPE shift_val=-1L;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Right");
#endif
/*---------------------------------------------------------------------*/
/* Validate only parameter, HALF or positive integer. 1 if no argument.*/
/*---------------------------------------------------------------------*/
 if (equal((CHARTYPE *)"half",params,4))
    shift_val = CURRENT_SCREEN.cols[WINDOW_FILEAREA]/2;
 if (equal((CHARTYPE *)"full",params,4))
    shift_val = CURRENT_SCREEN.cols[WINDOW_FILEAREA];
 if (blank_field(params))
    shift_val = 1L;
 if (shift_val == (-1))         /* argument not HALF,FULL or empty ... */
   {
    if (valid_positive_integer(params))
      {
       shift_val = atol((DEFCHAR *)params);
       if (shift_val != 0)
          shift_val = shift_val;
      }
   }
 if (shift_val == (-1))                            /* invalid argument */
   {
    display_error(1,params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
/*---------------------------------------------------------------------*/
/* If the argument is 0, restore the original verify columns display.  */
/*---------------------------------------------------------------------*/
 if (shift_val == 0L)
    CURRENT_VIEW->verify_col = CURRENT_VIEW->verify_start;
 else
    CURRENT_VIEW->verify_col = max(1,CURRENT_VIEW->verify_col+shift_val);
#ifdef MSWIN
 Win31HScroll(CURRENT_VIEW->verify_col);
#endif
 build_screen(current_screen);
 display_screen(current_screen);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     save - save changes to current file

SYNTAX
     SAVE [filename]

DESCRIPTION
     The SAVE command writes the current file to disk. If a 'filename' is
     supplied, the current file is saved in that file, unless the file
     already exists which will result in an error message being
     displayed. Both 'Alterations' counters on the <idline> are
     reset to zero.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <SSAVE>, <FILE>, <FFILE>

STATUS
     Complete
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Save(CHARTYPE *params)
#else
short Save(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Save");
#endif
 post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
 if ((rc = save_file(CURRENT_FILE,params,FALSE,CURRENT_FILE->number_lines,1L,NULL,FALSE,0,max_line_length,TRUE,FALSE,FALSE)) != RC_OK)
   {
#ifdef THE_TRACE
    trace_return();
#endif
    return(rc);
   }
/*---------------------------------------------------------------------*/
/* Only set the alteration count to zero if save was successful.       */
/*---------------------------------------------------------------------*/
 CURRENT_FILE->autosave_alt = CURRENT_FILE->save_alt = 0;
/*---------------------------------------------------------------------*/
/* If autosave is on at the time of Saving, remove the .aus file...    */
/*---------------------------------------------------------------------*/
 if (CURRENT_FILE->autosave > 0)
    rc = remove_aus_file(CURRENT_FILE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     schange - selectively change strings

SYNTAX
     SCHange /string1/string2/ [target] [n] [m]

DESCRIPTION
     The SCHANGE command changes one string of text to another only
     after confirming each individual change with the user.

     The first parameter to the change command is the old and new
     string values, seperated by delimiters.
     The allowable delimiters are '/' '\' and '@'.

     The second parameter is the <target>; how many lines are to be                                                       
     searched for occurrences of 'string1' to be changed.

     'n' determines how many occurrences of 'string1' are to be 
     changed to 'string2' on each line.

     'm' determines from which occurrence of 'string1' on the line 
     changes are to commence.

COMPATIBILITY
     XEDIT: Functionally compatible, but syntax different.
     KEDIT: Compatible.

DEFAULT
     1 1 1

SEE ALSO
     <CHANGE>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Schange(CHARTYPE *params)
#else
short Schange(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Schange");
#endif
 rc = execute_change_command(params,TRUE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     set - execute various set commands

SYNTAX
     SET set_command [set_command parameter(s) ...]

DESCRIPTION
     The SET command is a front end to existing <SET> commands. It treats
     the first parameter it receives as a command and executes it.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Set(CHARTYPE *params)
#else
short Set(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Set");
#endif
 rc = execute_set_sos_command(TRUE,params);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     shift - move text left or right

SYNTAX
     SHift Left|Right [n] [target]

DESCRIPTION
     The SHIFT command moves text in the direction specified the number
     of columns 'n' for the specified <'target'> lines.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Shift(CHARTYPE *params)
#else
short Shift(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
#define SHI_PARAMS  3
 CHARTYPE *word[SHI_PARAMS+1];
 CHARTYPE strip[SHI_PARAMS];
 short shift_left=(-1);
 LINETYPE num_lines=0L,true_line=0L;
 short num_cols=0,num_params=0;
 short rc=RC_OK;
 short target_type=TARGET_NORMAL|TARGET_BLOCK_CURRENT|TARGET_ALL;
 short save_target_type=TARGET_UNFOUND;
 TARGET target;
 bool num_lines_based_on_scope=FALSE;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Shift");
#endif
 strip[0]=STRIP_BOTH;
 strip[1]=STRIP_BOTH;
 strip[2]=STRIP_NONE;
 num_params = param_split(params,word,SHI_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
 if (num_params == 0)                                     /* no params */
   {
    display_error(3,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
/*---------------------------------------------------------------------*/
/* Validate first parameter:                                           */
/*    must be Left or Right                                            */
/*---------------------------------------------------------------------*/
 if (equal((CHARTYPE *)"left",word[0],1))
     shift_left = TRUE;
 else if (equal((CHARTYPE *)"right",word[0],1))
     shift_left = FALSE;
 else 
   {
    display_error(1,word[0],FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
/*---------------------------------------------------------------------*/
/* Validate second parameter (if there is one)                         */
/*    If present, must be valid positive integer.                      */
/*    If not present, default to 1.                                    */
/*---------------------------------------------------------------------*/
 if (num_params < 2)
    num_cols = 1;
 else
   {
    if (!valid_positive_integer(strtrunc(word[1])))
      {
       display_error(4,word[1],FALSE);
#ifdef THE_TRACE
       trace_return();
#endif
       return(RC_INVALID_OPERAND);
      }
    num_cols = atoi((DEFCHAR *)word[1]);
   }
/*---------------------------------------------------------------------*/
/* Validate third  parameter (if there is one)                         */
/*    If present, must be valid target.                                */
/*    If not present, default to 1.                                    */
/*---------------------------------------------------------------------*/
 if (num_params < 3)                                      /* no target */
   {
    num_lines = 1L;
    true_line = get_true_line(TRUE);
   }
 else
   {
    initialise_target(&target);
    if ((rc = validate_target(word[2],&target,target_type,get_true_line(TRUE),TRUE,TRUE)) != RC_OK)
      {
       free_target(&target);
#ifdef THE_TRACE
       trace_return();
#endif
       return(rc);
      }
    if (target.rt[0].target_type == TARGET_BLOCK_CURRENT)
      {
       if (MARK_VIEW->mark_type == M_STREAM
       &&  target.num_lines > 1)
         {
          display_error(62,(CHARTYPE*)"",FALSE);
#ifdef THE_TRACE
          trace_return();
#endif
          return(RC_INVALID_OPERAND);
         }
      }
    num_lines = target.num_lines;
    true_line = target.true_line;
    save_target_type = target.rt[0].target_type;
    num_lines_based_on_scope = (save_target_type == TARGET_BLOCK_CURRENT) ? FALSE : TRUE;
    free_target(&target);
   }
/*---------------------------------------------------------------------*/
/* Now we are here, everything's OK, do the actual shift...            */
/*---------------------------------------------------------------------*/
 rc = execute_shift_command(shift_left,num_cols,true_line,num_lines,num_lines_based_on_scope,save_target_type,FALSE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     showkey - display current key value and command assignation

SYNTAX
     SHOWkey [ALL]

DESCRIPTION

     With no parameter, the SHOWKEY command prompts the user to enter 
     a key and responds with the key name and associated command 
     (if applicable).
     To exit from SHOWKEY, press the space bar.

     With 'ALL' specified, a new file is added to the <ring> with all
     default key mappings and any key mappings assigned with the <DEFINE> 
     command shown.  The key mappings are displayed as <DEFINE> commands.

COMPATIBILITY
     XEDIT: N/A
     KEDIT: N/A

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short ShowKey(CHARTYPE *params)
#else
short ShowKey(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 int key=0;
 short rc=RC_OK;
 bool mouse_key=FALSE;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   ShowKey");
#endif
/*---------------------------------------------------------------------*/
/* If no arguments, show key definitions as prompted.                  */
/*---------------------------------------------------------------------*/
 if (strcmp((DEFCHAR *)params,"") == 0)
   {
    display_prompt((CHARTYPE *)"Press the key to be translated...spacebar to exit");
    key = 0;
    while(key != ' ')
      {
       while(1)
         {
#ifdef CAN_RESIZE
          if (is_termresized())
            {
             (void)THE_Resize(0,0);
             (void)THERefresh((CHARTYPE *)"");
            }
#endif
          key = my_getch(stdscr);
#if defined(XCURSES)
          if (key == KEY_SF || key == KEY_SR)
             continue;
#endif
#ifdef CAN_RESIZE
          if (is_termresized())
             continue;
#endif     
#if defined(PDCURSES_MOUSE_ENABLED) || defined(NCURSES_MOUSE_VERSION)
          if (key == KEY_MOUSE)
            {
             int b,ba,bm,w;
             CHARTYPE scrn;
             if (get_mouse_info(&b,&ba,&bm) != RC_OK)
                continue;
             which_window_is_mouse_in(&scrn,&w);
             mouse_key = TRUE;
             key = mouse_info_to_key(w,b,ba,bm);
            }
          else
             mouse_key = FALSE;
#endif
          break;
         }
       clear_msgline(-1);
       display_prompt(get_key_definition(key,FALSE,TRUE,mouse_key));
      }
    clear_msgline(-1);
   }
 else
/*---------------------------------------------------------------------*/
/* If an argument, it must be ALL.                                     */
/*---------------------------------------------------------------------*/
   {
    if (equal((CHARTYPE *)"all",params,3))
       rc = display_all_keys();
    else
      {
       display_error(1,(CHARTYPE *)params,FALSE);
       rc = RC_INVALID_OPERAND;
      }
   }
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     sort - sort selected lines in a file

SYNTAX
     SORT target [[sort field 1] [...] [sort field 10]]

DESCRIPTION
     The SORT command sort a portion of a file based on the 'sort field'
     specifications.

     A 'sort field' specification consists of:

          order flag   - [Ascending|Descending]
          left column  - left column of field to sort on
          right column - right column of field to sort on

     The right column MUST be >= left column.

     Only 10 sort fields are allowed.

     <'target'> can be any valid target including ALL, *, -*, and BLOCK.

COMPATIBILITY
     XEDIT: XEDIT only allows ordering flag for all fields
     KEDIT: Compatible.

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Sort(CHARTYPE *params)
#else
short Sort(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Sort");
#endif
 post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
 rc = execute_sort(params);
 pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
 build_screen(current_screen); 
 display_screen(current_screen);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     sos - execute various sos commands

SYNTAX
     SOS sos_command [sos_command ...]

DESCRIPTION
     The SOS command is a front end to existing <SOS> commands. It treats
     each parameter it receives as a command and executes it.

     The SOS command will execute each command until the list of commands
     has been exhausted, or until one of the commands returns a non-zero
     return code.

COMPATIBILITY
     XEDIT: XEDIT only permits 1 command
     KEDIT: Compatible.

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Sos(CHARTYPE *params)
#else
short Sos(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 register short i=0;
#define SOS_PARAMS  10
 CHARTYPE strip[SOS_PARAMS];
 CHARTYPE *word[SOS_PARAMS+1];
 short num_params=0;
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Sos");
#endif
 strip[0]=STRIP_BOTH;
 strip[1]=STRIP_BOTH;
 strip[2]=STRIP_BOTH;
 strip[3]=STRIP_BOTH;
 strip[4]=STRIP_BOTH;
 strip[5]=STRIP_BOTH;
 strip[6]=STRIP_BOTH;
 strip[7]=STRIP_BOTH;
 strip[8]=STRIP_BOTH;
 strip[9]=STRIP_BOTH;
 num_params = param_split(params,word,SOS_PARAMS,WORD_DELIMS,TEMP_TMP_CMD,strip,FALSE);
 if (num_params == 0)                                     /* no params */
   {
    display_error(3,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
/*---------------------------------------------------------------------*/
/* For each "command" go an execute it.                                */
/*---------------------------------------------------------------------*/
 for (i=0;i<num_params;i++)
   {
    if ((rc = execute_set_sos_command(FALSE,word[i])) != RC_OK)
       break;
   }
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     split - split a line into two lines

SYNTAX
     SPlit [ALigned] [Column|CURSOR]

DESCRIPTION
     The SPLIT command splits the <focus line> into two lines.

     If 'Aligned' is specified, the first non-blank character of the new
     line is positioned under the first non-blank character of the
     <focus line>. 

     If 'Aligned' is not specified, the text of the new line starts in 
     column 1.

     If 'Column' (the default) is specified, the current line is split at 
     the current column location.

     If 'CURSOR' is specified, the focus line is split at the cursor
     position.

COMPATIBILITY
     XEDIT: Compatible.
            Does not support Before/After/Colno options
     KEDIT: Compatible.

SEE ALSO
     <JOIN>, <SPLTJOIN>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Split(CHARTYPE *params)
#else
short Split(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
#define SPT_PARAMS  2
 CHARTYPE *word[SPT_PARAMS+1];
 CHARTYPE strip[SPT_PARAMS];
 unsigned short num_params=0;
 short rc=RC_OK;
 bool aligned=FALSE;
 bool cursorarg=FALSE;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Split");
#endif
/*---------------------------------------------------------------------*/
/* Split parameters up...                                              */
/*---------------------------------------------------------------------*/
 strip[0]=STRIP_BOTH;
 strip[1]=STRIP_BOTH;
 num_params = param_split(params,word,SPT_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
 if (num_params == 0)
   {
    aligned = FALSE;
    cursorarg = FALSE;
   }
 else
   {
    if (equal((CHARTYPE *)"aligned",word[0],2))
      {
       aligned = TRUE;
       if (equal((CHARTYPE *)"cursor",word[1],6))
         {
          cursorarg = TRUE;
         }
       else
         {
          if (equal((CHARTYPE *)"column",word[1],1))
            {
             cursorarg = FALSE;
            }
          else
            {
             display_error(1,(CHARTYPE *)word[1],FALSE);
#ifdef THE_TRACE
             trace_return();
#endif
             return(RC_INVALID_ENVIRON);
            }
         }
      }
    else
      {
       if (equal((CHARTYPE *)"cursor",word[0],6))
         {
          aligned = FALSE;
          cursorarg = TRUE;
         }
       else
         {
          if (equal((CHARTYPE *)"column",word[0],1))
            {
             aligned = FALSE;
             cursorarg = FALSE;
            }
          else
            {
             display_error(1,(CHARTYPE *)word[0],FALSE);
#ifdef THE_TRACE
             trace_return();
#endif
             return(RC_INVALID_ENVIRON);
            }
         }
      }
   }
 rc = execute_split_join(SPLTJOIN_SPLIT,aligned,cursorarg);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     spltjoin - split/join two lines

SYNTAX
     spltjoin

DESCRIPTION
     The SPLTJOIN command splits the <focus line> into two or joins the
     <focus line> with the next line depending on the position of the
     cursor. 

     If the cursor is after the last column of a line, the <JOIN>
     command is executed, otherwise the <SPLIT> command is executed.

     The text in the new line is aligned with the text in the <focus line>.

     This command can only be used by assigning it to a function key.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible.

SEE ALSO
     <JOIN>, <SPLIT>

STATUS
     Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Spltjoin(CHARTYPE *params)
#else
short Spltjoin(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Spltjoin");
#endif
 rc = execute_split_join(SPLTJOIN_SPLTJOIN,TRUE,TRUE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     ssave - force SAVE to specified file

SYNTAX
     SSave [filename]

DESCRIPTION
     The SSAVE command writes the current file to disk. If a 'filename' is
     supplied, the current file is saved in that file, otherwise the
     current name of the file is used.

     If a 'filename' is supplied and that 'filename' already exists, 
     the previous contents of that 'filename' will be replaced with the 
     current file.

     Both 'Alterations' counters on the <idline> are reset to zero.

COMPATIBILITY
     XEDIT: N/A
     KEDIT: Compatible.

SEE ALSO
     <SAVE>, <FILE>, <FFILE>

STATUS
     Complete
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Ssave(CHARTYPE *params)
#else
short Ssave(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Ssave");
#endif
 post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
 if ((rc = save_file(CURRENT_FILE,params,TRUE,CURRENT_FILE->number_lines,1L,NULL,FALSE,0,max_line_length,TRUE,FALSE,FALSE)) != RC_OK)
   {
#ifdef THE_TRACE
    trace_return();
#endif
    return(rc);
   }
/*---------------------------------------------------------------------*/
/* Only set the alteration count to zero if save was successful.       */
/*---------------------------------------------------------------------*/
 CURRENT_FILE->autosave_alt = CURRENT_FILE->save_alt = 0;
/*---------------------------------------------------------------------*/
/* If autosave is on at the time of SSaving, remove the .aus file...   */
/*---------------------------------------------------------------------*/
 if (CURRENT_FILE->autosave > 0)
    rc = remove_aus_file(CURRENT_FILE);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     status - display current settings of various variables

SYNTAX
     STATus [filename]

DESCRIPTION
     The STATUS command, without the optional 'filename', displays a full
     screen of current settings for various variables. 

     With the 'filename', the STATUS command creates a file containing a
     series of <SET> commands with the current values of these settings.

COMPATIBILITY
     XEDIT: Compatible.
     KEDIT: Compatible. KEDIT does not support ['filename'] option.

SEE ALSO
     <QUERY>, <EXTRACT>, <MODIFY>

STATUS
     Complete
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Status(CHARTYPE *params)
#else
short Status(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
 int key=0;
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Status");
#endif
 if (strcmp((DEFCHAR *)params,"") == 0)
   {
    if (batch_only)
      {
       display_error(24,(CHARTYPE *)"status",FALSE);
       rc = RC_INVALID_ENVIRON;
      }
    else
      {
       rc = show_status();
       while(1)
         {
#ifdef CAN_RESIZE
          if (is_termresized())
            {
             (void)THE_Resize(0,0);
             (void)show_status();
            }
#endif
          key = my_getch(stdscr);
#if defined(XCURSES)
          if (key == KEY_SF || key == KEY_SR)
             continue;
#endif
#if defined(KEY_MOUSE)
          if (key == KEY_MOUSE)
             continue;
#endif
#ifdef CAN_RESIZE
          if (is_termresized())
             continue;
#endif     
          break;
         }
       THERefresh((CHARTYPE *)"");
       restore_THE();
      }
   }
 else
    rc = save_status(params);
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}
/*man-start*********************************************************************
COMMAND
     suspend - suspend THE and return to operating system

SYNTAX
     SUSPend

DESCRIPTION
     The SUSPEND command suspends the current editing session and 
     returns control to the operating system. Under DOS and OS/2 this
     is the equivalent of <OSNOWAIT>. Under UNIX, the process gets placed
     in the background until it is brought to the foreground.

COMPATIBILITY
     XEDIT: N/A
     KEDIT: N/A

SEE ALSO
     <OSNOWAIT>

STATUS
     Complete
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Suspend(CHARTYPE *params)
#else
short Suspend(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
 short rc=RC_OK;
#if defined(UNIX) && !defined(XCURSES)
 void (*func)();
#endif
/*--------------------------- processing ------------------------------*/
#ifdef THE_TRACE
 trace_function("comm4.c:   Suspend");
#endif
 if (strcmp((DEFCHAR *)params,"") != 0)
   {
    display_error(2,params,FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
#if defined(UNIX) && !defined(XCURSES)
 if (strcmp("/bin/sh",getenv("SHELL")) == 0)
   {
    display_error(40,(CHARTYPE *)"",FALSE);
#ifdef THE_TRACE
    trace_return();
#endif
    return(RC_INVALID_OPERAND);
   }
 suspend_curses();
 func = signal(SIGTSTP,SIG_DFL);
 kill(0,SIGTSTP);
 signal(SIGTSTP,func);
 resume_curses();
 Redraw((CHARTYPE *)"");
#else
 rc = execute_os_command(params,FALSE,FALSE);
#endif
#ifdef THE_TRACE
 trace_return();
#endif
 return(rc);
}