1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* collate.h
*
* MKS extension to ANSI/POSIX to retrieve additional locale information.
* Specifically collation information.
*
* Copyright 1989, 1993 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/collate.h 1.16 1993/12/02 21:54:23 mark Exp $
*/
#ifndef __COLLATE_H__
#define __COLLATE_H__
#include <mks.h>
#include <limits.h>
/*
* include prototypes of the MKS i18n routines
*/
#include <m_collat.h>
/*
* constants and structure definitions used in MKS internal implementation
*
* -- used by strxfrm(), localedef.
*/
/* string length limitations */
#define _M_COLLATE_MAX 32 /* max length of a collation string */
#define _M_COTOM_MAX 4 /* max length of one to many map */
/* forward, backward... -- or'ed into cmode */
#define _M_FORWARD_MODE 1 /* compare based on string forward */
#define _M_BACKWARD_MODE 2 /* compare based on string backward */
#define _M_POSITION_MODE 4 /* consider relative position of non-IGNOREd */
/* flags used in cord.cflag */
#define _M_NOCOLLSTR 0
#define _M_MANYTOONEF 1 /* Potential many-to-one mapping in forward */
#define _M_MANYTOONEB 2 /* Potential many-to-one mapping in backward */
/* typedef's */
typedef short _m_weight_t;
/* collate database file header */
struct _m_cinfo {
int cnstr; /* number of collate strings */
int cnotom; /* number of one to many maps */
int cnweight; /* Number of weights in cmode */
unsigned char cmode[COLL_WEIGHTS_MAX];/* order mode: forward... */
struct _m_cstr *cstr; /* Pointer to collating strs */
struct _m_cord *cord; /* weight tables */
struct _m_cotom *cotom; /* one-to-many mapping tables */
m_collel_t *cindex, /* index to range table map */
*range; /* Range table */
m_collel_t *equivo, /* equiv class offsets */
*cequiv; /* equiv class table */
};
/* Per character and per collating-sequence structure */
struct _m_cord { /* order */
unsigned char cflag; /* =1, beginning of a collation string */
_m_weight_t cweight[COLL_WEIGHTS_MAX]; /* relative weight */
};
/*l
* The _m_cstr structure is per many-to-one mapping (collating element from...)
* Pointed at by _m_cinfo.cstr, indexed by (m_collel_t - M_CSETSIZE).
* Stored both forwards and backwards to make it easy for strxfrm parsing
* for order_start backward.
*/
struct _m_cstr { /* collating-element */
char csf[_M_COLLATE_MAX]; /* collating string forward */
char csb[_M_COLLATE_MAX]; /* collating string backward */
};
/*l
* Per one-to-many mapping entry. A cweight entry in the _cord structure
* which is negative, will index into this table.
* Pointed at by _m_cinfo.cotom.
*/
struct _m_cotom { /* one to many map */
_m_weight_t weight[_M_COTOM_MAX];
};
#ifdef I18N
extern struct _m_cinfo _m_cinfo;
#endif /* I18N */
#endif /* __COLLATE_H_ */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* curses.h
*
* XCurses Library
*
* Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
*
*/
#ifndef __M_CURSES_H__
#define __M_CURSES_H__
#define _XOPEN_CURSES
#include <stdio.h>
#include <term.h>
#include <unctrl.h>
#include <wchar.h>
#ifndef EOF
#define EOF (-1)
#endif
#ifndef WEOF
#define WEOF (-1)
#endif
/*
* Not all <wchar.h> are created equal.
*/
#ifndef _MBSTATE_T
#define _MBSTATE_T
typedef int mbstate_t;
#endif
#define ERR EOF
#define OK 0
#if !(defined(__cplusplus) && defined(_BOOL))
typedef short bool;
#endif
#define TRUE 1
#define FALSE 0
typedef unsigned short attr_t;
/*
* These attributes and masks can be applied to an attr_t.
* These are ordered according to the <no_color_video> mask,
* which has been extended to include additional attributes.
*/
#define WA_NORMAL 0x0
#define WA_STANDOUT 0x0001
#define WA_UNDERLINE 0x0002
#define WA_REVERSE 0x0004
#define WA_BLINK 0x0008
#define WA_DIM 0x0010
#define WA_BOLD 0x0020
#define WA_INVIS 0x0040
#define WA_PROTECT 0x0080
#define WA_ALTCHARSET 0x0100
#define WA_HORIZONTAL 0x0200
#define WA_LEFT 0x0400
#define WA_LOW 0x0800
#define WA_RIGHT 0x1000
#define WA_TOP 0x2000
#define WA_VERTICAL 0x4000
#define WA_SGR_MASK 0x01ff /* Historical attribute set. */
#define WA_SGR1_MASK 0x7e00 /* Extended attribute set. */
/*
* Internal attribute used to support <ceol_standout_glitch>.
*/
#define WA_COOKIE 0x8000
/*
* Color names.
*/
#define COLOR_BLACK 0
#define COLOR_BLUE 1
#define COLOR_GREEN 2
#define COLOR_CYAN 3
#define COLOR_RED 4
#define COLOR_MAGENTA 5
#define COLOR_YELLOW 6
#define COLOR_WHITE 7
/*
* A cchar_t details the attributes, color, and a string of wide characters
* composing a complex character (p12). The wide character string consists
* of a spacing character (wcwidth() > 0) and zero or more non-spacing
* characters. Xcurses (p17) states that the minimum number of non-spacing
* characters associated with a spacing character must be at least 5, if a
* limit is imposed.
*/
#define M_CCHAR_MAX 6
/***
*** Opaque data type. Keep your grubby mits off.
***/
typedef struct {
short _f; /* True if start of character. */
short _n; /* Number of elements in wc[]. */
short _co; /* Color pair number. */
attr_t _at; /* Attribute flags. */
wchar_t _wc[M_CCHAR_MAX]; /* Complex spacing character. */
} cchar_t;
/***
*** Opaque data type. Keep your grubby mits off.
***/
typedef struct window_t {
cchar_t _bg; /* Background. */
cchar_t _fg; /* Foreground, ignore character. */
short _cury, _curx; /* Curent cursor position in window. */
short _begy, _begx; /* Upper-left origin on screen. */
short _maxy, _maxx; /* Window dimensions. */
short _top, _bottom; /* Window's software scroll region. */
short _refy, _refx; /* Pad origin of last refresh. */
short _sminy, _sminx; /* T-L screen corner of last refresh. */
short _smaxy, _smaxx; /* B-R screen corner of last refresh. */
short _vmin, _vtime; /* wtimeout() control. */
short *_first, *_last; /* Dirty region for each screen line. */
unsigned short _flags; /* Internal flags for the window. */
unsigned short _scroll; /* Internal for scroll optimization. */
cchar_t **_line;
cchar_t *_base; /* Block of M*N screen cells. */
struct window_t *_parent; /* Parent of sub-window. */
} WINDOW;
/***
*** Opaque data type. Keep your grubby mits off.
***/
typedef struct {
int _kfd; /* typeahead() file descriptor. */
FILE *_if, *_of; /* I/O file pointers. */
TERMINAL *_term; /* Associated terminfo entry. */
WINDOW *_newscr; /* New screen image built by wnoutrefresh(). */
WINDOW *_curscr; /* Current screen image after doupdate(). */
mbstate_t _state; /* Current multibyte state of _of. */
unsigned long *_hash; /* Hash values for curscr's screen lines. */
unsigned short _flags; /* Assorted flags. */
void *_decode; /* Function key decode tree. */
void *_in; /* Wide I/O object. */
struct {
int _size; /* Allocated size of the input stack. */
int _count; /* Number of entries on the input stack. */
int *_stack; /* Buffer used for the input stack. */
} _unget;
struct {
WINDOW *_w; /* Exists on if emulating soft label keys. */
char *_labels[8]; /* Soft label key strings. */
short _justify[8]; /* Justification for label. */
} _slk;
} SCREEN;
#ifndef __M_UNCTRL_H__
/*
* Backwards compatiblity with historical Curses applications.
*/
typedef unsigned long chtype;
#endif
/*
* These attributes and masks can be applied to a chtype.
* They are order according to the <no_color_video> mask.
*/
#define A_NORMAL 0x00000000L
#define A_ATTRIBUTES 0xffff0000L /* Color/Attribute mask */
#define A_CHARTEXT 0x0000ffffL /* 16-bit character mask */
#define A_COLOR 0xfe000000L /* Colour mask, see __COLOR_SHIFT */
#define A_STANDOUT 0x00010000L
#define A_UNDERLINE 0x00020000L
#define A_REVERSE 0x00040000L
#define A_BLINK 0x00080000L
#define A_DIM 0x00100000L
#define A_BOLD 0x00200000L
#define A_INVIS 0x00400000L
#define A_PROTECT 0x00800000L
#define A_ALTCHARSET 0x01000000L
/*
* Colour atttribute support for chtype.
*/
#define __COLOR_SHIFT 26
/*
* Characters constants used with a chtype.
* Mapping defined in Xcurses Section 6.2.12 (p260).
*/
#define ACS_VLINE (A_ALTCHARSET | 'x')
#define ACS_HLINE (A_ALTCHARSET | 'q')
#define ACS_ULCORNER (A_ALTCHARSET | 'l')
#define ACS_URCORNER (A_ALTCHARSET | 'k')
#define ACS_LLCORNER (A_ALTCHARSET | 'm')
#define ACS_LRCORNER (A_ALTCHARSET | 'j')
#define ACS_RTEE (A_ALTCHARSET | 'u')
#define ACS_LTEE (A_ALTCHARSET | 't')
#define ACS_BTEE (A_ALTCHARSET | 'v')
#define ACS_TTEE (A_ALTCHARSET | 'w')
#define ACS_PLUS (A_ALTCHARSET | 'n')
#define ACS_S1 (A_ALTCHARSET | 'o')
#define ACS_S9 (A_ALTCHARSET | 's')
#define ACS_DIAMOND (A_ALTCHARSET | '`')
#define ACS_CKBOARD (A_ALTCHARSET | 'a')
#define ACS_DEGREE (A_ALTCHARSET | 'f')
#define ACS_PLMINUS (A_ALTCHARSET | 'g')
#define ACS_BULLET (A_ALTCHARSET | '~')
#define ACS_LARROW (A_ALTCHARSET | ',')
#define ACS_RARROW (A_ALTCHARSET | '+')
#define ACS_DARROW (A_ALTCHARSET | '.')
#define ACS_UARROW (A_ALTCHARSET | '-')
#define ACS_BOARD (A_ALTCHARSET | 'h')
#define ACS_LANTERN (A_ALTCHARSET | 'I')
#define ACS_BLOCK (A_ALTCHARSET | '0')
#ifndef _XOPEN_SOURCE
/*
* MKS Extensions for double width box characters.
*/
#define ACS_DVLINE ACS_VLINE
#define ACS_DHLINE ACS_HLINE
#define ACS_DULCORNER ACS_ULCORNER
#define ACS_DURCORNER ACS_URCORNER
#define ACS_DLLCORNER ACS_LLCORNER
#define ACS_DLRCORNER ACS_LRCORNER
#define ACS_DRTEE ACS_RTEE
#define ACS_DLTEE ACS_LTEE
#define ACS_DBTEE ACS_BTEE
#define ACS_DTTEE ACS_TTEE
#endif /* _XOPEN_SOURCE */
/*
* Wide characters constants for a cchar_t.
*/
extern const cchar_t __WACS_VLINE;
extern const cchar_t __WACS_HLINE;
extern const cchar_t __WACS_ULCORNER;
extern const cchar_t __WACS_URCORNER;
extern const cchar_t __WACS_LLCORNER;
extern const cchar_t __WACS_LRCORNER;
extern const cchar_t __WACS_RTEE;
extern const cchar_t __WACS_LTEE;
extern const cchar_t __WACS_BTEE;
extern const cchar_t __WACS_TTEE;
extern const cchar_t __WACS_PLUS;
extern const cchar_t __WACS_S1;
extern const cchar_t __WACS_S9;
extern const cchar_t __WACS_DIAMOND;
extern const cchar_t __WACS_CKBOARD;
extern const cchar_t __WACS_DEGREE;
extern const cchar_t __WACS_PLMINUS;
extern const cchar_t __WACS_BULLET;
extern const cchar_t __WACS_LARROW;
extern const cchar_t __WACS_RARROW;
extern const cchar_t __WACS_DARROW;
extern const cchar_t __WACS_UARROW;
extern const cchar_t __WACS_BOARD;
extern const cchar_t __WACS_LANTERN;
extern const cchar_t __WACS_BLOCK;
#define WACS_VLINE &__WACS_VLINE
#define WACS_HLINE &__WACS_HLINE
#define WACS_ULCORNER &__WACS_ULCORNER
#define WACS_URCORNER &__WACS_URCORNER
#define WACS_LLCORNER &__WACS_LLCORNER
#define WACS_LRCORNER &__WACS_LRCORNER
#define WACS_RTEE &__WACS_RTEE
#define WACS_LTEE &__WACS_LTEE
#define WACS_BTEE &__WACS_BTEE
#define WACS_TTEE &__WACS_TTEE
#define WACS_PLUS &__WACS_PLUS
#define WACS_S1 &__WACS_S1
#define WACS_S9 &__WACS_S9
#define WACS_DIAMOND &__WACS_DIAMOND
#define WACS_CKBOARD &__WACS_CKBOARD
#define WACS_DEGREE &__WACS_DEGREE
#define WACS_PLMINUS &__WACS_PLMINUS
#define WACS_BULLET &__WACS_BULLET
#define WACS_LARROW &__WACS_LARROW
#define WACS_RARROW &__WACS_RARROW
#define WACS_DARROW &__WACS_DARROW
#define WACS_UARROW &__WACS_UARROW
#define WACS_BOARD &__WACS_BOARD
#define WACS_LANTERN &__WACS_LANTERN
#define WACS_BLOCK &__WACS_BLOCK
#ifndef _XOPEN_SOURCE
/*
* MKS Extensions for double width box characters.
*/
#define WACS_DVLINE WACS_VLINE
#define WACS_DHLINE WACS_HLINE
#define WACS_DULCORNER WACS_ULCORNER
#define WACS_DURCORNER WACS_URCORNER
#define WACS_DLLCORNER WACS_LLCORNER
#define WACS_DLRCORNER WACS_LRCORNER
#define WACS_DRTEE WACS_RTEE
#define WACS_DLTEE WACS_LTEE
#define WACS_DBTEE WACS_BTEE
#define WACS_DTTEE WACS_TTEE
#endif /* _XOPEN_SOURCE */
/*
* Internal functions.
*/
extern int __m_outc(int);
extern int __m_tty_wc(int, wchar_t *);
extern int __m_chtype_cc(chtype, cchar_t *);
extern chtype __m_cc_chtype(const cchar_t *);
extern int __m_copywin(const WINDOW *, WINDOW *, int);
extern WINDOW *__m_newwin(WINDOW *, int, int, int, int);
/*
* Internal macros.
*/
#define __m_getpary(w) ((w)->_parent == (WINDOW *) 0 ? -1 \
: (w)->_begy - (w)->_parent->_begy)
#define __m_getparx(w) ((w)->_parent == (WINDOW *) 0 ? -1 \
: (w)->_begx - (w)->_parent->_begx)
/*
* Global Window Macros
*/
#define getyx(w,y,x) (y = (w)->_cury, x = (w)->_curx)
#define getbegyx(w,y,x) (y = (w)->_begy, x = (w)->_begx)
#define getmaxyx(w,y,x) (y = (w)->_maxy, x = (w)->_maxx)
#define getparyx(w,y,x) (y = __m_getpary(w), x = __m_getparx(w))
/*
* Global variables
*/
extern int LINES, COLS;
extern int COLORS, COLOR_PAIRS;
extern WINDOW *curscr, *stdscr;
#ifndef _XOPEN_SOURCE
/*
* Non-portable extension functions.
*/
extern int wistombs(char *, const wint_t *, int);
extern int wistowcs(wchar_t *, const wint_t *, int);
#endif /* _XOPEN_SOURCE */
#ifdef M_CURSES_TRACE
/*
* Curses trace facility is only available with a version of
* the library that was compiled with -DM_CURSES_TRACE.
*/
extern void traceoff(void);
extern void traceon(void);
#endif /* M_CURSES_TRACE */
extern int addch(chtype);
extern int addchnstr(const chtype *, int);
extern int addchstr(const chtype *);
extern int add_wch(const cchar_t *);
extern int add_wchnstr(const cchar_t *, int);
extern int add_wchstr(const cchar_t *);
extern int mvaddch(int, int, chtype);
extern int mvaddchnstr(int, int, const chtype *, int);
extern int mvaddchstr(int, int, const chtype *);
extern int mvadd_wch(int, int, const cchar_t *);
extern int mvadd_wchnstr(int, int, const cchar_t *, int);
extern int mvadd_wchstr(int, int, const cchar_t *);
extern int mvwaddch(WINDOW *, int, int, chtype);
extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
extern int mvwaddchstr(WINDOW *, int, int, const chtype *);
extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *);
extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int);
extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);
extern int waddch(WINDOW *, chtype);
extern int waddchnstr(WINDOW *, const chtype *, int);
extern int waddchstr(WINDOW *, const chtype *);
extern int wadd_wch(WINDOW *, const cchar_t *);
extern int wadd_wchnstr(WINDOW *, const cchar_t *, int);
extern int wadd_wchstr(WINDOW *, const cchar_t *);
extern int addnstr(const char *, int);
extern int addstr(const char *);
extern int addnwstr(const wchar_t *, int);
extern int addwstr(const wchar_t *);
extern int mvaddnstr(int, int, const char *, int);
extern int mvaddstr(int, int, const char *);
extern int mvaddnwstr(int, int, const wchar_t *, int);
extern int mvaddwstr(int, int, const wchar_t *);
extern int mvwaddnstr(WINDOW *, int, int, const char *, int);
extern int mvwaddstr(WINDOW *, int, int, const char *);
extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
extern int waddnstr(WINDOW *, const char *, int);
extern int waddstr(WINDOW *, const char *);
extern int waddnwstr(WINDOW *, const wchar_t *, int);
extern int waddwstr(WINDOW *, const wchar_t *);
extern int attroff(int);
extern int attron(int);
extern int attrset(int);
extern int wattroff(WINDOW *, int);
extern int wattron(WINDOW *, int);
extern int wattrset(WINDOW *, int);
extern int attr_get(attr_t *, short *, void *);
extern int attr_off(attr_t, void *);
extern int attr_on(attr_t, void *);
extern int attr_set(attr_t, short, void *);
extern int color_set(short, void *);
extern int wattr_get(WINDOW *, attr_t *, short *, void *);
extern int wattr_off(WINDOW *, attr_t, void *);
extern int wattr_on(WINDOW *, attr_t, void *);
extern int wattr_set(WINDOW *, attr_t, short, void *);
extern int wcolor_set(WINDOW *, short, void *);
extern chtype COLOR_PAIR(short);
extern short PAIR_NUMBER(chtype);
extern int baudrate(void);
extern int delay_output(int);
extern int napms(int);
extern int beep(void);
extern int flash(void);
extern int bkgd(chtype);
extern int bkgdset(chtype);
extern chtype getbkgd(WINDOW *);
extern int wbkgd(WINDOW *, chtype);
extern int wbkgdset(WINDOW *, chtype);
extern int bkgrnd(const cchar_t *);
extern void bkgrndset(const cchar_t *);
extern int getbkgrnd(cchar_t *);
extern int wbkgrnd(WINDOW *, const cchar_t *);
extern void wbkgrndset(WINDOW *, const cchar_t *);
extern int wgetbkgrnd(WINDOW *, cchar_t *);
extern int border(
chtype, chtype, chtype, chtype,
chtype, chtype, chtype, chtype);
extern int border_set(
const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *);
extern int box(WINDOW *, chtype, chtype);
extern int box_set(WINDOW *, const cchar_t *, const cchar_t *);
extern int wborder(
WINDOW *,
chtype, chtype, chtype, chtype,
chtype, chtype, chtype, chtype);
extern int wborder_set(
WINDOW *,
const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *);
extern bool can_change_color(void);
extern int color_content(short, short *, short *, short *);
extern bool has_colors(void);
extern int init_color(short, short, short, short);
extern int init_pair(short, short, short);
extern int pair_content(short, short *, short *);
extern int start_color(void);
extern int cbreak(void);
extern int halfdelay(int);
extern int nocbreak(void);
extern int raw(void);
extern int noraw(void);
extern int chgat(int, attr_t, short, const void *);
extern int mvchgat(int, int, int, attr_t, short, const void *);
extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
extern int wchgat(WINDOW *, int, attr_t, short, const void *);
extern int clear(void);
extern int clrtobot(void);
extern int clrtoeol(void);
extern int erase(void);
extern int wclear(WINDOW *);
extern int wclrtobot(WINDOW *);
extern int wclrtoeol(WINDOW *);
extern int werase(WINDOW *);
extern int clearok(WINDOW *, bool);
extern void idcok(WINDOW *, bool);
extern int idlok(WINDOW *, bool);
extern void immedok(WINDOW *, bool);
extern int intrflush(WINDOW *, bool);
extern int keypad(WINDOW *, bool);
extern int leaveok(WINDOW *, bool);
extern int meta(WINDOW *, bool);
extern int nodelay(WINDOW *, bool);
extern int notimeout(WINDOW *, bool);
extern int scrollok(WINDOW *, bool);
extern int syncok(WINDOW *, bool);
extern int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
extern int overlay(const WINDOW *, WINDOW *);
extern int overwrite(const WINDOW *, WINDOW *);
extern int curs_set(int);
extern int def_prog_mode(void);
extern int def_shell_mode(void);
extern int reset_prog_mode(void);
extern int reset_shell_mode(void);
extern int delch(void);
extern int mvdelch(int, int);
extern int mvwdelch(WINDOW *, int, int);
extern int wdelch(WINDOW *);
extern int deleteln(void);
extern int insdelln(int);
extern int insertln(void);
extern int wdeleteln(WINDOW *);
extern int winsdelln(WINDOW *, int);
extern int winsertln(WINDOW *);
extern void delscreen(SCREEN *);
extern SCREEN *newterm(char *, FILE *, FILE *);
extern SCREEN *set_term(SCREEN *);
extern int delwin(WINDOW *);
extern WINDOW *derwin(WINDOW *, int, int, int, int);
extern WINDOW *dupwin(WINDOW *);
extern WINDOW *getwin(FILE *);
extern int mvwin(WINDOW *, int, int);
extern int mvderwin(WINDOW *, int, int);
extern WINDOW *newwin(int, int, int, int);
extern int putwin(WINDOW *, FILE *);
extern int redrawwin(WINDOW *);
extern WINDOW *subwin(WINDOW *, int, int, int, int);
extern int wredrawln(WINDOW *, int, int);
extern int doupdate(void);
extern int refresh(void);
extern int wnoutrefresh(WINDOW *);
extern int wrefresh(WINDOW *);
extern int echo(void);
extern int noecho(void);
extern int echochar(chtype);
extern int echo_wchar(const cchar_t *);
extern int wechochar(WINDOW *, chtype);
extern int wecho_wchar(WINDOW *, const cchar_t *);
extern int endwin(void);
extern void filter(void);
extern WINDOW *initscr(void);
extern bool isendwin(void);
extern int ripoffline(int, int (*)(WINDOW *, int));
extern int typeahead(int);
extern void use_env(bool);
extern int erasechar(void);
extern int erasewchar(wchar_t *);
extern int killchar(void);
extern int killwchar(wchar_t *);
extern int flushinp(void);
extern int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *);
extern int setcchar(cchar_t *, const wchar_t *, attr_t, short, const void *);
extern int getch(void);
extern int get_wch(wint_t *);
extern int mvgetch(int, int);
extern int mvget_wch(int, int, wint_t *);
extern int mvwgetch(WINDOW *, int, int);
extern int mvwget_wch(WINDOW *, int, int, wint_t *);
extern int wgetch(WINDOW *);
extern int wget_wch(WINDOW *, wint_t *);
extern int getnstr(char *, int);
extern int getstr(char *);
extern int mvgetnstr(int, int, char *, int);
extern int mvgetstr(int, int, char *);
extern int mvwgetnstr(WINDOW *, int, int, char *, int);
extern int mvwgetstr(WINDOW *, int, int, char *);
extern int wgetnstr(WINDOW *, char *, int);
extern int wgetstr(WINDOW *, char *);
extern int getn_wstr(wint_t *, int);
extern int get_wstr(wint_t *);
extern int mvgetn_wstr(int, int, wint_t *, int);
extern int mvget_wstr(int, int, wint_t *);
extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);
extern int mvwget_wstr(WINDOW *, int, int, wint_t *);
extern int wgetn_wstr(WINDOW *, wint_t *, int);
extern int wget_wstr(WINDOW *, wint_t *);
extern bool has_ic(void);
extern bool has_il(void);
extern int hline(chtype, int);
extern int hline_set(const cchar_t *, int);
extern int vline(chtype, int);
extern int vline_set(const cchar_t *, int);
extern int mvhline(int, int, chtype, int);
extern int mvhline_set(int, int, const cchar_t *, int);
extern int mvvline(int, int, chtype, int);
extern int mvvline_set(int, int, const cchar_t *, int);
extern int mvwhline(WINDOW *, int, int, chtype, int);
extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);
extern int mvwvline(WINDOW *, int, int, chtype, int);
extern int mvwvline_set(WINDOW *, int, int, const cchar_t *, int);
extern int whline(WINDOW *, chtype, int);
extern int whline_set(WINDOW *, const cchar_t *, int);
extern int wvline(WINDOW *, chtype, int);
extern int wvline_set(WINDOW *, const cchar_t *, int);
extern chtype inch(void);
extern int inchnstr(chtype *, int);
extern int inchstr(chtype *);
extern int in_wch(cchar_t *);
extern int in_wchnstr(cchar_t *, int);
extern int in_wchstr(cchar_t *);
extern chtype mvinch(int, int);
extern int mvinchnstr(int, int, chtype *, int);
extern int mvinchstr(int, int, chtype *);
extern int mvin_wch(int, int, cchar_t *);
extern int mvin_wchnstr(int, int, cchar_t *, int);
extern int mvin_wchstr(int, int, cchar_t *);
extern chtype mvwinch(WINDOW *, int, int);
extern int mvwinchnstr(WINDOW *, int, int, chtype *, int);
extern int mvwinchstr(WINDOW *, int, int, chtype *);
extern int mvwin_wch(WINDOW *, int, int, cchar_t *);
extern int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int);
extern int mvwin_wchstr(WINDOW *, int, int, cchar_t *);
extern chtype winch(WINDOW *);
extern int winchnstr(WINDOW *, chtype *, int);
extern int winchstr(WINDOW *, chtype *);
extern int win_wch(WINDOW *, cchar_t *);
extern int win_wchnstr(WINDOW *, cchar_t *, int);
extern int win_wchstr(WINDOW *, cchar_t *);
extern int innstr(char *, int);
extern int instr(char *);
extern int innwstr(wchar_t *, int);
extern int inwstr(wchar_t *);
extern int mvinnstr(int, int, char *, int);
extern int mvinstr(int, int, char *);
extern int mvinnwstr(int, int, wchar_t *, int);
extern int mvinwstr(int, int, wchar_t *);
extern int mvwinnstr(WINDOW *, int, int, char *, int);
extern int mvwinstr(WINDOW *, int, int, char *);
extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
extern int mvwinwstr(WINDOW *, int, int, wchar_t *);
extern int winnstr(WINDOW *, char *, int);
extern int winstr(WINDOW *, char *);
extern int winnwstr(WINDOW *, wchar_t *, int);
extern int winwstr(WINDOW *, wchar_t *);
extern int insch(chtype);
extern int ins_wch(const cchar_t *);
extern int mvinsch(int, int, chtype);
extern int mvins_wch(int, int, const cchar_t *);
extern int mvwinsch(WINDOW *, int, int, chtype);
extern int mvwins_wch(WINDOW *, int, int, const cchar_t *);
extern int winsch(WINDOW *, chtype);
extern int wins_wch(WINDOW *, const cchar_t *);
extern int insnstr(const char *, int);
extern int insstr(const char *);
extern int ins_nwstr(const wchar_t *, int);
extern int ins_wstr(const wchar_t *);
extern int mvinsnstr(int, int, const char *, int);
extern int mvinsstr(int, int, const char *);
extern int mvins_nwstr(int, int, const wchar_t *, int);
extern int mvins_wstr(int, int, const wchar_t *);
extern int mvwinsnstr(WINDOW *, int, int, const char *, int);
extern int mvwinsstr(WINDOW *, int, int, const char *);
extern int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
extern int winsnstr(WINDOW *, const char *, int);
extern int winsstr(WINDOW *, const char *);
extern int wins_nwstr(WINDOW *, const wchar_t *, int);
extern int wins_wstr(WINDOW *, const wchar_t *);
extern bool is_linetouched(WINDOW *, int);
extern bool is_wintouched(WINDOW *);
extern int touchline(WINDOW *, int, int);
extern int touchwin(WINDOW *);
extern int wtouchln(WINDOW *, int, int, int);
extern int untouchwin(WINDOW *);
extern const char *keyname(int);
extern const char *key_name(wchar_t);
extern char *longname(void);
extern char *termname(void);
extern int move(int, int);
extern int wmove(WINDOW *, int, int);
extern int mvcur(int, int, int, int);
extern WINDOW *newpad(int, int);
extern int pechochar(WINDOW *, chtype);
extern int pecho_wchar(WINDOW *, const cchar_t *);
extern int pnoutrefresh(WINDOW *, int, int, int, int, int, int);
extern int prefresh(WINDOW *, int, int, int, int, int, int);
extern WINDOW *subpad(WINDOW *, int, int, int, int);
extern int nl(void);
extern int nonl(void);
extern int printw(const char *, ...);
extern int mvprintw(int, int, const char *, ...);
extern int mvwprintw(WINDOW *, int, int, const char *, ...);
#if defined(sun)
extern int vwprintw(WINDOW *, const char *, __va_list);
extern int vw_printw(WINDOW *, const char *, __va_list);
#else
extern int vwprintw(WINDOW *, const char *, void *);
extern int vw_printw(WINDOW *, const char *, void *);
#endif
extern int wprintw(WINDOW *, const char *, ...);
extern void qiflush(void);
extern void noqiflush(void);
extern int resetty(void);
extern int savetty(void);
extern int scanw(const char *, ...);
extern int mvscanw(int, int, const char *, ...);
extern int mvwscanw(WINDOW *, int, int, const char *, ...);
#if defined(sun)
extern int vwscanw(WINDOW *, const char *, __va_list);
extern int vw_scanw(WINDOW *, const char *, __va_list);
#else
extern int vwscanw(WINDOW *, const char *, void *);
extern int vw_scanw(WINDOW *, const char *, void *);
#endif
extern int wscanw(WINDOW *, const char *, ...);
extern int scr_dump(const char *);
extern int scr_init(const char *);
extern int scr_restore(const char *);
extern int scr_set(const char *);
extern int scrl(int);
extern int scroll(WINDOW *);
extern int setscrreg(int, int);
extern int wscrl(WINDOW *, int);
extern int wsetscrreg(WINDOW *, int, int);
extern int slk_attroff(const chtype);
extern int slk_attron(const chtype);
extern int slk_attrset(const chtype);
extern int slk_attr_off(const attr_t, void *);
extern int slk_attr_on(const attr_t, void *);
extern int slk_attr_set(const attr_t, short, void *);
extern int slk_color_set(short);
extern int slk_clear(void);
extern int slk_init(int);
extern char *slk_label(int);
extern int slk_noutrefresh(void);
extern int slk_refresh(void);
extern int slk_restore(void);
extern int slk_set(int, const char *, int);
extern int slk_touch(void);
extern int slk_wset(int, const wchar_t *, int);
extern int standend(void);
extern int wstandend(WINDOW *);
extern int standout(void);
extern int wstandout(WINDOW *);
extern chtype termattrs(void);
extern attr_t term_attrs(void);
extern void timeout(int);
extern void wtimeout(WINDOW *, int);
extern int ungetch(int);
extern int unget_wch(const wchar_t);
extern int vidattr(chtype);
extern int vid_attr(attr_t, short, void *);
extern int vidputs(chtype, int (*)(int));
extern int vid_puts(attr_t, short, void *, int (*)(int));
extern void wcursyncup(WINDOW *);
extern void wsyncdown(WINDOW *);
extern void wsyncup(WINDOW *);
extern const wchar_t *wunctrl(const cchar_t *);
/*
* These macros are not suitable for strict XPG4 conformance,
* because some of them evaluate their arguments more than once.
* However, they can improve speed and size of an application,
* provided an application is careful about not using side effects
* with function/macro parameters.
*/
#ifndef _XOPEN_SOURCE_EXTENDED
#define addch(ch) waddch(stdscr,ch)
#define mvaddch(y,x,ch) (move(y,x)?ERR:addch(ch))
#define mvwaddch(w,y,x,ch) (wmove(w,y,x)?ERR:waddch(w,ch))
#define add_wch(cp) wadd_wch(stdscr,cp)
#define mvadd_wch(y,x,cp) (move(y,x)?ERR:add_wch(cp))
#define mvwadd_wch(w,y,x,cp) (wmove(w,y,x)?ERR:wadd_wch(w,cp))
#define addchnstr(chs,n) waddchnstr(stdscr,chs,n)
#define addchstr(chs) waddchstr(stdscr,chs)
#define mvaddchnstr(y,x,chs,n) (move(y,x)?ERR:addchnstr(chs,n))
#define mvaddchstr(y,x,chs) (move(y,x)?ERR:addchstr(chs))
#define mvwaddchnstr(w,y,x,chs,n) (wmove(w,y,x)?ERR:waddchnstr(w,chs,n))
#define mvwaddchstr(w,y,x,chs) (wmove(w,y,x)?ERR:waddchstr(w,chs))
#define waddchstr(w,chs) waddchnstr(w,chs,-1)
#define add_wchnstr(cp,n) wadd_wchnstr(stdscr,cp,n)
#define add_wchstr(cp) wadd_wchstr(stdscr,cp)
#define mvadd_wchnstr(y,x,cp,n) (move(y,x)?ERR:add_wchnstr(cp,n))
#define mvadd_wchstr(y,x,cp) (move(y,x)?ERR:add_wchstr(cp))
#define mvwadd_wchnstr(w,y,x,cp,n) (wmove(w,y,x)?ERR:wadd_wchnstr(w,cp,n))
#define mvwadd_wchstr(w,y,x,cp) (wmove(w,y,x)?ERR:wadd_wchstr(w,cp))
#define wadd_wchstr(w,cp) wadd_wchnstr(w,cp,-1)
#define addnstr(s,n) waddnstr(stdscr,s,n)
#define addstr(s) waddstr(stdscr,s)
#define mvaddnstr(y,x,s,n) (move(y,x)?ERR:addnstr(s,n))
#define mvaddstr(y,x,s) (move(y,x)?ERR:addstr(s))
#define mvwaddnstr(w,y,x,s,n) (wmove(w,y,x)?ERR:waddnstr(w,s,n))
#define mvwaddstr(w,y,x,s) (wmove(w,y,x)?ERR:waddstr(w,s))
#define waddstr(w,wcs) waddnstr(w,wcs,-1)
#define addnwstr(wcs,n) waddnwstr(stdscr,wcs,n)
#define addwstr(wcs) waddwstr(stdscr,wcs)
#define mvaddnwstr(y,x,wcs,n) (move(y,x)?ERR:addnwstr(wcs,n))
#define mvaddwstr(y,x,wcs) (move(y,x)?ERR:addwstr(wcs))
#define mvwaddnwstr(w,y,x,wcs,n) (wmove(w,y,x)?ERR:waddnwstr(w,wcs,n))
#define mvwaddwstr(w,y,x,wcs) (wmove(w,y,x)?ERR:waddwstr(w,wcs))
#define waddwstr(w,wcs) waddnwstr(w,wcs,-1)
#define attr_get(a,c,o) wattr_get(stdscr,a,c,o)
#define attr_off(a,o) wattr_off(stdscr,a,o)
#define attr_on(a,o) wattr_on(stdscr,a,o)
#define attr_set(a,c,o) wattr_set(stdscr,a,c,o)
#define COLOR_PAIR(n) ((chtype)(n)<<__COLOR_SHIFT)
#define PAIR_NUMBER(a) (((chtype)(a)&A_COLOR)>>__COLOR_SHIFT)
#define bkgd(ch) wbkgd(stdscr, ch)
#define bkgdset(ch) __m_chtype_cc(ch, &stdscr->_bg)
#define getbkgd(w) __m_cc_chtype(&(w)->_bg)
#define wbkgdset(w,ch) __m_chtype_cc(ch, &(w)->_bg)
#define bkgrnd(b) wbkgrnd(stdscr,b)
#define bkgrndset(b) wbkgrndset(stdscr,b)
#define getbkgrnd(b) wgetbkgrnd(stdscr,b)
#define wbkgrndset(w,b) ((w)->_bg = *(b))
#define wgetbkgrnd(w,b) (*(b) = (w)->_bg, OK)
#define border(ls, rs, ts, bs, tl, tr, bl, br) \
wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
#define border_set(ls, rs, ts, bs, tl, tr, bl, br) \
wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
#define box(w,v,h) wborder(w,v,v,h,h,0,0,0,0)
#define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,0)
#define can_change_color() (2 < max_colors && can_change \
&& initialize_color != (char *) 0)
#define has_colors() (0 < max_colors)
#define chgat(n,a,co,p) wchgat(stdscr,n,a,co,p)
#define mvchgat(y,x,n,a,co,p) (move(y,x)?ERR:chgat(n,a,co,p))
#define mvwchgat(w,y,x,n,a,co,p) (wmove(w,y,x)?ERR:wchgat(w,n,a,co,p))
#define clear() wclear(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
#define erase() werase(stdscr)
#define wclear(w) (clearok(w,1)?ERR:werase(w))
#define werase(w) (wmove(w,0,0)?ERR:wclrtobot(w))
#define delch() wdelch(stdscr)
#define mvdelch(y,x) (move(y,x)?ERR:delch())
#define mvwdelch(w,y,x) (wmove(w,y,x)?ERR:wdelch(w))
#define deleteln() wdeleteln(stdscr)
#define insdelln(n) winsdelln(stdscr,n)
#define insertln() winsertln(stdscr)
#define wdeleteln(w) winsdelln(w, -1)
#define winsertln(w) winsdelln(w, 1)
#define refresh() wrefresh(stdscr)
#define echochar(ch) wechochar(stdscr,ch)
#define echo_wchar(cp) wecho_wchar(stdscr,cp)
#define wechochar(w,ch) (waddch(w,ch)?ERR:wrefresh(w))
#define wecho_wchar(w,cp) (wadd_wch(w,cp)?ERR:wrefresh(w))
#define erasewchar(wp) __m_tty_wc(VERASE, wp)
#define killwchar(wp) __m_tty_wc(VKILL, wp)
#define getch() wgetch(stdscr)
#define mvgetch(y,x) (move(y,x)?ERR:getch())
#define mvwgetch(w,y,x) (wmove(w,y,x)?ERR:wgetch(w))
#define get_wch(wcp) wget_wch(stdscr,wcp)
#define mvget_wch(y,x,wcp) (move(y,x)?ERR:get_wch(wcp))
#define mvwget_wch(w,y,x,wcp) (wmove(w,y,x)?ERR:wget_wch(w,wcp))
#define getnstr(s,n) wgetnstr(stdscr,s,n)
#define getstr(s) wgetstr(stdscr,s)
#define mvgetnstr(y,x,s,n) (move(y,x)?ERR:getnstr(s,n))
#define mvgetstr(y,x,s) (move(y,x)?ERR:getstr(s))
#define mvwgetnstr(w,y,x,s,n) (wmove(w,y,x)?ERR:wgetnstr(w,s,n))
#define mvwgetstr(w,y,x,s) (wmove(w,y,x)?ERR:wgetstr(w,s))
#define wgetstr(w,s) wgetnstr(w,s,-1)
#define getn_wstr(wcs,n) wgetn_wstr(stdscr,wcs,n)
#define get_wstr(wcs) wget_wstr(stdscr,wcs)
#define mvgetn_wstr(y,x,wcs,n) (move(y,x)?ERR:getn_wstr(wcs,n))
#define mvget_wstr(y,x,wcs) (move(y,x)?ERR:get_wstr(wcs))
#define mvwgetn_wstr(w,y,x,wcs,n) (wmove(w,y,x)?ERR:wgetn_wstr(w,wcs,n))
#define mvwget_wstr(w,y,x,wcs) (wmove(w,y,x)?ERR:wget_wstr(w,wcs))
#define wget_wstr(w,wcs) wgetn_wstr(w,wcs,-1)
#define has_ic() (((insert_character != (char *) 0 \
|| parm_ich != (char *) 0) \
&& (delete_character != (char *) 0 \
|| parm_dch != (char *) 0)) \
|| (enter_insert_mode != (char *) 0 \
&& exit_insert_mode))
#define has_il() (((insert_line != (char *) 0 \
|| parm_insert_line != (char *) 0) \
&& (delete_line != (char *) 0 \
|| parm_delete_line !=(char*)0)) \
|| change_scroll_region != (char *) 0)
#define hline(ch,n) whline(stdscr,ch,n)
#define vline(ch,n) wvline(stdscr,ch,n)
#define mvhline(y,x,ch,n) (move(y,x)?ERR:hline(ch,n))
#define mvvline(y,x,ch,n) (move(y,x)?ERR:vline(ch,n))
#define mvwhline(w,y,x,ch,n) (wmove(w,y,x)?ERR:whline(w,ch,n))
#define mvwvline(w,y,x,ch,n) (wmove(w,y,x)?ERR:wvline(w,ch,n))
#define hline_set(cp,n) whline_set(stdscr,cp,n)
#define vline_set(cp,n) wvline_set(stdscr,cp,n)
#define mvhline_set(y,x,cp,n) (move(y,x)?ERR:hline_set(cp,n))
#define mvvline_set(y,x,cp,n) (move(y,x)?ERR:vline_set(cp,n))
#define mvwhline_set(w,y,x,cp,n) (wmove(w,y,x)?ERR:whline_set(w,cp,n))
#define mvwvline_set(w,y,x,cp,n) (wmove(w,y,x)?ERR:wvline_set(w,cp,n))
#define inch() winch(stdscr)
#define mvinch(y,x) (move(y,x)?ERR:inch())
#define mvwinch(w,y,x) (wmove(w,y,x)?ERR:winch(w))
#define in_wch(cp) win_wch(stdscr,cp)
#define mvin_wch(y,x,cp) (move(y,x)?ERR:in_wch(cp))
#define mvwin_wch(w,y,x,cp) (wmove(w,y,x)?ERR:win_wch(w,cp))
#define inchnstr(chs,n) winchnstr(stdscr,chs,n)
#define inchstr(chs) winchstr(stdscr,chs)
#define mvinchnstr(y,x,chs,n) (move(y,x)?ERR:inchnstr(chs,n))
#define mvinchstr(y,x,chs) (move(y,x)?ERR:inchstr(chs))
#define mvwinchnstr(w,y,x,chs,n) (wmove(w,y,x)?ERR:winchnstr(w,chs,n))
#define mvwinchstr(w,y,x,chs) (wmove(w,y,x)?ERR:winchstr(w,chs))
#define winchstr(w,chs) winchnstr(w,chs,-1)
#define in_wchnstr(cp,n) win_wchnstr(stdscr,cp,n)
#define in_wchstr(cp) win_wchstr(stdscr,cp)
#define mvin_wchnstr(y,x,cp,n) (move(y,x)?ERR:in_wchnstr(cp,n))
#define mvin_wchstr(y,x,cp) (move(y,x)?ERR:in_wchstr(cp))
#define mvwin_wchnstr(w,y,x,cp,n) (wmove(w,y,x)?ERR:win_wchnstr(w,cp,n))
#define mvwin_wchstr(w,y,x,cp) (wmove(w,y,x)?ERR:win_wchstr(w,cp))
#define win_wchstr(w,cp) win_wchnstr(w,cp,-1)
#define innstr(s,n) winnstr(stdscr,s,n)
#define instr(s) winstr(stdscr,s)
#define mvinnstr(y,x,s,n) (move(y,x)?ERR:innstr(s,n))
#define mvinstr(y,x,s) (move(y,x)?ERR:instr(s))
#define mvwinnstr(w,y,x,s,n) (wmove(w,y,x)?ERR:winnstr(w,s,n))
#define mvwinstr(w,y,x,s) (wmove(w,y,x)?ERR:winstr(w,s))
#define winstr(w,s) winnstr(w,s,-1)
#define innwstr(wcs,n) winnwstr(stdscr,wcs,n)
#define inwstr(wcs) winwstr(stdscr,wcs)
#define mvinnwstr(y,x,wcs,n) (move(y,x)?ERR:innwstr(wcs,n))
#define mvinwstr(y,x,wcs) (move(y,x)?ERR:inwstr(wcs))
#define mvwinnwstr(w,y,x,wcs,n) (wmove(w,y,x)?ERR:winnwstr(w,wcs,n))
#define mvwinwstr(w,y,x,wcs) (wmove(w,y,x)?ERR:winwstr(w,wcs))
#define winwstr(w,wcs) winnwstr(w,wcs,-1)
#define insch(ch) winsch(stdscr,ch)
#define mvinsch(y,x,ch) (move(y,x)?ERR:insch(ch))
#define mvwinsch(w,y,x,ch) (wmove(w,y,x)?ERR:winsch(w,ch))
#define ins_wch(cp) wins_wch(stdscr,cp)
#define mvins_wch(y,x,cp) (move(y,x)?ERR:ins_wch(cp))
#define mvwins_wch(w,y,x,cp) (wmove(w,y,x)?ERR:wins_wch(w,cp))
#define insnstr(s,n) winsnstr(stdscr,s,n)
#define insstr(s) winsstr(stdscr,s)
#define mvinsnstr(y,x,s,n) (move(y,x)?ERR:insnstr(s,n))
#define mvinsstr(y,x,s) (move(y,x)?ERR:insstr(s))
#define mvwinsnstr(w, y, x, s, n) (wmove(w, y, x)?ERR:winsnstr(w, s, n))
#define mvwinsstr(w, y, x, s) (wmove(w, y, x)?ERR:winsstr(w, s))
#define winsstr(w, s) winsnstr(w, s, -1)
#define ins_nwstr(wcs, n) wins_nwstr(stdscr, wcs, n)
#define ins_wstr(wcs) wins_wstr(stdscr, wcs)
#define mvins_nwstr(y, x, wcs, n) (move(y, x)?ERR:ins_nwstr(wcs, n))
#define mvins_wstr(y, x, wcs) (move(y, x)?ERR:ins_wstr(wcs))
#define mvwins_nwstr(w, y, x, wcs, n) (wmove(w, y, x)?ERR:wins_nwstr(w,wcs,n))
#define mvwins_wstr(w, y, x, wcs) (wmove(w, y, x)?ERR:wins_wstr(w,wcs))
#define wins_wstr(w, wcs) wins_nwstr(w, wcs, -1)
#define is_linetouched(w, y) (0 <= (w)->_last[y])
#define mvcur(or, oc, nr, nc) __m_mvcur(or, oc, nr, nc, __m_outc)
#define move(y, x) wmove(stdscr, y, x)
#define overlay(s, t) __m_copywin(s, t, 1)
#define overwrite(s, t) __m_copywin(s, t, 0)
#define newpad(ny, nx) __m_newwin((WINDOW *) 0, ny, nx, -1, -1)
#define subpad(par, ny, nx, by, bx) subwin(par, ny, nx, by, bx)
#define nodelay(w, bf) (wtimeout(w, (bf)?0:-1), OK)
#define timeout(n) wtimeout(stdscr, n)
#define qiflush() ((void) intrflush((WINDOW *) 0, 1))
#define noqiflush() ((void) intrflush((WINDOW *) 0, 0))
#define redrawwin(w) wredrawln(w, 0, (w)->_maxy)
#define scrl(n) wscrl(stdscr, n)
#define setscrreg(t, b) wsetscrreg(stdscr, t, b)
#define standend() wstandend(stdscr)
#define standout() wstandout(stdscr)
#define wstandend(w) (wattr_set(w, WA_NORMAL, COLOR_BLACK, \
(void *)0), 1)
#define wstandout(w) (wattr_on(w, WA_STANDOUT, (void *)0), 1)
#define touchline(w, y, n) wtouchln(w, y, n, 1)
#define touchwin(w) wtouchln(w, 0, (w)->_maxy, 1)
#define untouchwin(w) wtouchln(w, 0, (w)->_maxy, 0)
#define termname() (cur_term->_term)
#ifndef _XOPEN_SOURCE
/*
* Obsolete functions names.
*/
#define crmode cbreak
#define nocrmode nocbreak
#define saveterm def_prog_mode
#define fixterm reset_prog_mode
#define resetterm reset_shell_mode
#endif /* _XOPEN_SOURCE */
#endif /* _XOPEN_SOURCE_EXTENDED */
/*
* Special Keys
*
* Keypad layout
* A1 up A3
* left B2 right
* C1 down C3
*
* Chossing negative values for KEY_ constants means that they can
* be safely returned in either an int or long type.
*/
#define __KEY_BASE (-2)
#define __KEY_MAX __KEY_BASE
#define KEY_CODE_YES (__KEY_BASE-1) /* Special indicator. */
#define KEY_BREAK (__KEY_BASE-2) /* Break key (unreliable) */
#define KEY_DOWN (__KEY_BASE-3) /* The four arrow keys ... */
#define KEY_UP (__KEY_BASE-4)
#define KEY_LEFT (__KEY_BASE-5)
#define KEY_RIGHT (__KEY_BASE-6)
#define KEY_HOME (__KEY_BASE-7) /* Move to upper-left corner. */
#define KEY_BACKSPACE (__KEY_BASE-8) /* Backspace */
#define KEY_F0 (__KEY_BASE-9) /* Function keys. Space for */
#define KEY_F(n) (KEY_F0-(n)) /* 64 keys is reserved. */
#define KEY_DL (__KEY_BASE-73) /* Delete line */
#define KEY_IL (__KEY_BASE-74) /* Insert line */
#define KEY_DC (__KEY_BASE-75) /* Delete character */
#define KEY_IC (__KEY_BASE-76) /* Ins char / enter ins mode */
#define KEY_EIC (__KEY_BASE-77) /* Exit insert char mode */
#define KEY_CLEAR (__KEY_BASE-78) /* Clear screen */
#define KEY_EOS (__KEY_BASE-79) /* Clear to end of screen */
#define KEY_EOL (__KEY_BASE-80) /* Clear to end of line */
#define KEY_SF (__KEY_BASE-81) /* Scroll 1 line forward */
#define KEY_SR (__KEY_BASE-82) /* Scroll 1 line backwards */
#define KEY_NPAGE (__KEY_BASE-83) /* Next page */
#define KEY_PPAGE (__KEY_BASE-84) /* Previous page */
#define KEY_STAB (__KEY_BASE-85) /* Set tab */
#define KEY_CTAB (__KEY_BASE-86) /* Clear tab */
#define KEY_CATAB (__KEY_BASE-87) /* Clear all tabs */
#define KEY_ENTER (__KEY_BASE-88) /* Enter or send */
#define KEY_SRESET (__KEY_BASE-89) /* Soft (partial) reset */
#define KEY_RESET (__KEY_BASE-90) /* Hard reset */
#define KEY_PRINT (__KEY_BASE-91) /* Print or copy */
#define KEY_LL (__KEY_BASE-92) /* Move to lower left corner. */
#define KEY_A1 (__KEY_BASE-93) /* Upper left of keypad */
#define KEY_A3 (__KEY_BASE-94) /* Upper rght of keypad */
#define KEY_B2 (__KEY_BASE-95) /* Center of keypad */
#define KEY_C1 (__KEY_BASE-96) /* Lower left of keypad */
#define KEY_C3 (__KEY_BASE-97) /* Lower right of keypad */
#define KEY_BTAB (__KEY_BASE-98) /* Back Tab */
#define KEY_BEG (__KEY_BASE-99) /* Beginning */
#define KEY_CANCEL (__KEY_BASE-100)
#define KEY_CLOSE (__KEY_BASE-101)
#define KEY_COMMAND (__KEY_BASE-102)
#define KEY_COPY (__KEY_BASE-103)
#define KEY_CREATE (__KEY_BASE-104)
#define KEY_END (__KEY_BASE-105)
#define KEY_EXIT (__KEY_BASE-106)
#define KEY_FIND (__KEY_BASE-107)
#define KEY_HELP (__KEY_BASE-108)
#define KEY_MARK (__KEY_BASE-109)
#define KEY_MESSAGE (__KEY_BASE-110)
#define KEY_MOUSE (__KEY_BASE-111) /* Mouse event occured */
#define KEY_MOVE (__KEY_BASE-112)
#define KEY_NEXT (__KEY_BASE-113) /* Next object */
#define KEY_OPEN (__KEY_BASE-114)
#define KEY_OPTIONS (__KEY_BASE-115)
#define KEY_PREVIOUS (__KEY_BASE-116) /* Previous object */
#define KEY_REDO (__KEY_BASE-117)
#define KEY_REFERENCE (__KEY_BASE-118)
#define KEY_REFRESH (__KEY_BASE-119)
#define KEY_REPLACE (__KEY_BASE-120)
#define KEY_RESTART (__KEY_BASE-121)
#define KEY_RESUME (__KEY_BASE-122)
#define KEY_SAVE (__KEY_BASE-123)
#define KEY_SBEG (__KEY_BASE-124) /* Shifted keys */
#define KEY_SCANCEL (__KEY_BASE-125)
#define KEY_SCOMMAND (__KEY_BASE-126)
#define KEY_SCOPY (__KEY_BASE-127)
#define KEY_SCREATE (__KEY_BASE-128)
#define KEY_SDC (__KEY_BASE-129)
#define KEY_SDL (__KEY_BASE-130)
#define KEY_SELECT (__KEY_BASE-131) /* Select */
#define KEY_SEND (__KEY_BASE-132) /* Shifted end key */
#define KEY_SEOL (__KEY_BASE-133)
#define KEY_SEXIT (__KEY_BASE-134)
#define KEY_SFIND (__KEY_BASE-135)
#define KEY_SHELP (__KEY_BASE-136)
#define KEY_SHOME (__KEY_BASE-137)
#define KEY_SIC (__KEY_BASE-138)
#define KEY_SLEFT (__KEY_BASE-139)
#define KEY_SMESSAGE (__KEY_BASE-140)
#define KEY_SMOVE (__KEY_BASE-141)
#define KEY_SNEXT (__KEY_BASE-142)
#define KEY_SOPTIONS (__KEY_BASE-143)
#define KEY_SPREVIOUS (__KEY_BASE-144)
#define KEY_SPRINT (__KEY_BASE-145)
#define KEY_SREDO (__KEY_BASE-146)
#define KEY_SREPLACE (__KEY_BASE-147)
#define KEY_SRIGHT (__KEY_BASE-148)
#define KEY_SRSUME (__KEY_BASE-149)
#define KEY_SSAVE (__KEY_BASE-150)
#define KEY_SSUSPEND (__KEY_BASE-151)
#define KEY_SUNDO (__KEY_BASE-152)
#define KEY_SUSPEND (__KEY_BASE-153)
#define KEY_UNDO (__KEY_BASE-154)
#define __KEY_MIN (__KEY_BASE-155)
#endif /* __M_CURSES_H__ */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* collate.h will declare all the following routines in their header
* files -- if they conform to the mks extentions.
* If they don't conform, then we have to define them ourselves.
*
* Copyright 1992 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/m_collat.h 1.10 1994/02/02 22:48:30 mark Exp $
*/
#ifndef __M_M_COLLAT_H__
#define __M_M_COLLAT_H__
#include <m_i18n.h>
/*
* MKS i18n extentions for character collation support in POSIX.2
*/
/* m_collel_t: a type used to store collation elements
* This must be an unsigned type.
* M_MAX_COLLEL: maximum allowable value to be used for m_collel_t
* M_COLL_ERR : error value returned by collation functions
*/
/*
* change this to "unsigned short" when we fix the rest of the code
* to use M_COLL_ERR
*/
typedef /* unsigned */ short m_collel_t; /* Collating element */
#define __M_COLL_ERR USHRT_MAX
#define __M_COLL_MAX M_COLL_ERR-1
#undef m_ismccollel
#define m_ismccollel(c) ((c) >= M_CSETSIZE)
extern int m_collequiv (m_collel_t, m_collel_t **);
extern int m_collrange (m_collel_t,m_collel_t,m_collel_t **);
extern int m_collorder (m_collel_t **);
extern int m_cclass (char *, m_collel_t **);
extern m_collel_t m_strtocoll (char *);
extern char *m_colltostr (m_collel_t);
extern m_collel_t m_getmccoll (const char **);
extern m_collel_t m_getwmccoll (const wchar_t **);
extern m_collel_t m_maxcoll (void);
#endif /*__M_M_COLLAT_H__*/
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* m_i18n.h: Header file dealing with all i18n issues. #included from mks.h,
* no program should ever #include any i18n-specific header (i.e. this
* will decide to include locale.h, nls.h and what not).
*
* Copyright 1992, 1993 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/m_i18n.h 1.17 1995/01/04 02:42:04 mark Exp ross $
*/
#ifndef __M_M_I18N_H_
#define __M_M_I18N_H_
#ifndef M_I18N_M_
/*l
* Libraries do not have leading m_ prefixes.
* Thus, we must create #defines which will change all our code from
* having m_ prefixes, to direct library calls.
*/
#define m_collel_t collel_t
#define m_ismccollel ismccollel
#define m_collequiv collequiv
#define m_collrange collrange
#define m_collorder collorder
#define m_cclass cclass
#define m_strtocoll strtocoll
#define m_colltostr colltostr
#define m_localedtconv localedtconv
#define m_localeldconv localeldconv
#define m_dtconv dtconv
#endif /* !M_I18N_M_ */
#define M_CSETSIZE (UCHAR_MAX+1)
/*l
* Fetch all the data structures.
* Even if I18N is off, we need access to the data structures.
* Routines defined inside these headers may get changed via #define's
* below.
*/
#include <m_nls.h> /* Our messaging scheme file */
#include <locale.h> /* Local compiler's locale.h */
#include <collate.h> /* Local compiler's collation: includes m_collel_t */
/*l
* Define i18n portability routines -- built on top of what we define
* as the mks extentions.
*/
extern int m_isyes (char *);
#ifndef I18N
/*l
* I18N is not supported -- make most of it disappear
*
* If we don't want all the internationalization stuff, then we get rid
* all the code, and all the data except the lconv structure (if used).
* This is done if I18N is undefined at compile time. In this case, #define's
* are used to convert strcoll into strcmp; setlocale to simply return POSIX,
* and localeconv to return a pointer to the static lconv structure.
*/
/* messaging */
#undef m_textstr
#undef m_msgdup
#undef m_msgfree
#define m_textdomain(str)
#define m_textmsg(id, str, cls) (str)
#define m_textstr(id, str, cls) str
#define m_strmsg(str) (str)
#define m_msgdup(m) (m)
#define m_msgfree(m)
/* locale */
#define setlocale(class, locale) ((char *)"POSIX")
#define strcoll strcmp
#define localeconv() (&_m_lconv)
#undef m_localedtconv
#define m_localedtconv() (&_m_dtconv)
#undef m_localeldconv
#define m_localeldconv() (&_m_locdef)
#undef m_colltostr
#define m_colltostr(c) (NULL)
extern struct lconv _m_lconv;
extern struct m_dtconv _m_dtconv;
extern struct _m_localedef _m_locdef;
#endif /*I18N*/
#endif /*__M_M_I18N_H_*/
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright 1993 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/m_invari.h 1.12 1994/07/06 17:41:39 miked Exp $
*/
/*
* m_invari.h:
* Configuration and definitions for support of on systems (e.g EBCDIC)
* where the POSIX.2 portable characters are not invariant
*/
#ifndef __M_M_INVARI_H__
#define __M_M_INVARI_H__
/*
* Are all characters in the portable character set invariant across
* all locales? The results, for posix, if not, are undefined.
* For systems that want to try to deal with this, M_VARIANTS is set.
*/
#ifdef M_VARIANTS
extern char __m_invariant[];
extern char __m_unvariant[];
/*
* The M_INVARIANTINIT macro must be called to initialize: it returns -1
* on memory allocation error. It may be called multiple times, but has
* no effect after the first call. To reinitialize the variant <-->
* invariant tables after a new setlocale(), use M_INVARIANTREINIT().
* On error, m_error will have been invoked with an appropriate message.
*/
#define M_INVARIANTINIT() m_invariantinit()
extern void m_invariantinit(void);
#define M_INVARIANTREINIT() __m_setinvariant()
extern void __m_setinvariant(void);
/*
* Assume wide characters are always ok.
* Otherwise, always indirect thru the narrow un/invariant table.
* INVARIANT takes the character in the current locale, and produces an
* invariant value, equal to that the C compiler would have compiled.
* UNVARIANT is the inverse; it takes what the C compiler would have
* compiled, and returns the value in the current locale.
*/
#define M_INVARIANT(c) (wctob(c) == EOF ? (c) : __m_invariant[c])
#define M_UNVARIANT(c) (wctob(c) == EOF ? (c) : __m_unvariant[c])
#define M_UNVARIANTSTR(s) m_unvariantstr(s)
char *m_unvariantstr(char const *);
#define M_WUNVARIANTSTR(ws) m_wunvariantstr(ws)
wchar_t *m_wunvariantstr(wchar_t const *);
#else /* M_VARIANTS */
/* Normal system */
#define M_INVARIANTINIT() /* NULL */
#define M_INVARIANTREINIT() /* NULL */
#define M_INVARIANT(c) (c)
#define M_UNVARIANT(c) (c)
#define M_UNVARIANTSTR(s) (s)
#define M_WUNVARIANTSTR(ws) (ws)
#endif /* M_VARIANTS */
#endif /*__M_M_INVARI_H__*/
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* m_nls.h: mks NLS (National Language Support) header file
* The client may choose to use a different messaging scheme than the xpg
* one -- in that case this file will be replaced.
*
* Copyright 1992, 1995 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/m_nls.h 1.5 1995/01/20 01:42:10 fredw Exp $
*/
#ifndef __M_NLS_H__
#define __M_NLS_H__
extern char *m_nlspath(const char* catalog, int mode);
#define m_textstr(id, str, cls) #id "##" str
extern void m_textdomain(char * str);
extern char *m_textmsg(int id, const char *str, char *cls);
extern char *m_strmsg(const char *str);
/*l
* The following two routines may need to be defined, if you need
* to do special processing:
*
* extern char *m_msgdup(char *m);
* extern void m_msgfree(char *m);
*/
#define m_msgdup(m) (strdup(m))
#define m_msgfree(m) (free(m))
#endif /*__M_NLS_H__*/
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* m_ord.h
*
* Copyright 1986, 1992 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/m_ord.h 1.15 1994/05/29 16:17:02 mark Exp $
*/
#ifndef __M_M_ORD_H__
#define __M_M_ORD_H__
#ifndef UCHAR_MAX
#include <limits.h>
#endif
/*
* Used with CURSES in order to decern whether or not 'x' is a byte
* or a KEY_xxxx macro, which are defined to be values greater than
* UCHAR_MAX.
*/
#define m_ischarset(x) ((unsigned)(x) <= UCHAR_MAX)
#ifdef M_NOT_646
LEXTERN int m_ord ANSI((wint_t));
LEXTERN wint_t m_chr ANSI((int));
#else
/* ASCII based macros */
/*
* m_ord(c) : convert alpha character(case insensitive) to an an ordinal value.
* if c is an alphabetic character (A-Z,a-z), this returns
* a number between 1 and 26
* m_chr(i) : convert an ordinal value to its corresponding alpha character
* using the reverse mapping as m_ord().
* if i is a number between 1 and 26 it returns the corresponding
* alphabetic character A to Z
*/
#include <ctype.h>
#define m_ord(c) \
(m_ischarset(c)&&('A'<=towupper(c)&&towupper(c)<='Z')?towupper(c)-'@':-1)
#define m_chr(c) (1 <= c && c <= 26 ? c+'@' : -1)
#endif /* _POSIX_SOURCE */
#endif /* __M_M_ORD_H__ */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* ISO/IEC 9899: 1990/Add.3: 1993 (E): Wide character header file
*
* Copyright 1992, 1993 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/m_wchar.h 1.51 1995/09/20 19:17:54 ant Exp $
*
*/
#ifndef __M_M_WCHAR_H__
#define __M_M_WCHAR_H__ 1
/*
* m_wchar.h:
* configuration file for multi-byte vs. single byte enablement
*/
#include <wchar.h>
#include <wctype.h>
#include <limits.h> /* Fetch MB_LEN_MAX */
#ifdef M_I18N_LOCKING_SHIFT
extern char *m_strsanitize (char *);
#else
#define m_strsanitize(str) (str)
#endif /* M_I18N_LOCKING_SHIFT */
#ifdef M_I18N_MB
# ifndef MB_LEN_MAX
# error M_I18N_MB defined; but the local system does not support multibyte
# endif /* MB_LEN_MAX */
#define MB_BEGIN if (MB_CUR_MAX > 1) {
#define MB_ELSE } else {
#define MB_END }
#define M_MB_L(s) L##s
#ifndef _WUCHAR_T
#define _WUCHAR_T
/* a typedef to allow single byte distinction between char and uchar
* in MKS environment
*/
typedef wchar_t wuchar_t;
#endif /*_WUCHAR_T*/
extern wint_t m_escapewc(wchar_t **);
extern int m_fputmbs(FILE* fp, char *mbs, int wid, int prec, int ljust);
extern int m_fgetws (wchar_t *, size_t, FILE *);
extern FILE *m_fwopen (wchar_t *, char *);
extern wchar_t *m_wcsdup (const wchar_t *);
extern wchar_t *m_mbstowcsdup (const char *s);
extern char *m_wcstombsdup (const wchar_t *w);
extern char *m_mbschr (const char *, int);
extern char *m_mbsrchr (const char *, int);
extern char *m_mbspbrk (const char *, const char *);
extern wchar_t *m_wcsset (wchar_t *, wchar_t, size_t);
extern int iswabsname (wchar_t *);
#define m_smalls(s) (s)
#define wctomb_init() wctomb(NULL,0)
#else /* !M_I18N_MB */
/* include <stdlib.h> here,
* We must include the multibyte function prototypes (in <stdlib.h>) before
* redefining the prototype function names below.
*
* AND including <stdlib.h> DOES NOT cause a problem with wchar_t.
*
* ANSI says that the typedef of wchar_t should be defined in stdlib.h.
* Thus, the prototypes in stdlib.h are declared using stdlib's definition
* of wchar_t.
*/
#include <stdlib.h> /* DO NOT MOVE THIS include - THIS must be first */
#undef m_escapewc
#undef m_fgetws
#undef m_fwopen
#undef m_wcsdup
#undef m_mbstowcsdup
#undef m_wcstombsdup
#undef m_mbschr
#undef m_mbsrchr
#undef m_mbspbrk
#undef m_wcsset
#undef iswabsname
#undef m_fputmbs
#define m_escapewc m_escapec
#define m_fgetws m_fgets
#define m_fwopen fopen
#define m_wcsdup strdup
#define m_mbstowcsdup strdup
#define m_wcstombsdup strdup
#define m_mbschr strchr
#define m_mbsrchr strrchr
#define m_mbspbrk strpbrk
#define m_wcsset memset
#define iswabsname(s) isabsname(s)
#define m_fputmbs(fp, str, wid, prec, ljust) \
fprintf((fp), (ljust) ? "%-*.*s" : "%*.*s", wid, prec, str)
#define MB_BEGIN if (0) {
#define MB_ELSE } else {
#define MB_END }
#define M_MB_L(s) s
/*
* Types and Macros
*/
#undef WEOF
#undef wint_t
#undef wuchar_t
#undef wchar_t
#define WEOF EOF
#define wchar_t char /* ensures we never use the wchar_t typedef */
#define wint_t int /* type as large as either wchar_t or WEOF */
#define wuchar_t unsigned char /* Force override of typedef */
/*
* Must define _WCHAR_T, _WINT_T and _WUCHAR_T to avoid typedefs collisions
* in other system headers.
* Most systems do something like this:
* #ifndef _WCHAR_T
* #define _WCHAR_T
* typedef unsigned short wchar_t
* #endif
* in their system headers to avoid multiple declarations of wchar_t
*/
#undef _WCHAR_T
#undef _WINT_T
#undef _WUCHAR_T
#define _WCHAR_T
#define _WINT_T
#define _WUCHAR_T
/*
* Input/Output
*/
#undef fgetwc
#undef getwc
#undef getwchar
#undef fputwc
#undef putwc
#undef putwchar
#undef fputws
#undef puts
#undef fgetwx
#undef getws
#undef ungetwc
#undef fwprintf
#undef fwscanf
#undef wprintf
#undef wscanf
#undef swscanf
#undef vfwprintf
#undef vwprintf
#undef vswprintf
#define fgetwc fgetc
#define getwc getc
#define getwchar getchar
#define fputwc fputc
#define putwc putc
#define putwchar putchar
#define fputws fputs
#define fgetws fgets
#define getws gets
#define ungetwc ungetc
#define fwprintf fprintf
#define fwscanf fscanf
#define wprintf printf
#define wscanf scanf
#define swscanf sscanf
#define vfwprintf vfprintf
#define vwprintf vprintf
/* NOTE:
* In single byte mode, both swprintf() and vswprintf() are converted to
* similar, but NOT IDENTICAL, functions that have slightly different
* semantics.
* The 2nd argument to both these routines (e.g the size_t arg)
* is not used in the singlebyte environment since sprintf() and vsprintf()
* do not support this argument.
* One has to be careful when using this routine to not depend on
* the enforcement/safety of this 2nd argument.
*
* swprintf() is converted to m_swprintf(), which is a C function
* (because it can use a variable number of args),
* which is implemented as a call to vsprint()
* vswprintf() is converted to vsprintf()
*
*/
#define swprintf m_swprintf
#define vswprintf(w,n,f,v) vsprintf((char*)w,(const char*)f, v)
#ifndef m_smalls
extern wchar_t *m_smalls (const wchar_t *);
#endif /*m_smalls*/
/*
* General Utilities
*/
#undef wcstod
#undef wcstol
#undef wcstoul
#undef wctomb_init
#define wcstod strtod
#define wcstol strtol
#define wcstoul strtoul
#define wctomb_init() (0) /* No state dependency for nonmultibyte. */
/*
* Wide string handling
*/
#undef wcscpy
#undef wcsncpy
#undef wcscat
#undef wcsncat
#undef wcscoll
#undef wcscmp
#undef wcsncmp
#undef wcsxfrm
#undef wcschr
#undef wcscspn
#undef wcspbrk
#undef wcsrchr
#undef wcsspn
#undef wcsstr
#undef wcstok
#undef wcslen
#undef wcswidth
#undef wcwidth
#define wcscpy strcpy
#define wcsncpy strncpy
#define wcscat strcat
#define wcsncat strncat
#define wcscoll strcoll
#define wcscmp strcmp
#define wcsncmp strncmp
#define wcsxfrm strxfrm
#define wcschr strchr
#define wcscspn strcspn
#define wcspbrk strpbrk
#define wcsrchr strrchr
#define wcsspn strspn
#define wcsstr strstr
#define wcstok(x, y, z) strtok(x, y)
#define wcslen strlen
#define wcswidth(s1, n) strlen(s1) /* Need a strnlen? */
#define wcwidth(c) 1
/*
* Date and time
*/
#undef wcsftime
#define wcsftime strftime
/*
* Extended Multibyte functions
*/
#undef wctob
#undef sisinit
#define wctob(c) ((int) (wint_t) (c))
#define sisinit(p) (1) /* Always in initial state */
/*
* Define prototypes for singlebyte equivalents of multibyte functions.
* We have to use macros to map them to other function names, so that
* they do not conflict with the prototypes from <stdlib.h> that may have
* used a different definition of wchar_t. The restartable functions are
* mapped to their non-restartable counterparts, since there is no state
* information to be preserved.
*/
#undef mblen
#undef mbrlen
#undef mbtowc
#undef mbrtowc
#undef wctomb
#undef wcrtomb
#undef mbstowcs
#undef mbsrtowcs
#undef wcstombs
#undef wcsrtombs
#define mblen(s, n) m_sb_mblen(s, n)
#define mbrlen(s, n, ps) m_sb_mblen(s, n)
#define mbtowc(pwc, s, n) m_sb_mbtowc(pwc, s, n)
#define mbrtowc(pwc, s, n, ps) m_sb_mbtowc(pwc, s, n)
#define wctomb(s, wc) m_sb_wctomb(s, wc)
#define wcrtomb(s, wc, ps) m_sb_wctomb(s, wc)
#define mbstowcs(pwcs, s, n) m_sb_mbstowcs(pwcs, s, n)
#define mbsrtowcs(pwcs, s, n, ps) m_sb_mbstowcs(pwcs, s, n)
#define wcstombs(s, pwcs, n) m_sb_wcstombs(s, pwcs, n)
#define wcsrtombs(s, pwcs, n, ps) m_sb_wcstombs(s, pwcs, n)
extern int m_sb_mblen(const char *s, size_t n);
extern int m_sb_mbtowc(wchar_t *pwc, const char *s, size_t n);
extern int m_sb_wctomb(char *s, wchar_t wc);
extern size_t m_sb_mbstowcs(wchar_t *pwcs, const char *s, size_t n);
extern size_t m_sb_wcstombs(char *s, const wchar_t *pwcs, size_t n);
/*
* convert definitions from <wctype.h>
*/
#undef iswalnum
#undef iswalpha
#undef iswcntrl
#undef iswdigit
#undef iswgraph
#undef iswlower
#undef iswprint
#undef iswpunct
#undef iswspace
#undef iswupper
#undef iswxdigit
#undef iswblank
#undef towlower
#undef towupper
#define iswalnum(c) isalnum(c)
#define iswalpha(c) isalpha(c)
#define iswcntrl(c) iscntrl(c)
#define iswdigit(c) isdigit(c)
#define iswgraph(c) isgraph(c)
#define iswlower(c) islower(c)
#define iswprint(c) isprint(c)
#define iswpunct(c) ispunct(c)
#define iswspace(c) isspace(c)
#define iswupper(c) isupper(c)
#define iswxdigit(c) isxdigit(c)
#define iswblank(c) isblank(c)
#define towlower(c) tolower(c)
#define towupper(c) toupper(c)
/*
* Note: MKS libc/gen/iswctype.c contains the system independent version
* of wctype() and iswctype().
*
* In single byte mode, we can't use the names wctype() and iswctype().
* These may have been defined in the system's headers (e.g <wctype.h>)
* using the system definition of wint_t and wctype_t.
* BUT we have just changed the meaning of wint_t above, to an 'int'
* which may not be the same size as wint_t.
* Thus, we rename them so that we don't get any prototype conflicts
*/
#undef wctype
#undef iswctype
#define wctype _m_wctype
#define iswctype _m_iswctype
extern wctype_t wctype(const char *property);
extern int iswctype(wint_t wc, wctype_t desc);
/*
* .2 Functions
*/
#include <fnmatch.h>
#undef fnwwmatch
#undef fnwnmatch
#define fnwwmatch fnmatch
#define fnwnmatch fnmatch
#include <regex.h>
#undef regwcomp
#undef regwexec
#undef regwdosub
#undef regwdosuba
#undef regwmatch_t
#define regwcomp regcomp
#define regwexec regexec
#define regwdosub regdosub
#define regwdosuba regdosuba
#define regwmatch_t regmatch_t
#endif /* M_I18N_MB */
/*
* prototypes that are common to both SingleByte and MultiByte
*/
extern int m_mbswidth (const char *, size_t);
extern int m_mbsrwidth (const char *, size_t, mbstate_t *);
#endif /*__M_M_WCHAR_H__*/
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* m_wio.h
*
* Wide I/O Library
*
* Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/m_wio.h 1.3 1995/10/02 15:36:15 ant Exp $
*/
#ifndef __M_WIO_H__
#define __M_WIO_H__
#include <stdlib.h>
#include <wchar.h>
typedef struct {
/* Public. */
void *object; /* I/O object (normally a stream). */
int (*get)(void *); /* Get byte from input object. */
int (*put)(int, void *); /* Put byte to output object. */
int (*unget)(int, void *); /* Push byte onto input object. */
int (*iseof)(void *); /* Eof last read? */
int (*iserror)(void *); /* Error last read/write? */
void (*reset)(void *); /* Reset error flags. */
/* Private. */
int _next;
int _size;
mbstate_t _state;
unsigned char _mb[MB_LEN_MAX];
} t_wide_io;
extern wint_t m_wio_get(t_wide_io *);
extern int m_wio_put(wint_t, t_wide_io *);
#endif /* __M_WIO_H__ */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
*/
/*
* MKS header file. Defines that make programming easier for us.
* Includes MKS-specific things and posix routines.
*
* Copyright 1985, 1993 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/mks.h 1.233 1995/09/28 19:45:19 mark Exp $
*/
#ifndef __M_MKS_H__
#define __M_MKS_H__
/*
* This should be a feature test macro defined in the Makefile or
* cc command line.
*/
#ifndef MKS
#define MKS 1
#endif
/*
* Write function declarations as follows:
* extern char *function ANSI((char *cp, int flags, NODE *np));
* Expansion of this happens only when __STDC__ is set.
*/
#ifdef __STDC__
#define ANSI(x) x
#define _VOID void /* Used in VOID *malloc() */
#else
#define const
#define signed
#define volatile
#define ANSI(x) ()
#define _VOID char /* Used in _VOID *malloc() */
#endif
#ifndef STATIC
# define STATIC static /* Used for function definition */
#endif /*STATIC*/
#ifndef STATREF
# ifdef __STDC__
# define STATREF static
# else
# define STATREF /* Used in local function forward declaration */
# endif
#endif /*STATREF*/
#define LEXTERN extern /* Library external reference */
#define LDEFN /* Define Loadable library entry */
typedef void (*_sigfun_t)(int);
#include <mkslocal.h>
#include <stdio.h>
#include <unistd.h>
#include <limits.h>
#include <sys/stat.h> /* required for m_samefile() prototype. */
#include <m_wchar.h>
#include <m_i18n.h>
#include <m_invari.h>
#if M_TFGETC || M_STTY_CC
#include <termios.h>
#endif
#ifndef M_LIBDIR
# error "You must define M_LIBDIR in mkslocal.h"
#endif
#ifndef M_ETCDIR
# error "You must define M_ETCDIR in mkslocal.h"
#endif
#ifndef M_SPOOLDIR
# error "You must define M_SPOOLDIR in mkslocal.h"
#endif
#ifndef M_MANPATH
# error "You must define M_MANPATH in mkslocal.h"
#endif
#if defined(I18N) && !defined(M_NLSDIR)
# error "You must define M_NLSDIR in mkslocal.h"
#endif
#if (defined(M_I18N_MKS_FULL) || defined(M_I18N_MKS_XPG)) && !defined(I18N)
# error I18N must be defined
#endif
/* P_tmpdir - used by tmpnam.c and tempnam.c.
* Could be in <stdio.h>. But in case it is not ..
*/
#ifndef P_tmpdir
# ifndef M_TMPDIR
# error M_TMPDIR must be defined in mkslocal.h
# endif
# define P_tmpdir M_TMPDIR
#endif /* P_tmpdir */
/* L_cuserid - used by cuserid.c
* Could be in <stdio.h>. But in case it is not ..
*/
#ifndef L_cuserid
# ifndef M_L_CUSERID
# error M_L_CUSERID must be defined in mkslocal.h
# endif
# define L_cuserid M_L_CUSERID
#endif /* L_cuserid */
#ifdef M_AUDIT
LEXTERN char *m_audmode (int, int);
#if !defined(M_AUDITW1) || !defined(M_AUDITW2)
# error "With M_AUDIT set, you must define M_AUDITW1 and M_AUDITW2"
#endif
#endif /*M_AUDIT*/
#ifndef M_CS_PATH
# error "You must define M_CS_PATH in mkslocal.h"
#endif
#ifndef M_CS_SHELL
# error "You must define M_CS_SHELL in mkslocal.h"
#endif
#ifndef M_SH_USER_FDS
/*
* default number of user file descriptors to be used in the shell
* Must be >= 10, should be <= OPEN_MAX/2.
*/
#define M_SH_USER_FDS 10
#endif /*M_SH_USER_FDS*/
#ifndef M_SH_MAX_FUNCTION_EVAL_DEPTH
#define M_SH_MAX_FUNCTION_EVAL_DEPTH 100
#endif
#ifndef M_MANPAGER
#define M_MANPAGER "more -A -s"
#endif
/* set up alert and verticalTab characters - This assumes an ANSI-C compiler */
#undef M_ALERT
#undef M_VTAB
#define M_ALERT '\a'
#define M_VTAB '\v'
#ifndef M_ESCAPE
# define M_ESCAPE '\033' /* default to ASCII code for <ESC> */
#endif /*M_ESCAPE*/
#ifndef SETVBUF
/* if SETVBUF not previously defined, then use default ANSI-C definition */
# define SETVBUF setvbuf
#endif
#ifdef M_NULL
/* if M_NULL defined in <mkslocal.h> then want to redefine NULL */
#undef NULL
#define NULL (M_NULL)
#endif /*M_NULL*/
/*
* Useful additions to sys/stat.h.
*/
#ifndef S_IRALL
#define S_IRALL (S_IRUSR|S_IRGRP|S_IROTH)
#endif
#ifndef S_IWALL
#define S_IWALL (S_IWUSR|S_IWGRP|S_IWOTH)
#endif
#ifndef S_IXALL
#define S_IXALL (S_IXUSR|S_IXGRP|S_IXOTH)
#endif
#ifndef M_DEFMODE /* Default directory creation mode */
#define M_DEFMODE ((mode_t)S_IRALL|S_IWALL)/* Default file creation mode*/
#endif
#ifndef M_DIRMODE
#define M_DIRMODE ((mode_t)S_IRALL|S_IWALL|S_IXALL)
#endif
#ifndef M_FLDSEP
#define M_FLDSEP ':' /* UNIX field separator for passwd, PATH */
#endif
#ifndef M_TTYNAME
#define M_TTYNAME "/dev/tty"
#endif
#ifndef M_NULLNAME
#define M_NULLNAME "/dev/null"
#endif
#ifndef M_FSDELIM
#define M_FSDELIM(c) ((c)=='/')
#endif
#ifndef M_DRDELIM
#define M_DRDELIM(c) (0)
#endif
#ifndef M_DIRSTAT
#define M_DIRSTAT(name, dp, sb) stat((name), (sb))
#endif
#ifndef M_HIDDEN
#define M_HIDDEN(dirp, dp) ((dp)->d_name[0] == '.')
#endif
#ifndef M_FSMOUNT /* for use by setmnt routine */
#define M_FSMOUNT M_ETCDIR(mtab)
#endif
#ifndef M_FSALL /* for use by setmnt routine */
#define M_FSALL M_ETCDIR(fstab)
#endif
#ifndef M_NLSCHARMAP /* Default charmap file for localedef */
#define M_NLSCHARMAP M_NLSDIR(charmap/ISO_8859-1)
#endif
#ifndef M_POSIXPATH /* used when I18N undefined, default posix path */
#define M_POSIXPATH M_NLSDIR(locale/POSIX)
#endif
#ifndef M_ISEOV
#define M_ISEOV(error) 0
#endif
#ifndef M_IS_NATIVE_LOCALE
#define M_IS_NATIVE_LOCALE(s) (strcmp(s, "POSIX")==0 || strcmp(s, "C")==0)
#endif
#ifndef M_FSCLOSE
#define M_FSCLOSE(fp)
#endif
#ifndef ROOTUID /* default superuser uid = 0 */
#define ROOTUID 0
#endif
#ifndef ROOTGID /* default superuser gid = 0 */
#define ROOTGID 0
#endif
#ifndef M_GROUP_PASSWD
#define M_GROUP_PASSWD(grp) (grp->gr_passwd)
#endif
#ifndef M_NUMSIZE
/*
* define the expected max length of a printed number. (used in awk)
* This should be the longest expected size for any type of number
* ie. float, long etc.
* This number is used to calculate the approximate
* number of bytes needed to hold the number.
*/
#define M_NUMSIZE 30
#endif /* M_NUMSIZE */
/*
* VARARG[12345]: declare variadic functions.
* Expands to either a standard C prototype or a K&R declaration.
* For example:
*
* #include <stdarg.h>
* int
* fprintf VARARG2(FILE*, fp, char*, fmt)
* {
* va_list ap;
*
* va_start(ap, fmt);
* cp = va_arg(ap, char*);
* va_end(ap);
* }
*/
#ifndef VARARG1
#ifdef __STDC__
#define VARARG1(type, name) (type name, ...)
#define VARARG2(t1, n1, t2, n2) (t1 n1, t2 n2, ...)
#define VARARG3(t1, n1, t2, n2, t3, n3) (t1 n1, t2 n2, t3 n3, ...)
#define VARARG4(t1, n1, t2, n2, t3, n3, t4, n4) \
(t1 n1, t2 n2, t3 n3, t4 n4, ...)
#define VARARG5(t1, n1, t2, n2, t3, n3, t4, n4, t5, n5) \
(t1 n1, t2 n2, t3 n3, t4 n4, t5 n5, ...)
#else
#define VARARG1(type, name) (name, va_alist) type name; int va_alist
#define VARARG2(t1, n1, t2, n2) (n1, n2, va_alist) t1 n1; t2 n2; int va_alist
#define VARARG3(t1, n1, t2, n2, t3, n3) (n1, n2, n3, va_alist) \
t1 n1; t2 n2; t3 n3; int va_alist
#define VARARG4(t1, n1, t2, n2, t3, n3, t4, n4) (n1, n2, n3, n4, va_alist) \
t1 n1; t2 n2; t3 n3; t4 n4; int va_alist
#define VARARG5(t1, n1, t2, n2, t3, n3, t4, n4, t5, n5) \
(n1, n2, n3, n4, n5, va_alist) \
t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; int va_alist
#endif
#endif
/*
* MKS-specific library entry points.
*/
extern char *_cmdname;
LEXTERN char *basename (char *);
LEXTERN void crc16 (ushort *, ushort);
LEXTERN void crcccitt (ushort *, ushort);
LEXTERN int eprintf (const char *, ...);
LEXTERN void eputs (const char *);
LEXTERN int execvep (const char *, char *const *, char *const *);
LEXTERN int isabsname (const char *);
LEXTERN const char *m_cescape (wint_t);
LEXTERN int m_escapec (char **);
LEXTERN const char *m_toprint (wint_t);
#if M_STTY_CC
LEXTERN int m_stty_cc (cc_t* cp, char *str);
#endif
LEXTERN char *m_cmdname (char *);
LEXTERN char *m_strmode (mode_t);
LEXTERN char *m_readmode (const char *);
LEXTERN char *m_readnum (long *, char *, char **, int);
LEXTERN char *m_readunum (unsigned long *, char *, char **, int);
LEXTERN mode_t m_getmode (mode_t);
LEXTERN int m_wallow (int, const char *);
LEXTERN char *m_pathcat (const char *, const char *);
LEXTERN void m_sigcleanup (void (*__handler)(int __signo) );
LEXTERN void m_defaction (int __signo);
LEXTERN char *m_strdup (const char *s);
LEXTERN int m_stricmp (const char *, const char *);
LEXTERN char *m_self (int, char *, char *);
LEXTERN int m_grouplist (char *user, gid_t *gidlist[]);
LEXTERN int m_setgroups (int gidsetsize, gid_t grouplist[]);
LEXTERN uint m_binsrch (uint n, int (*cmp)(uint i));
LEXTERN char *m_dirname (const char*);
LEXTERN char *m_confstr (int);
LEXTERN void m_crcposix (ulong *, const uchar *, size_t);
LEXTERN int m_setprio (int, unsigned int, int);
LEXTERN int m_getprio (int, unsigned int);
LEXTERN int m_incrnice (int, unsigned int, int);
LEXTERN char *m_devname (dev_t);
LEXTERN char *m_mountdir (const char *);
LEXTERN int m_absname(char *, char *, char *, size_t);
LEXTERN int m_samefile(char *, struct stat *, char *, struct stat *);
/* __m_system() : alternate interface into system() */
LEXTERN int __m_system (const char *, const char *, const char *);
/* conversion routines - between single byte and UNICODE (wide) strings.
* These return a pointer to malloc'd memory.
* It is the caller's responsiblity to free() it, if necessary
* These are for use primarily on NT
*/
extern char *m_unicodetosb(const wchar_t*);
extern wchar_t *m_sbtounicode(const char*);
/*
* things that could go into an "m_stdio.h"
*/
/* m_unlink() : alternate unlink() for use with vendor-provided
* libraries that do not have a satisfactory unlink() */
#ifndef M_UNLINK
#define m_unlink(s) unlink(s)
#endif
/* __m_popen() : alternate interface into popen() */
LEXTERN FILE *__m_popen (const char *, const char *,
const char *, const char *);
LEXTERN FILE *__m_popenvp (const char *mode, const char *shell,
char const * const *args);
#if M_TFGETC
LEXTERN int m_tfgetc (FILE *fp, struct termios *tp);
#else
#define m_tfgetc(fp,tp) fgetc(fp)
#endif
/* m_fsopen() - special routine for curses */
LEXTERN FILE *m_fsopen (char *, size_t, const char *, FILE *);
#ifndef M_FFLUSH_NOT_POSIX_1
# define m_fflush fflush
#else
LEXTERN int m_fflush (FILE *);
#endif
/* m_fgets return values */
enum {
M_FGETS_OK, /* Normal return */
M_FGETS_EOF, /*
* Regular EOF (same as NULL from fgets).
* Buffer is *untouched*.
*/
M_FGETS_SHORT, /*
* Short input (buf[strlen(buf)-1] != '\n')
* This is a trailing line, without a newline at the
* end of the file. The buffer is valid, ending in
* a \0, with no newline. The case of terminal input
* ending with an EOF in the middle of the line will
* restart -- typing two EOF's will result in this
* case.
*/
M_FGETS_LONG, /*
* Line too long: newline not found within len bytes
* (buf[len-1] != '\n').
* At this point, while((c=getc(fp)) != '\n') ...
* is a valid method to get the rest of the line.
*/
M_FGETS_BINARY, /*
* Input contained an invalid character (e.g. \0)
* Buffer contents *undefined*.
*/
M_FGETS_ERROR /*
* A system call returned an error, errno is set.
* Buffer contents *undefined*.
*/
};
LEXTERN int m_fgets (char *, size_t, FILE *);
/*
* end of things that could go into an "m_stdio.h"
*/
LEXTERN int m_winsize (int *, int *);
LEXTERN char *m_cuserid ();
/* m_ctype: generic character classification */
typedef int m_ctype_t; /* ctype property */
LEXTERN m_ctype_t m_ctype (const char *property);
LEXTERN int m_isctype (int c, m_ctype_t ctype);
LEXTERN char *m_readdate (char *, time_t *, int);
#ifndef M_READDATE_SYSV
#define M_READDATE_SYSV 0
#endif
#ifndef M_READDATE_BSD
#define M_READDATE_BSD 1
#endif
#ifdef M_MALLOC
LEXTERN _VOID *m_malloc (size_t size);
#else
# define m_malloc(size) malloc(size)
#endif /*M_MALLOC*/
#ifdef M_REALLOC
LEXTERN _VOID *m_realloc (void* ptr, size_t size);
#else
# define m_realloc realloc
#endif /*M_MALLOC*/
#ifdef NAME_MAX
#define m_namemax(path) NAME_MAX
#else
LEXTERN int m_namemax (char *path);
#endif /*NAME_MAX*/
#ifdef PATH_MAX
#define m_pathmax(path) PATH_MAX
#else
LEXTERN int m_pathmax (char *path);
#endif /* PATH_MAX */
#ifdef M_DEVBIN
LEXTERN int m_devbin (int fd); /* begin raw I/O transfer */
LEXTERN void m_devstd (int fd, int mode); /* end raw I/O transfer */
#else
# define m_devbin(fd) 0
# define m_devstd(fd, mode)
#endif /*M_DEVBIN*/
#ifndef m_setbinary
#define m_setbinary(fp)
#endif /*m_setbinary*/
#ifndef M_PRIO_PROCESS
#define M_PRIO_PROCESS 0
#endif
#ifndef M_PRIO_PGRP
#define M_PRIO_PGRP 1
#endif
#ifndef M_PRIO_USER
#define M_PRIO_USER 2
#endif
/* m_wallow type values */
#ifndef MWA_NO
#define MWA_NO 0 /* Deny talk, write */
#endif
#ifndef MWA_YES
#define MWA_YES 1 /* Allow talk, write */
#endif
#ifndef MWA_TEST
#define MWA_TEST 2 /* Test for YES/NO */
#endif
/* Interface for compression (m_cm_*) and decompression (m_dc_*) */
LEXTERN int m_cm_open (int (*wrtfn) (const uchar *,int), int);
LEXTERN int m_cm_write (const uchar *, int);
LEXTERN int m_cm_close (int);
LEXTERN char *m_cm_error (void);
LEXTERN int m_dc_open (ssize_t (*rdfn)(uchar *, int));
LEXTERN ssize_t m_dc_read (uchar *, size_t);
LEXTERN int m_dc_close (int);
LEXTERN char *m_dc_error (void);
LEXTERN int m_mkpardir (char *);
/*
* Some UNIX routines that aren't in SVID
*/
LEXTERN void cfree (void *, size_t, size_t);
LEXTERN void swaw (const short *, short *, int);
/* Some dos routines we sometimes want from posix utilities */
LEXTERN void _uttoof (time_t, ushort *, ushort *);
LEXTERN time_t _oftout (ushort, ushort);
#ifndef M_SETENV
#define m_setenv() environ
#endif
#ifdef M_NON_STATIC_GETENV
#define __m_getenv getenv
#else
LEXTERN char *__m_getenv(char const *); /* Library safe getenv() */
#endif
#ifndef M_CRON_MAILER
/*
* Default case: assume only POSIX.2 mailx is available.
* Must be careful when cron sends output to mailx.
* We must ensure that lines with leading '~' are escaped
* so mailx doesn't interpret these lines
* This string MUST include a trailing space character.
*/
#define M_CRON_MAILER "sed -e s/^~/~~/ | mailx "
#endif
/*
* m_cp() - copy a file in an O/S specific way. See m_cp.3
* for details
*/
/* Return codes */
#define M_CP_ERR -1
#define M_CP_NOOP -2
/* processing flags */
#define M_CP_PRESERVE 1
/*
* MKS MEMORY MANIPULATIONS:
* Specific to MKS and non-portable.
*/
LEXTERN _VOID *membtst (const char *s, size_t m, int c);
#ifdef M_LDATA
#define memLchr memchr
#define memSLccpy memccpy
#define memLbtst membtst
#define memLset memset
#define memLLcpy memcpy
#define memLLrlcpy memrlcpy
#define memLLcmp memcmp
#else
/* for machines with small data models (e.g PC's - DOS, OS2) */
LEXTERN void far*memLchr (const void far*s, int c, size_t n);
LEXTERN void *memSLccpy (_VOID *s1, const _VOID far*s2, int, size_t n);
LEXTERN void far*memLbtst (const char far*s, size_t m, int n);
LEXTERN void far*memLset (void far*s, int c, size_t n);
LEXTERN void far*memLsetl (void far*p, int value, long count);
LEXTERN void far*memLLcpy (void far*s1, const void far*s2, size_t n);
LEXTERN void far*memLLrlcpy (void far*s1, const void far*s2, size_t);
LEXTERN int memLLcmp (const void far *s1,const void far *s2,size_t n);
#endif /* M_LDATA */
/* mks error handling routines */
#include <stdarg.h>
LEXTERN void m_error (const char * fmt, ...);
LEXTERN void m_errorexit (const char *fmt, va_list args);
LEXTERN void m_errorret (const char *fmt, va_list args);
LEXTERN void m_errorjmp (const char *fmt, va_list args);
LEXTERN void m_errornull (const char *fmt, va_list args);
LEXTERN void (*m_errorfn) (const char *fmt, va_list args);
#define M_ERROR(fn) void (*m_errorfn) (const char *fmt, va_list args) = fn
/*
* The filesystem type and attribute routine
*/
#ifndef M_FSTYPE
#define m_fstype(path) M_FSTYPE_POSIX
#endif
/* File system types */
#define M_FSTYPE_MASK 0x1
#define M_FSTYPE_POSIX 0
#define M_FSTYPE_FAT 1
/* File system attributes */
#define M_FSATTR_NO_LEADING_DOT 0x08
#define M_FSATTR_ONE_DOT 0x10
#define M_FSATTR_SHORT_FILENAME 0x20
#define M_FSATTR_SHORT_EXT 0x40
#define M_FSATTR_LOWER_CASE 0x80
/* This one should be ifdef'ed on something else */
#ifndef M_FNMATCH_DUALCASE
#define m_get_original_filename_case(path) /* nil */
#endif
/*
* m_tempname() generates a filename for a temp file using "code"
* in the name.
*/
#ifndef M_TEMPNAME
#define m_tempname(code) tempnam(__m_getenv("TMPDIR"), (code))
#else
char *m_tempname(char const *code);
#endif
/*
* __m_getopt() alternate "stateless" entry into getopt().
*/
struct getopt_state {
char *optarg; /* Argument */
int optind; /* Index into argv */
int opterr; /* Print error message */
int optopt; /* Invalid option */
int index; /* argv[optind] index */
#ifdef M_I18N_MB
mbstate_t st; /* State of argv[optind][index] */
#endif
};
int __m_getopt(int argc, char * const *argv, char const *optstring,
struct getopt_state *state);
#ifdef M_MKSEXTRA_H
/* Any overrides etcetera for a particular system can go in here */
#include <mksextra.h>
#endif /* M_MKSEXTRA_H */
#endif /* __M_MKS_H__ */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* <mkslocal.h>, POSIX Version - local <mks.h> requirements
*
* This generic POSIX version should be used as a template for creation of
* any new <mkslocal.h> file.
*
* Copyright 1985, 1993 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/posix/rcs/mkslocal.h 1.168 1995/06/21 20:33:29 jeffhe Exp mark $
*/
#if 0 /* not required for POSIX systems; here for documentation only */
#include <sys/types.h>
#ifndef VERSION
#define VERSION "MKS InterOpen I/XCU 4.3 SB" /* Used for version# */
#endif
#define name-of-system 1 /* for identifying system (i.e. BSD, SYSV,
* DOS, etc)
*/
#ifndef __STDC__
/* For non-ANSI C compilers, we need to define
* the character encoding for some special control characters
* If these are NOT defined here, then <mks.h> will use
* the ASCII encodings as the default values.
*
* For ANSI C compilers, there are special C character constants supported
* by the compiler. <mks.h> will properly handle this.
*
*/
#define M_ALERT '\7' /* ASCII encoding for \a */
#define M_VTAB '\13' /* ASCII encoding for <VT> */
#endif /* __STDC__ */
/* M_ESCAPE - the system default character encoding for the <ESC> character
* If this is not defined here, then <mks.h> will
* default to use the ASCII encodings.
*/
#define M_ESCAPE '\033' /* ASCII default code for <ESC> */
#define SETVBUF(fp,bp,f,s) setvbuf(fp,f,bp,s) /* for some SysV and Xenix
* systems, which have unusual
* calling sequences
*/
#define M_DEFAULT_PATH "/bin:/usr/bin"
/* Default PATH. Not used yet.
*/
#define M_CS_PATH "/bin:/usr/bin"
/* This string is a list of directories where
* all the POSIX.2 utilities can be found.
* Returned by constr(_CS_PATH, buf, len).
* The shell uses this search path in
* command -p util ...
* The list plus "." is used by login
* and sh as the default $PATH.
*/
#define M_CS_SHELL "/bin/sh"
/* The pathname of the shell utility.
* Returned by confstr(_CS_SHELL, buf, len).
* This string defines the path to the
* the POSIX.2 command language interpreter,
* so we do not have to search M_CS_PATH.
*/
#define M_CS_BINDIR "/bin"
#define M_CS_LIBDIR "/lib"
#define M_CS_TMPDIR "/tmp"
#define M_CS_ETCDIR "/etc"
#define M_CS_SPOOLDIR "/spool"
#define M_CS_NLSDIR "/lib/nls"
#define M_CS_MANPATH "/man"
/* the M_CS_* strings are used by MKS's version
* of the POSIX.2 confstr() API.
* The M_CS_*DIR strings point to system
* default directories.
* The M_CS_*PATH strings may be a list of
* colon seperated system directories
*/
#define M_BINDIR(path) "/bin/" # path
/* M_BINDIR - directory where the POSIX.2
* utilities live. (e.g ed, ...)
*/
#define M_LIBDIR(path) M_CS_LIBDIR # path
/* Define to convert a pathname relative to the
* library directory to an absolute pathname.
* Traditional systems would use "/usr/lib/"
* <mks.h> should always be overridden.
*
* Used by bc, cron
*/
#define M_ETCDIR(path) M_CS_ETCDIR # path
/* Define to convert a pathname relative to the
* etcetera directory to an absolute pathname.
* Traditional systems would use "/etc/"
* <mks.h> should always be overridden.
* Used by file, vi, sh, ccg, lex, awk
*/
#define M_SPOOLDIR(path) M_CS_SPOOLDIR # path
/* Define to convert a pathname relative to the
* spool directory to an absolute pathname.
* Traditional systems would use "/usr/spool/"
* <mks.h> should always be overridden.
*/
#define M_NLSDIR(path) "M_CS_NLSDIR # path
/* Directory name used by the locale program
* to locate specific compiled locales.
* Should always be set, if using the mks
* supplied i18n package. Possible location
* might be /usr/lib/nls.
*/
#define M_TMPDIR M_CS_TMPDIR /* Temporary file storage directory.
* Used for P_tmpdir in case its not defined
* in <stdio.h>
*/
#define M_MANPATH M_CS_MANPATH
/* a list of colon seperated pathnames
* which the man utility uses
* as the default search path
* (e.g when MANPATH environment variable
* not initialized.
*/
#define M_SYSTEM_HELP "help.cmd"/* help command only: If the help command
* doesn't know about a given request for help
* then pass the help request on to another
* help program. Note that if the name for
* the other is also help, there must be
* some form of name qualification. No attempt
* will be made if this is not defined.
* <mks.h> will default to undefined
*/
#define DEF_NLSPATH "/lib/nls/locale/%L/%N.cat"
/* define the default path that should be used
* by MKS's implementation of catopen() when
* trying to open the message cataloges
* If you are not using MKS's implementation
* of catopen(), then this definition
* is not required.
*/
#define M_ENDPWENT 1 /* set to 1 if system provides a endpwent()
* routine.
* Normally, systems provide this routine
* only if getpw*() routines allocate
* some resources which a user may want
* to deallocate when finished accessing the
* user getpw*() routines
* This is the case for conventional
* UNIX systems
*/
#undef M_SHBLTIN_ANYCMD /* set to 1 if you want ability to create an
* executable with any name, using shbltin.c.
* [ shbltin.c was created to satisfy
* POSIX.2-1992 Section 2.3 "regular built-in
* utilities". ]
* If this is undefined, then the only valid
* command names are those listed in an
* internal table in shbltin.c which are
* are checked at run-time against
* basename(argv[0]).
* If the command name is not listed in the
* table, then program will exit
* with an error message.
*
* Normally, this is undefined, since
* it becomes too easy to get into an infinite
* loop if you name this executable to a
* non-bltin command.
*/
/* shbltin:
* shbltin.c is configurable but its configuration is done
* in mkslocal.mk.
* See M_SHBLTIN_ULIMIT
* See M_SHBLTIN_HASH
* See M_SHBLTIN_TYPE
* See M_SHBLTIN_XPG4
*/
#undef M_FNMATCH_DUALCASE /* fnmatch(): If this #define is set, then
* fnmatch will ignore case in file name
* matches *unless* the environment variable
* at runtime has DUALCASE set.
* For a conforming system, this should *not*
* be defined. <mks.h> will default to
* undefined.
*/
#undef M_SMALLSTACK /* Define this to 1 on systems that have
* a fixed size stack compiled into programs,
* and a small (probably 64k) data segment.
*/
#undef M_NULL /* define this if you want to change the
* system default defintion of NULL.
* (e.g #define M_NULL ((void*)0)
*/
#define M_MALLOC 1 /* Define M_MALLOC if your system has either
* of the following two problems:
* 1) ANSI does not specify returning a valid
* errno if malloc() returns NULL.
* But, MKS code assumes a valid errno
* as is returned in most UNIX systems.
* 2) ANSI says it is implementation defined
* whether or not malloc(0) returns a valid
* pointer.
* MKS code assumes that a valid pointer
* is returned.
*
* Defining M_MALLOC requires an m_malloc()
* function, which MKS provides.
* Undefining M_MALLOC causes m_malloc() to be
* renamed to malloc(). (See mks.h)
*/
#define M_REALLOC 1 /* Defining M_REALLOC will cause
* m_realloc() to be used in place of the
* systems realloc().
* This is necessary:
* a) if you do not have an ANSI realloc()
* b) if the system realloc()
* has the following problem:
* - ANSI does not specify returning a valid
* errno if malloc() returns NULL.
* But, MKS code assumes a valid errno
* as is returned in most UNIX systems.
*
* Defining M_REALLOC requires an m_realloc()
* function, which MKS provides.
* Undefining M_MALLOC causes m_malloc() to be
* renamed to malloc(). (See mks.h)
*/
#ifdef M_REALLOC
#define M_WANT_ANSI_REALLOC 1 /* Use #undef M_WANT_ANSI_REALLOC
* if your system has an ANSI realloc() function
*
* Defining M_WANT_ANSI_REALLOC can only be
* done if M_REALLOC is also defined.
* Use M_WANT_ANSI_REALLOC if your system
* does not support either of the following
* 2 features:
*
* 1) ANSI says that if the ptr passed to
* realloc is NULL, then it will act like
* a malloc()
* 2) ANSI says that if the ptr passed is
* not NULL and the size is 0, then the
* object that ptr points to is freed.
*
* Defining M_REALLOC requires an m_realloc()
* function, which MKS provides.
* Undefining M_MALLOC causes m_realloc() to be
* renamed to realloc(). (See mks.h)
*/
#endif /* M_REALLOC */
#define M_MAXMALLOC 64 /* Define the maximum number of kilobytes (K)
* that can be requested from malloc().
* This is intended for segmented systems
* where max allocation by malloc() is smaller
* than the total mallocable memory;
* some programs will assume they can do
* multiple mallocs of this # of K to allocate
* a large data structure.
* By default, this is not defined; malloc can
* allocate up to MAX_INT bytes.
*/
#define __LDATA__ 1 /* DEPRECATED */
#define M_LDATA 1 /* For most modern systems this will be set.
* Some systems (e.g DOS) have a large and
* small program model.
* Thus, various programs have two buffer sizes
* built into them -- large and small. The
* small buffer size is normally sub-optimal,
* but permits the data to fit in the small
* buffer (say 64k)
*/
#ifndef PATH_MAX
#define M_PATH_MAX 2048 /* For systems where pathconf(file,_PC_PATH_MAX)
* can return -1 and NOT set errno
* (which means that PATH_MAX for 'file'
* is unlimited),
* we provide a suitable LARGE value
* that can be returned by m_pathmax().
* This number should be sufficiently large
* to handle most (if not all) reasonable
* pathnames for a particular system.
* m_pathmax() is usually used to determine
* how large a buffer must be allocated to store
* pathnames.
*/
#endif /* PATH_MAX */
#define M_EXPTIME 1 /* For systems whose files maintain an
* additional time field, generally expiry time.
* The stat structure must have a member
* st_etime and the utimbuf a member exptime.
* <mks.h> will default to undefined.
*/
#undef ROOTGID
#undef ROOTUID /* Some systems may use a different user id
* to indicate the superuser.
* If it is not defined here, then <mks.h>
* will define it to be 0 which is the
* value used in conventional UNIX.
*/
#define M_AUDIT 1 /* For systems which maintain file auditing
* information. M_AUDITW1 and M_AUDITW2 must
* be defined, and return one or two audit
* words from the stat structure. m_audmode
* must be defined in the local libraries
* to convert from these two words, to ls style
* letter information. <mks.h> will default to
* undefined.
*/
#define M_AUDITW1(sbp) ? /* Fetch first audit word from stat pointer,
* if M_AUDIT defined.
*/
#define M_AUDITW2(sbp) ? /* Fetch second audit word from stat pointer,
* if M_AUDIT defined. Define as `0' if no
* second audit word.
*/
#undef M_DEVIO /* use #define M_DEVIO 1 on systems that
* requires special interfaces
* to perform I/O on devices.
* (e.g cannot use the standard open,read,write
* interface)
* See <devio.h> for details on this
* special interface.
* Default is undefined; no special device i/o
* interface is used.
*/
#undef M_DEVBIN /* Use #define M_DEVBIN 1
* on systems that have devices that do not
* allow raw I/O be written directly
* to the device.
* These systems tend to process the data
* before actually writing the data to the
* device.
* (e.g DOS disk devices do some character
* translations. This routine is intended
* to disable this behaviour.)
* The definition of m_devbin() and m_devstd()
* is done in <mks.h>.
* If this is defined, then <mks.h> defines
* the prototypes m_devbin() and m_devstd()
* Otherwise it undefines m_devstd()
* and set m_devbin to return a dummy value of 0
*
* MKS has selected some utilities
* to recognize this fact and to handle
* these I/O cases specially.
* Such utilities include cp, mv, and pax
*/
#define M_SETENV 1 /* Some systems require special preparation */
char **m_setenv ANSI((void));/* for use of the environment variables via
* environ; m_setenv call makes sure that
* environ is set up. <mks.h> will default to
* m_setenv returning environ. M_SETENV
* must be set to indicate to mks.h that a C
* function has been defined.
*/
#define m_setbinary(fp) /* On systems supporting text and binary files,
* (i.e. "rb" and "wb" to fopen work different
* from "r" and "w"), there is a requirement
* to be able to set stdin/stdout to binary
* mode. m_setbinary on such systems should
* perform this action. On other systems, this
* macro should define itself out of existence.
* Normally this macro would be defined in
* <stdio.h>. <mks.h> defaults to defining
* it out of existence, if not defined.
*/
#define M_TFGETC 0 /* Do we have POSIX.1-deficient termios?
* On POSIX.1 or SVID compliant systems,
* define it as 0 and mks.h will
* map m_tfgetc(fp,tp) to fgetc(fp).
* On deficient systems (e.g. BSD),
* define it as 1 and ensure a m_tfgetc()
* routine is provided.
*/
#define M_STTY_CC 1 /* The stty command control-character setting
* is very system specific. The default code
* in stty.c works only for the ascii character
* set. <mks.h> will default to M_STTY_CC
* being undefined, resulting using the default
* code. arg is the string passed to stty; *cp
* should have the resulting value stored in it.
* A 0 return value indicates success; other-
* wise an error message will be printed.
*/
#define M_LOGIN_GETTY 1 /* Use #define M_LOGIN_GETTY 1
* on systems that do not provide a
* getty utility.
* This is for use in the login utility to
* display a banner that would conventionally
* be displayed by the UNIX getty utility
* that would have run before login.
* If M_LOGIN_GETTY is not defined here,
* then login will not print this banner info.
*/
#define M_MANPAGER "more -A -s"
/* default command that is executed
* by the man utility to display a man page
* when the user's PAGER environment
* variable is not set.
*/
#define M_TTYGROUP "tty" /* Name of the group that owns tty's.
* If this isn't defined, then <mks.h>
* will leave it undefined.
* This is related to the MKS default
* access enforcment policy for use
* by m_wallow(), mesg, talk, and write.
* If undefined, it is assumed that no security
* is available on tty's.
*/
#undef M_CONSOLE /* This is defined to indicate that a pc
* style console is used instead of a tty.
* This allows for the elimination of
* unnecessary calls to m_wallow() from
* pc compiles.
* Default is undef; m_wallow calls are made.
*/
#define M_LKSUFFIX ".lock" /* Suffix for lock file used by mailx and
* tsmail (name of mailbox to be locked
* is the prefix). ".lock" is typically
* used by UNIX sendmail. This should be
* set to the same suffix as used by other
* mail agents on the machine.
*/
#define M_LS_OPT_D 1 /* ls command: Support -D (list only dirs)
* This option is non-standard on any unix
* system, so is only an option.
* Default is not defined, so ls doesn't support
* this option.
*/
#define M_LOGGER_OPTIONS (log_pid|log_user)
/* Set up default options for the logger utility
* The logger utility allows the log lines to
* be prefixed by pid, ppid, a timestamp,
* and/or the login username.
* If an implementation wishes to
* force some of these prefixes then it
* should OR together one or more of the
* appropriate constants:
* log_pid
* log_ppid
* log_timestamp
* log_user
* If M_LOGGER_OPTIONS is not defined here then
* logger.c uses the default:
* (log_pid|log_user).
*/
#define M_LOGGER_CONSOLE "/dev/console"
/* logger command: If you wish to use the
* default, trivial, logging routines, then
* define M_LOGGER_CONSOLE to the name of
* a device or file, to which logger may
* append the log messages.
* If this variable is *not* defined, then
* the local system must have m_logger, and
* m_logger_close defined and retrieve
* either by the make process, or in the
* libraries. See the documentation for
* the calling sequence of these routines.
*/
#undef M_COMPRESSION_AVAIL /*
* Not defining M_COMPRESSION_AVAIL indicates
* that the compression libary code is not
* available.
* Changing the #undef to #define should only
* be done if the code in libc/mks/m_comp.c
* is implemented.
*
* Because UNiSYS holds the patent on the
* adaptive Lempel-Ziv compression algorithm,
* MKS may not provide the compression
* source code (see libc/mks/m_comp.c)
* in which case the -z option in pax/tar/cpio
* must be disabled.
* If the compression algorithm is implemented
* in m_comp.c, then this macro can be defined.
*/
#define M_TAR_TAPENAME "/dev/mt/%c%c"
/* Set up default file name that the pax/tar
* utilities will use (e.g when 'f' option
* not specified)
* This file name is usually a tape device name
* Two %c's field specifiers can be included
* in the file name;
* the first is replaced with tapenumber,
* the 2nd with tape density
* (l, m, or h, for low, medium or high).
* If you either don't have multiple
* tapes, or densities, you can leave off extra
* %c's.
*
* If this is not defined then pax/tar.h
* will use "/dev/mt/%c%c"
*/
#undef M_GUNZIP /* When defined, m_dc_open() will test for
* gzip-compressed files, and call the
* appropriate routines to uncompress them,
* in addition the normal operation of testing
* for compress-compressed files.
*/
#undef M_VI_NO_RECOVER /* vi command: when defined will not include the
* :preserve and :recover commands.
*/
#define M_VI_COPYRIGHT 1 /* vi command: When sold as a separate product,
* vi prints a copyright notice. This flag
* causes the notice to be printed. Default is
* not defined, which causes vi to NOT print
* the copyright notice.
*/
#define M_MAKEOS "OS:=POSIX" /*for $(OS) in "make" */
/* make command: builtin rule which defines the
* $(OS) variable expansion.
* Default is not defined, which is an error.
*/
#undef M_MAKE_EXIT_DIRECT /* If this is defined, make will call exit()
* directly when it receives a signal, rather
* than clearing the handler and re-sending
* itself the signal. For 1003.2 conformance,
* this must not be defined.
*/
#define M_MAKEFILES ".MAKEFILES:makefile Makefile"
/* rule that make uses when trying to locate
* the default makefile to run
*/
#define M_MAKEDIRSEPSTR "/" /* Default string of characters that make
* will look at and use when manipulating
* path names.
*/
#define M_GETSWITCHAR '-' /* Default character used to indicate an
* option to a command. Note - on some
* systems, this may actually be a system-call
* instead of a constant. As a consequence
* this define should not be used as a
* global initializer.
*/
#define M_MAKE_BUFFER_SIZE 8192 /* max line length handled by make parser */
#define M_MAKE_STRING_SIZE 8192 /* make macro expansion max string size */
#define M_MAKE_PATSUB_SIZE 1024 /* make pattern/substitution max string size */
#define M_FLDSEP ':' /* The field separator character used in
* the PATH environment variable (for sh),
* and for the entries in the group database
* (e.g /etc/group) and the user database
* (e.g /etc/passwd) files.
* If this is not defined here, then <mks.h>
* will default to ':'.
*/
#undef M_TEXT_CR /* Some systems use <cr><lf> pairs rather than
* simple <lf>s to delimit text lines. On
* these systems, this should be defined.
* Default is undefined.
*/
#define M_FPPSLOW 1 /* This should be defined for systems whose
* floating point operations
* are slower than integral operations.
* If this in undefined, the assumption will
* be fast floating point.
*/
#define __CLK_TCK 100 /* units for times() */
#undef M_NOOWNER /* for systems which don't have user/group
* owners on files.
* <mks.h> will default to undefined.
* Used by pax
*/
#define M_FSDELIM(ch) ((ch)=='/') /* for systems who have special characters to
* delimit file systems, this returns true if
* the given character is a file system
* delimiter; <mks.h> will default to '/'.
* ispathdelim() is a deprecated form.
*/
#define M_DRDELIM(ch) (0) /* for systems whose names parse with a leading
* drive separated by a drive delimiter char,
* (e.g. ':' on dos systems); posix systems
* simply return false, i.e. no, character
* is not a drive delimiter.
* <mks.h> will default to (0).
*/
#define M_DIRSTAT(pathname, dirp, statbuf) stat((pathname), (statbuf))
/* prototype definition:
* int M_DIRSTAT(char* pathname,
* DIR* dirp,
* struct stat* statbuf);
* On POSIX and conventional UNIX systems
* this macro is defined as:
* stat((pathname), (statbuf))
/* On systems where the file information is
* maintained in the directory (not the inode)
* the DIR structure may contain this info,
* in which case the information can be returned
* without doing a stat(). This may be a
* performance enhancement.
* dirp is the DIR * pointer returned by opendir
*/
#define M_HIDDEN(dirp, dp) ((dp)->d_name[0] == '.')
/* prototype definition:
* int M_HIDDEN(DIR* dirp, struct* dirent)
*
* Some utilities (e.g ls) recognize certain
* filenames as being "hidden" files.
* In conventional UNIX systems this has been
* the '.' prefix.
* On other systems, with other conventions
* the M_HIDDEN macro should be suitably
* modified
*
* If this is not defined, then
* <mks.h> defaults to traditional unix, a
* leading `.'.
*/
#undef M_NO_FORK /* Define for non-POSIX systems that do not
* have a true fork(), and must use some sort
* of spawn call (for example, DOS).
* By default undefined; there is a fork.
*/
#undef M_SYNC_FORK /* fork() is synchronous (DOS). (sh)
* Default is undefined; posix.1 fork provided.
*/
#undef M_FEXEC /* Use fexec[ve] when possible.
* Only define if fexec is faster than fork/exec
* (sh, ...)
* By default undefined; fork is reasonable
* performance.
*/
#undef M_EXEC_FILETYPE /* File name types for executables.
* For example, .exe and .ksh.
* For the shell, you need to define shexecve()
* and testpath() in sh$(ORG).c.
* By default undefined; no file name types.
*/
#undef M_NO_IDS /* POSIX uids and gids.
* (sh: set -p; umask; test -[rwx])
*/
#undef M_NO_ST_INO /* stat's st_ino is meaningless. (pax; test -ef)
*/
#undef M_SVFS_INO /* statvfs() provides valid f_ffree and
* f_files fields which describe the number
* of free file slots and the total number
* of file slots in a filesystem. Used
* by df.
*/
#undef M_NO_PIPE /* no pipe(), use temp files. (sh, popen)
* Default is undefined; posix.1 pipes provided.
*/
#undef M_LOCKING_OPEN /* Open'd files are locked, (DOS, OS2)
* and cannot be unlink'd or rename'd.
*/
#undef M_USE_SIGNAL /* Has no sigaction, use signal (SVR3).
* (sh, ...)
*/
#undef M_NO_IO_EINTR /* Tty I/O does not return EINTR
* when SIGINT signal handler returns.
* (sh, ?)
*/
#undef M_TTY_ICANON /* Tty is always in ICANON mode.
* (sh,ex,mailx)
*/
#define M_TTYNAME "/dev/tty" /* Device to open to access the controlling
* tty; posix.2 does require this to be /dev/tty
* but dos for example calls it /dev/con.
* <mks.h> will default to /dev/tty.
*/
#define M_NULLNAME "/dev/null" /* Device to open for the null device as defined
* by posix.2. It is required to be named
* /dev/null, but dos for example calls it
* /dev/nul. <mks.h> will default to /dev/null.
*/
#define M_FCLOSE_NOT_POSIX_1 1 /* fclose() does not conform to posix.1 section
* 8.2. An explicit lseek must be done on the
* stream prior to an fclose for the seek
* pointer to be correct. <mks.h> will default
* to undefined.
*/
#define M_FFLUSH_NOT_POSIX_1 1 /* fflush() does not conform to posix.1 section
* 8.2. <mks.h> will default to undefined.
* If undefined, then mks.h will turn m_fflush
* into fflush. If defined, then mks.h will
* leave m_fflush alone, and a stdio-specific
* routine m_fflush() must be provided which
* actually conforms to the standard.
*/
#define M_NL_DOM "mks" /* String used as default name (domain name)
* to get mks utility messages via the xpg
* catopen/catgets message translation functions
* For example, in XPG:
* catopen (M_NL_DOM, ...)
*/
#define M_L_CUSERID 16 /* Length of longest user id returned by
* cuserid() routine.
* Used for L_cuserid in case its not
* defined in <stdio.h>
*/
#define M_FSMOUNT "/etc/mtab"
/* This pathname is passed as the 1st argument
* to setmntent() routine.
* On conventional UNIX systems, this
* pathname identifies a file that contains
* a list of all the actively mounted systems.
* The mount utility is normally responsible
* for adding entries to this file
* and umount utility deletes the entries.
*/
#define M_FSALL "/etc/fstab"
/* this pathname identifies a file that
* is similar to M_FSMOUNT, but instead of
* the actively mounted file systems, it
* has a list of ALL possible filesystems
* that could be mounted.
* This file normally used by the mount
* command to find all the file systems
* to mount by default.
*/
#define M_NLSCHARMAP "/usr/lib/nls/charmap/ISO_8859-1"
/* Name of default charmap file to use in
* localedef if -f charmap option isn't
* used.
*/
#define M_ISEOV(error) (error == EINVAL)
/* This macro is used after an unsuccessful
* read() or m_devread() to determine
* if end-of-volume has been encountered.
* This macro should be invoked using the
* errno returned by the read().
* The macro should evaluate to 1 (true)
* if it can determine the EOV condition
* from this errno.
* Otherwise, should evaluate to 0 (false)
* <mks.h> defaults to 0, i.e. never EOV
*/
#define M_COMPRESS_DEFBITS 16
/* Default # of bits to compress in compress.
* If not defined, compress defaults to 16.
* Probably only useful on systems with limited
* memory capacity.
*/
#define M_CURSES_VERSION "MKS Interopen Curses"
/* Curses product version string. This
* string will be imbedded in the excutable
* for an application. This string should
* be set to the vendor's product code used
* for Curses.
*/
#undef M_CURSES_MEMMAPPED /* Define this symbol to compile up curses
* for a memory mapped display, such as the PC.
* Rather than allocating memory for the main
* screen window, this is compiled to point
* directly at the mapped memory. This will
* require some custom code.
*/
#define M_TERM_NAME "dumb"
/* Default terminal name used if TERM is
* not set in the environment.
*/
#define M_TERMINFO_DIR "/usr/lib/terminfo"
/* Default location for the terminfo database
* if TERMINFO is not set in the environment.
*
* NOTE: Only define this macro if curses
* is available on this system since
* this macro is also used to
* determine if "curses" is available
*/
#define M_BSD_SPRINTF 1 /* Defined if sprintf on this system has BSD
* semantics ie. if sprintf() returns a pointer
* to the string rather than the number of
* characters printed.
*/
#define M_IS_NATIVE_LOCALE(s) (strcmp(s, "POSIX") == 0 || strcmp(s, "C") == 0)
/* Change this definition to define the locale
* that the machine level comparison function
* strcmp conforms to. On all ascii machines,
* strcmp will order the same as the POSIX
* locale. <mks.h> defaults to the def'n given
* here.
*/
#undef M_NOT_646 /* Define this symbol if the local invariant
* character set does not conform to ISO646.
* Normally, this would only be set for
* EBCDIC systems.
* Several utilities (e.g pax/tar/cpio)
* are explicitly required to use 646,
* so if this flag is defined, then there
* is special code which will be
* compiled in to do the appropriate
* character set translation.
*/
#define M_FILENAME_CODESET "IS8859"
/* If M_NOT_646 is defined, then you must
* define the codeset that filenames are
* stored in. This must be a string value,
* that can be passed into iconv.
* Theoretically, this could be a call to
* setlocale, to some extention that would
* return the name of the charmap.
*/
#define M_STKCHK expression /* Define this macro on systems that have a
* fixed size stack.
* This macro should define an expression
* that can be used to check if the current
* C function stack is within some distance
* from the end of available stack size.
* Return 0 if it is -- i.e. unsafe to
* recurse further.
* <mks.h> defaults to undefined;
* i.e. no stack bounds checking.
* This is only called from a few programs
* which allow the user to perform recursion.
*/
#define M_ST_RDEV(sb) ((sb).st_rdev)
#define M_DEVMAJOR(statp) ((uint)major((statp)->st_rdev))
/* Prototype: uint M_DEVMAJOR(struct stat *);
*
* Return the major device number given
* a "struct stat *".
* Assumes the stat structure pointer
* represents a special device file.
* MKS recommends all systems define
* some method of extracting this information
* from this structure
* (eg. define a st_rdev or st_major member
* in the struct stat.)
* This macro must be defined to return some
* unsigned integer value.
*/
#define M_DEVMINOR(statp) ((uint)minor((statp)->st_rdev))
/* Prototype: uint M_DEVMINOR(struct stat *);
*
* Return the minor device number given
* a "struct stat *".
* Same recommendations as M_DEVMAJOR above.
*/
#define M_DEVMAKE(mjr, mnr) (makedev((mjr), (mnr)))
/* Build a dev_t from a major and minor #
* M_DEVMAKE(M_DEVMAJOR(sbp), M_DEVMINOR(sbp))
* just returns the dev_t from the stat buf
*/
#define M_INODIRENT(name, dirbuf) ((ino_t)((dirbuf)->d_ino))
/* Prototype:
* ino_t M_INODIRENT(char *, struct dirent *);
*
* Return the inode belonging to the directory
* entry corresponding to dirbuf. The name
* parameter is the path name given to a
* previous call to opendir().
*/
#define M_ST_BLOCKS(sbp) ((sbp)->st_blocks)
#define M_ST_BLKSIZE(sbp) ((sbp)->st_blksize)
/* If the implementation supports, in the stat
* structure, the actual disk space allocation
* to a given file, then M_ST_BLOCKS should
* be defined to return that member from the
* passed stat structure pointer.
* M_ST_BLKSIZE should be the number of bytes
* in a M_ST_BLOCKS unit; normally a
* different member of the stat structure.
*
* These macros are not required.
* Programs that use these macros
* will fall back on computing these
* values from the st_size field.
*/
#define M_MATHERR 0 /* If the math library supports matherr(),
* define with a non-zero value.
* MKS recommends that all ANSI-C libraries
* support this.
* By default, not defined.
*/
#define M_AWK_SUBSEP "\034" /* Default SUBSEP value in awk. This value
* is appropriate for ASCII based character
* sets.
*/
#define M_FSCLOSE(fp) fclose(fp)
/* define M_FSCLOSE(fp) to be the function
* that cleans up the resources allocated
* by m_fsopen().
* Since m_fsopen() implementation is system
* specific, so is M_FSCLOSE().
*/
#define M_LEX_8BIT 1 /* If this is defined, lex will produce
* 8-bit tables by default (the normal
* default is 7-bit tables).
*/
#define M_NUMSIZE 30 /* M_NUMSIZE should be defined to the length
* in character positions, of the longest
* number that can be sprintf()'d into a string
* (longest of any type of number,
* eg. float, long, double ...)
* For example, if your system prints
* 30 characters for sprintf(str, "%le", float)
* then M_NUMSIZE should be set to at least 30.
*
* This is used in awk to guess at the size
* that each element of an sprintf() will be
* so that it can internally allocate enough
* storage.
*
* If this is not defined, then a default
* value is used from <mks.h>
*/
/*
* File System (Naming) Attributes.
* M_ONE_DOT, M_NO_LEADING_DOT, and M_SHORT_EXT are deprecated, in favour
* of the m_fstype() function. However, until all code has been converted
* they must be set appropriately. The obsolescent versions do not permit
* supporting a system with multiple filesystem types: they are all statically
* tested via pre-processor directives. The new version permits mixing for
* example of a posix file system, with say a dos floppy file system, such
* as is available on many unix systems today.
* If your system is posix conformant, do not set any of these variables
* or functions; <mks.h> will default to a #define for m_fstype to
* a POSIX style naming convention.
*/
#undef M_FSTYPE /* If m_fstype is defined in mkslocal.h,
* either as a #define, or a function decl.
* then define M_FSTYPE, so <mks.h> won't
* define m_fstype into M_FSTYPE_POSIX.
*/
#undef m_fstype(path) /* Either #define, or function returning a
* combination of file naming attributes,
* and the file system type. On a system
* with only one file system type, this would
* be a #define; on a system with multiple a
* function which would decide based on the
* path arg given. Either M_FSTYPE_POSIX or
* M_FSTYPE_FAT, should be or'ed with any of
* M_FSATTR_ONE_DOT, M_FSATTR_SHORT_EXT and
* M_FSATTR_NO_LEADING_DOT. These three
* M_FSATTR_ bit flags conform to the three
* following obsolete defines.
*/
#undef M_ONE_DOT /* Use #define M_ONE_DOT 1
* for non-posix files systems which
* permit only one dot in a filename.
* Thus, for example, y.tab.c, will become
* ytab.c, based on this #define.
* <mks.h> will default to undefined.
*/
#undef M_NO_LEADING_DOT /* Use #define M_NO_LEADING_DOT 1 for
* non-posix file systems which do not
* permit a leading dot in a filename.
* Thus, for example, .profile will become
* profile.ksh based on this #define.
* <mks.h> will default to undefined.
*/
#undef M_SHORT_EXT /* Use #define M_SHORT_EXT 1
* for non-posix file systems which
* permit only a limited number of characters
* after a dot in a filename.
* Defining M_SHORT_EXT will limit filenames
* to 3 characters after the dot.
* For example, y.output will become y.out
* <mks.h> will default to undefined.
*/
/*
* customizations for ps field specifiers and widths
* This will vary from system to system depending on the max size
* of the values in the different fields
* The following are UNIX (e.g SYSV and BSD) std defaults
*/
#define M_PS_FFMT { m_textstr(4865, "ruser=UID", "I"),\
m_textstr(4866, "pid,ppid,pcpu=C", "I"),\
m_textstr(4861, "stime,tty=TTY", "I"), "atime,args",\
NULL };
#define M_PS_JFMT { m_textstr(4867, "pid,sid,pgid=PGRP", "I"),\
m_textstr(4862, "tty=TTY", "I"), "atime,args", NULL };
#define M_PS_LFMT { m_textstr(4868, "flags,state,ruid=UID", "I"),\
m_textstr(4866, "pid,ppid,pcpu=C", "I"),\
m_textstr(4869, "pri,nice,addr,vsz=SZ", "I"),\
m_textstr(4870, "wchan,tty=TTY", "I"),\
m_textstr(4863, "atime,comm=COMD", "I"), NULL };
#define M_PS_DEFFMT { m_textstr(4864, "pid,tty=TTY", "I"), "atime,comm",\
NULL };
#define M_PS_PID_WIDTH 5
#define M_PS_XPID_WIDTH 8
#define M_PS_GID_WIDTH 5
#define M_PS_UID_WIDTH 5
#define M_PS_TTY_WIDTH 7
/*
* The syntax for specifying and displaying terminal names in ps and who
* is required to be the same.
* Since who gets the names from the utmp file, the ps utility
* (and the m_psread() function) needs to know what format these terminal
* names are presented in the utmp file.
* It would appear that all systems have devices in the /dev/ file system
* and that terminal names are displayed as the name rooted from "/dev".
* Since ttyname() returns a full pathname, we can just strip
* off the "/dev/" prefix and we will get the correct name.
*
* The ps utility uses ttyname() to get the name of the controlling terminal.
* M_PS_TTY_PREFIX_TOSTRIP is a prefix string that must be removed from
* the name that ttyname() returns in order to match the name returned
* by m_psread().
* If no prefix is to be removed, then a zero length string ("") should be used
*/
#define M_PS_TTY_PREFIX_TOSTRIP "/dev/"
#define M_LOCALE_NLS_DIR "/usr/lib"
/* Define this if you have a system that
* implements the MKS rootname() function
* (e.g not a no-op)
* and you want to specify the absolute
* pathname to the NLS directory
* which is independent of semantics of rootname().
* Depending on the implementation of rootname(),
* it may prefix the path with $ROOTDIR environment
* variable or it may return a path relative to
* the know location of where the product has
* been installed (or maybe something else!)
*
* If this is not defined, then locale will
* call confstr(_CS_NLSDIR), which in turn calls
* rootname(M_NLSDIR), and you get this resultant
* pathname.
*
* Thus, if you want locale to look in the system native
* nls directory, then define this.
* Otherwise, it will probably look in a user
* specified directory, or the product installation
* directory.
*/
/* Cron configuration options:
* M_CRON_USESFIFO define this (to 1) if your cron is implemented
* using a FIFO (normally found in /usr/lib/cron/FIFO)
* to accept communication from the at/batch/crontab
* utilities when notifying cron of changes to the
* at/batch queues or the user crontabs.
* If this is not defined, then cron will expect
* a signal (SIGUSR) from at/batch/crontab to indicate
* a change in the at/batch queues or the crontabs
*
* M_CRONVARS_DEFINED define this if you define the pathnames below.
* If you don't define this, then the pathnames that cron
* uses is defined in src/cron/cronvars.c.
* (e.g it uses the rootname() and the M_SPOOLDIR,
* M_LIBDIR macros )
*
* This can be used to override cronvars.c definitions
* This is useful on systems that you don't want to
* use MKS's cron daemon and thus, you have to define
* the directories/files where the system cron expects
* things.
*/
#undef M_CRON_USESFIFO
#undef M_CRONVARS_DEFINED
/* the following M_CRON_* macros necessary only
* if M_CRONVARS_DEFINED is defined above
*/
#undef M_CRON_SPOOLDIR /* usually /usr/spool/cron */
#undef M_CRON_LIBDIR /* usually /usr/lib/cron */
#undef M_CRON_CRONTABSDIR /* usually /usr/spool/cron/crontabs */
#undef M_CRON_ATJOBSDIR /* usually /usr/spool/cron/atjobs */
#undef M_CRON_LOGFILE /* usually /usr/lib/cron/log */
#undef M_CRON_PIDFILE /* usually /usr/lib/cron/pid */
#undef M_CRON_QUEUEDEFSFILE /* usually /usr/lib/cron/queuedefs */
#undef M_CRON_FIFOFILE /* usually /usr/lib/cron/FIFO */
/* FIFOFILE only necessary if M_CRON_USESFIFO
* is defined
*/
/*
* M_CRON_MAILER:
* This is a string that specifies a utility names
* or a shell filter (e.g pipeline) that gets executed by the
* cron daemon to deliver mail messages.
* If this is NOT defined here, the the default case is used (see <mks.h>)
*
* Default case:
* #define M_CRON_MAILER "sed -e s/^~/~~/ | mailx "
*
* Assumes only POSIX.2 mailx is available.
* Must be careful when cron sends output to mailx.
* We must ensure that lines with leading '~' are escaped
* so mailx doesn't interpret these lines
* This string MUST include a trailing space character.
*/
#define M_CRON_MAILER "sed -e s/^~/~~/ | mailx "
/*
* Defining M_SYSTEM_TMPDIR indicates that a system global
* temporary directory should be used on this system.
* This will override M_TMPDIR, and any calls to rootname(M_TMPDIR)
* which is relative to the product installation directory
*/
#define M_SYSTEM_TMPDIR "/tmp"
/*
* ex/vi's recover command (and the program of the same name)
* requires a directory in which to store any preserved tmp files.
* Normally these are stored in rootname(M_ETCDIR(recover))
* which is becomes a directory name relative to ROOTDIR env variable (on DOS)
* or relative to the product installation directory.
* Defining M_PRESERVEDIR will ensure that this directory is used
* and calls to rootname() are bypassed.
* (e.g the absolute directory name defined by M_PRESERVEDIR will be used)
*/
#define M_PRESERVEDIR "/var/recover"
/*
* Defining M_SYSTEM_MAILDIR will cause mailx to use this
* absolute directory name - e.g bypass the call to rootname() so
* it doesn't become relative to product installation directory.
*/
#define M_SYSTEM_MAILDIR "/usr/mail"
#undef M_ULIMIT_AVAIL /* define this if your system provides the SystemV
* ulimit() API and the <ulimit.h> header file
*
* This information is used by 'at' utility
*/
/*
* Shell configuration options.
* NOTE: If not defined here, then there may be
* a default defined in src/sh/sh.h; NOT <mks.h>.
*
* You must configure built-in utilities in sh/sh.mk.
* Currently, test and printf can be built-in.
* If you just compile the shell without -D's,
* you do not get these built-in utilities.
*/
#define M_SH_ULIMIT 0 /* Shell SVR4 ulimit built-in.
* Uses getrlimit/setrlimit(2).
*
* NOTE: This may be defined in mkslocal.mk
* along with the build configuration required
* for shbltin.c.
*/
/* M_SH_GETCWD removed, no longer used. default for physical cd/pwd */
#define M_SH_BGNICE 0 /* Set -o bgnice for interactive shell.
*/
#define M_SH_BUILTIN_SEARCH 1 /* Do path search for utility built-ins.
* See POSIX.2/D12, section 3.9.1.1.
* Currently they are:
* [, echo, test, time, printf, pwd.
*/
#define M_SH_RSH 0 /* rsh is installed as a link to sh.
* Vendor option, not required by any standard.
* Not recommended on UNIX.
*/
#define M_SH_USER_FDS 10 /* Number of user file descriptors.
* The value for [n] in redirection
* can be between 0 and M_SH_USER_FDS-1.
* Must be >= 10, should be <= OPEN_MAX/2.
*/
#define M_SH_LINE_MAX LINE_MAX /* Shell input line buffer size.
*/
#undef M_JOB_CONTROL_OFF /* Disable job control,
* were _POSIX_JOB_CONTROL is defined.
*/
#undef M_COPYRIGHT /* MKS Toolkit.
* Print MKS copyright on startup (sh).
*/
#undef M_SH_CRITERROR /* MKS Toolkit.
* set -o criterror (DOS, OS/2).
*/
#define M_SH_MAX_FUNCTION_EVAL_DEPTH 100
/* The limit on how deep function
* evaluation can go when shell
* functions execute shell functions.
* This stops the shell from crashing
* if an infinitely recursive function
* is evaluated. If the value is 0
* then functions can't be executed at
* all, if the value is 1 then
* functions can't execute other
* functions, and so on. If the macro
* M_STKCHK is defined then there will
* be no limit and M_STKCHK will be
* used to prevent a crash.
*/
#undef M_SPAWN /* This code is prototype code only. It
* has not been tested, and should not be
* used.
* This code is not supported, except through
* special arrangements with MKS.
*/
#define M_EXPR_POSIX 1
/*
* POSIX requires that numbers on the
* expr command line always be considered
* decimal. We support octal and hex as
* as well. Defining this will turn that
* extension off by default, but it is still
* accessible by specifying the new '-W' flag
*/
#undef M_RE_SUB_ANCHOR /* Define this if you wish your baisc regular
* expressions to support anchors
* (^ and $) inside of subexpressions.
* See POSIX.2 section 2.8.3.5.
*/
/*
* In order to get full Posix.2 i18n, then you must either:
*
* i) Use the full mks ansi-c library; mks localedef, mks locale.h file...
* ii) Extend your own ansi-c library to contain the mks specified functions
* as described in the mks Porting and Tuning Guide.
*
* Otherwise, it is not possible to conform to posix .2.
*
* You may still turn on I18N, and get as much internationalization as is
* possible using a standard ANSI-C compiler.
*
* Your options are:
* i) Full posix conformance. You must have i or ii above, and must define
* M_I18N and M_I18N_MKS_{FULL,XPG}.
* ii) I18N at ANSI-C level. You must define I18N, do not
* define M_I18N_MKS_{FULL,XPG}.
* iii) No I18N. Do not define I18N, do not define M_I18N_MKS_{FULL,XPG}. */
#define I18N 1 /* OBSOLESCENT version of I18N
* This should be removed when all occurances
* of I18N are removed from the MKS code
*/
#define M_I18N 1 /* Do we want internationalized code? To build
* a system where everything gets deleted at
* compile time via #define's when possible,
* this flag should be set. <mks.h> does not
* define I18N, but it is normal to set it.
*/
#define M_I18N_MKS_FULL 1 /* Defining this, indicates you are using
* MKS i18n extension routines
* (e.g m_collrange(), m_collequiv() ...
* localedtconv, localeldconv() ...)
* Defining this to 2 indicates that you
* want to use MKS's implementation of these
* routines and the implementation of MKS's
* format of the locale data files.
* Defining this to 1 indicates you don't want
* MKS's implementation, and you must write
* your own code for m_collrange(), collequiv()
* ...
* note: there are some routines like
* localedtconv which can obtain the
* necessary info from nl_langinfo()
* if this is supported
* See M_I18N_MKS_XPG below
*/
#define M_I18N_MKS_XPG 1 /* This is only useful if M_I18N_MKS_FULL == 1.
* This flag indicates that nl_langinfo()
* is available and can be used to
* retrieve some of the locale information.
* ( used in localeldconv() and localedtconv()
* routines)
*/
#define M_I18N_M_ 1 /* MKS has defined some additions i18n API's.
* (e.g m_collequiv, m_collrange ...)
* This flag indicates that these API's start
* with "m_".
* It is the MKS intention that if these
* extentions get approved/standardized
* (by POSIX or ANSI or ...)
* all code will have the m_ removed.
* Since it is not yet approved,
* we are maintaining the mks conventions of
* prefixing our private libraries with m_.
* If you have chosen to implement these
* routines without the m_ do not define
* M_I18N_M_
*/
#define M_I18N_MB 1 /* Define if multibyte character support
* is required.
*/
#define M_LOCALEINFO_IN_DIRECTORY 1
/* This macro indicates if the locale
* information is stored in a directory,
* or in a file.
* For instance, many systems use
* /usr/lib/locale
* as a directory to store all their locale
* information.
* In this directory is stored the info
* for each supported locale.
* (e.g POSIX, C, en_US, fr, ...)
* It is assumed that there is one entry here
* for each supported locale.
* If these entries are sub-directories,
* then this macro is defined.
* If these entries are files, then do not
* define this macro.
*/
#undef M_I18N_LOCKING_SHIFT /* Define if any multibyte character sets
* used are locking-shift character sets.
*/
#undef M_VARIANTS /* This can be defined on EBCDIC systems
* where the POSIX.2 portable characters are not
* invariant across all the code pages
* supported.
* By defineing this, user is allowed
* to define the encodings
* for these characters as they switch between
* the various code pages by setting up
* the VARIANTS environment variable..
* so that the various utilities will cope
* with the different encodings gracefully.
*/
/* Source code hints:
* if you define this, you will need
* h/variant.h, h/m_invari.h
* libc/mks/getsyntx.c,
* libc/mks/m_varian.c
*
* If this is not defined, then all you need
* is
* h/m_invar.h
*/
/*
* Define the following if you want the corresponding posix define with
* a single leading underscore
*/
#define __POSIX_JOB_CONTROL _POSIX_JOB_CONTROL
#define __POSIX_SAVED_IDS _POSIX_SAVED_IDS
#define __POSIX_NO_TRUNC (-1)
#define __POSIX_VDISABLE 0xff
/*
* On some systems where code size and performance are problems, it
* may be desirable to use a simplified version of the m_loxclose() routine
* in programs that don't require the full functionality. If this is the
* case and routine m_loxqclose() has been provided, define the following
* macro. (Refer to the Library/eXecutable/Object interface documentation
* for more information.
*/
#undef M_LOXQCLOSE
/*
* some systems require overrides after <mks.h> is read.
* If your system requires this, define M_MKSEXTRA_H here
* so that the "#include <mksextra.h>" is exposed in <mks.h>
*/
#undef M_MKSEXTRA_H
/*
* mailx configuration
*/
/*
* Many mail systems support the non-standard "Content-Length" header
* which contains the length of the body of the message (not including
* the headers) in bytes. Defining M_MAILX_CONTENT_LENGTH_ENABLE will
* turn on code in mailx to generate this header when mail is sent and
* honour it when scanning mailboxes.
*/
#undef M_MAILX_CONTENT_LENGHT_ENABLE
#endif /* 0. not required for POSIX systems; here for documentation only */
#define halloc(n,s) malloc((size_t)((n)*(s)))/* alloc big chunk of mem*/
#define hfree(ptr) free(ptr) /* free big chunk of mem */
#define m_cp(src, dest, ssb, flags) (M_CP_NOOP)
#define rootname(fn) fn /* make relative to root */
/*
* MKS makes use of types that may or may not already be defined in the
* system <sys/types.h> file. If not defined, then they must be defined
* here. (The problem is a lack of #if directive to determine an existing
* typedef.
*/
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
/*
* Define any Optional Facility Configuration Values here.
* See POSIX.2, 2.13.2, Table 2-18
* We define them here as M_ entries; this allows unistd.h to test the
* M_ variable, and if defined, define the official _POSIX2_ variable.
* **Note: It isn't permitted for a real conforming unistd.h to #include <mks.h>
* due to name space contamination problems. A real, conforming implementation
* will manually modify their unistd.h to define the _POSIX2 variables
* appropriately.
*/
#define M_POSIX2_C_BIND 1
#define M_POSIX2_C_DEV 1
#undef M_POSIX2_FORT_DEV
#undef M_POSIX2_FORT_RUN
#define M_POSIX2_LOCALEDEF 1
#define M_POSIX2_SW_DEV 1
/*
* New definitions for I/PSU 3.3
*/
#undef M_POSIX_PFNCS_ONLY /* define this to be true if the implementation
* only supports the portable filename
* set as defined in POSIX.1
*/
#undef M_NO_STIME /* set this define to be true if the system
* does not support the stime() API.
*/
#undef M_TTYSTREAM /* if it isn't possible to open a new console
* stream through device names, define this
* macro to be true. The support library must
* define a routine "m_ttystream()" that can
* return the required stream.
*/
#undef M_NOT_ROOT /* this should be defined to be the name of a
* library routine that returns true if the
* process has appropriate privileges
*/
#undef M_NO_VI_KEYPAD /* this should be defined when the system
* can't support keypad and cursor-key
* functions in vi.
*/
#undef M_USERID_FMT /* format string for printing out the user
* name. It is "%-8.8s" by default.
*/
#undef M_USE_M_CP /* indicates that code is to use the m_cp()
* interface.
* (Note - this API is not fully supported
* in the IPSU.3.X development line. Full
* support will be available in a future
* major release.)
*/
#undef M_GUESS_FILE_TYPE /* If the system provides alternative
* mechanisms for determining the type of a
* file, define this macro to true. If you are
* using this feature, you must provide a new
* function int m_guess_file_type(char *name);
* Returns true if type of file name is
* successfully identified.
* (Note - this API is not fully supported in
* the IPSU.3.X development line. Full
* support will be available in a future
* major release.)
*/
#undef M_INCR_NICE /* default nice incr, if this macro is not
* defined a builtin default will be used
* (see the source for nice for more details.)
*/
#undef M_INCR_RENICE /* default renice incr, if this macro is
* not defined a builtin default will be
* used (see the source for renice for more
* details.)
*/
#undef M_PS_COMM_WIDTH /* width of command field printed by PS */
#undef M_PS_USER_WIDTH /* width of user and ruser fields printed by
* PS
*/
#undef M_PS_PRI_WIDTH /* width of PRI field printed by PS */
#undef M_UT_TIME_STRING /* true if utmp ut_time struct is a string
* instead of a number.
*/
#undef M_SH_ENTRY1
#undef M_SH_ENTRY2
#undef M_SH_ENTRY3
/* The above 3 macros are provide in the
* shell to allow system-specific extensions
* to be added.
* (Note - this API is not fully supported in
* the IPSU.3.X development line. Full
* support will be available in a future
* major release.)
*/
#undef M_NO_CANONICAL_MODE /* set this macro to true if the system
* doesn't support tty buffering in
* canonical mode.
*/
#undef M_NO_PASSWD_SCAN /* true if system doesn't provide a
* mechanism for scanning a list of all
* users on the system.
*/
#define M_GROUP_PASSWD(grp) ""
/* prototype:
* char *M_GROUP_PASSWD(struct group *grp)
* This api returns a pointer to a string
* that contains the password for group 'grp'.
* If no password is available, then an empty string should be
* returned.
*
* On historical UNIX systems, group passwords are found in
* the gr_passwd member in struct group.
* Thus, this macro should be defined as
* #define M_GROUP_PASSWD(grp) grp->gr_passwd
*
* On systems that do not provide group passwords,
* then macro can be defined as an empty string:
* #define M_GROUP_PASSWD(grp) ""
*
*/
#undef M_RCS_NORCSLIB /* Set this macro to true in order
* remove rcslib dependency of utilities
* such as ident.
*/
#undef M_CHMOD_LINK /* Set this macro to true if the system is
* able to perform a chmod() of a link as
* opposed to following the link.
*/
/*
* Include any system-specific prototypes here
*/
/*
* Include any #define's to avoid name clashes with namespace polluting
* operating system routines
*
* e.g.: #define openfile MKSopenfile
*/
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* <mkslocal.h>, Solaris2 Version - local <mks.h> requirements
*
* Copyright 1995-1996 (c) Sun Microsystems Inc.
* All rights reserved.
*
*/
#define _ALL_SOURCE
#include <sys/types.h>
#include <stdlib.h>
#include <limits.h>
#include <wchar.h>
#include <widec.h>
#include <wctype.h>
typedef unsigned char uchar;
#define SYSV 1 /* System V compatible */
#ifndef VERSION
/* Used for in sh, vi ... */
#define VERSION "MKS InterOpen IXCU 4.3 MB - SUN/SOLARIS2"
#endif
/*
* Assume that rootname() is called to prepend the proper path prefix
*/
#define M_CS_PATH "/usr/xpg4/bin" /* posix.2 utilities */
#define M_CS_SHELL "/usr/xpg4/bin/sh" /* posix.2 sh */
#define M_CS_BINDIR "/usr/bin"
#define M_CS_ETCDIR "/etc"
#define M_CS_LIBDIR "/usr/lib"
#define M_CS_SPOOLDIR "/var/spool"
#define M_CS_MANPATH "/usr/man"
#define M_CS_TMPDIR "/tmp"
#define M_CS_NLSDIR "/usr/lib/locale"
#define M_BINDIR(path) M_CS_BINDIR"/" #path
#define M_ETCDIR(path) M_CS_ETCDIR"/" #path
#define M_LIBDIR(path) M_CS_LIBDIR"/" #path
#define M_SPOOLDIR(path) M_CS_SPOOLDIR"/" #path
#define M_NLSDIR(path) M_CS_NLSDIR"/" #path
/*
* M_MANPATH - list of pathnames to be used by man utility
* M_TMPDIR - pathname of temporary
*/
#define M_MANPATH M_CS_MANPATH"/"
#define M_TMPDIR M_CS_TMPDIR"/"
#define M_SYSTEM_TMPDIR "/tmp"
#define M_NL_DOM "mks"
#define DEF_NLSPATH "/usr/lib/locale/%L/LC_MESSAGES"
#define M_RCS_NORCSLIB 1 /* don't use rcslib or its includes */
#define M_MALLOC 1
#define M_REALLOC 1
#ifdef M_REALLOC
#define M_WANT_ANSI_REALLOC 1
#endif
#define __LDATA__ 1 /* Deprecated */
#define M_LDATA 1
#define halloc(n, s) malloc((size_t)((n)*(s)))
#define hfree(ptr) free(ptr)
#define M_FSDELIM(c) ((c) == '/')
/* On POSIX and UNIX there is nothing special to do */
#define m_cp(src, dest, ssb, flags) (M_CP_NOOP)
#define __POSIX_JOB_CONTROL /* POSIX.1 job control */
#define __POSIX_WAIT_NOHANG /* waitpid WNOHANG available */
#define __POSIX_SAVED_IDS _POSIX_SAVED_IDS
#define __POSIX_NO_TRUNC -1 /* automatic truncation */
#define __POSIX_VDISABLE 0x00 /* Disable function in termios.h */
/*
* added for optional facility configuration values
*/
#define M_POSIX2_C_BIND 1
#define M_POSIX2_C_DEV 1
#define M_POSIX2_FORT_DEV 1
#undef M_POSIX2_FORT_RUN
#define M_POSIX2_LOCALEDEF 1
#define M_POSIX2_SW_DEV 1
#define M_POSIX2_UPE 1
#define M_POSIX2_CHAR_TERM 1
#undef M_FCLOSE_NOT_POSIX_1 /* Not POSIX.1 section 8.2 */
#undef M_FFLUSH_NOT_POSIX_1 /* Not POSIX.1 section 8.2 */
#define M_BSD_SPRINTF 0 /* sprintf on this system has BSD */
/* semantics, does not return length */
#define M_ENDPWENT 1 /* set to 1 if system provides a */
/* getpwent() routine */
#define M_MATHERR 1 /* math library supports matherr() */
#define M_LOGGER_CONSOLE "/dev/console"
#define M_SVFS_INO 1
/*
* Set I18N flags
*/
#define M_I18N 1 /* turn on internationalizaion */
#define I18N 1 /* OBSOLESCENT version of M_I18N */
#define M_I18N_M_ 1 /* Uses m_ on MKS i18n extension routines */
#define M_I18N_MKS_XPG 1 /* Use NL info from XPG4 */
#define M_I18N_MKS_FULL 0 /* Full mks extensions */
#define M_I18N_MB 1 /* Enable multibyte compilation */
#undef M_I18N_LOCKING_SHIFT /* No locking-shift character sets. */
#undef M_VARIANTS /* Invariant characters are */
/*
* Interopen Curses for Solaris2
*/
#undef M_CURSES_MEMMAPPED
#define M_TERM_NAME "vt100"
#define M_TERMINFO_DIR "/usr/share/lib/terminfo"
#define M_CURSES_VERSION "MKS I/XCU 4.3 Curses"
#define M_ULIMIT_AVAIL 1 /* <ulimit.h> file available */
#define M_EXPR_POSIX 1 /* decimal only on the expr command line */
#define M_PATH_MAX PATH_MAX
/*
* Solaris 2 does not use stateful encoding, so we will just convert these
* to their stateless equivalent.
*/
#ifndef _MBSTATE_T
#define _MBSTATE_T
typedef int mbstate_t;
#endif /* ! _MBSTATE_T */
#define mbrlen(c, n, ps) mblen(c, n)
#define wcrtomb(c, w, s) wctomb(c, w)
#define mbrtowc(p, w, n, s) mbtowc(p, w, n)
#define wcsrtombs(w, c, n, s) wcstombs(w, c, n)
#define mbsrtowcs(c, w, n, s) mbstowcs(c, w, n)
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* unctrl.h
*
* Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/src/libc/xcurses/rcs/unctrl.h 1.2 1995/05/25 17:57:16 ant Exp $
*/
#ifndef __M_UNCTRL_H__
#define __M_UNCTRL_H__ 1
typedef unsigned long chtype;
extern const char *unctrl(chtype);
#endif /*__M_UNCTRL_H__*/
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright 1993 by Mortice Kern Systems Inc. All rights reserved.
*
* $Header: /rd/h/rcs/variant.h 1.2 1994/01/24 23:12:41 mark Exp $
*/
/*
* For EBCDIC support:
* the variant structure that contains the 13 POSIX.2 portable characters
* that are variant in EBCDIC based code pages.
*/
#ifndef __M_VARIANT_H__
#define __M_VARIANT_H__
struct variant {
char *codeset;
char backslash;
char right_bracket;
char left_bracket;
char right_brace;
char left_brace;
char circumflex;
char tilde;
char exclamation_mark;
char number_sign;
char vertical_line;
char dollar_sign;
char commercial_at;
char grave_accent;
};
struct variant *getsyntx(void);
#endif /* __M_VARIANT_H__ */
|