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
|
'\" t
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 1998-2015,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
.\" copy of this software and associated documentation files (the *
.\" "Software"), to deal in the Software without restriction, including *
.\" without limitation the rights to use, copy, modify, merge, publish, *
.\" distribute, distribute with modifications, sublicense, and/or sell *
.\" copies of the Software, and to permit persons to whom the Software is *
.\" furnished to do so, subject to the following conditions: *
.\" *
.\" The above copyright notice and this permission notice shall be included *
.\" in all copies or substantial portions of the Software. *
.\" *
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
.\" *
.\" Except as contained in this notice, the name(s) of the above copyright *
.\" holders shall not be used in advertising or otherwise to promote the *
.\" sale, use or other dealings in this Software without prior written *
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: ncurses.3x,v 1.214 2024/04/27 17:55:43 tom Exp $
.TH ncurses 3NCURSES 2024-04-27 "ncurses 6.5" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
.\}
.el \{\
.ie t .ds `` ``
.el .ds `` ""
.ie t .ds '' ''
.el .ds '' ""
.\}
.
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
..
.
.\" Add supplementary paragraph tag on its own line after TP.
.\" Adapted from TQ (which would produce mandoc warnings).
.de tQ
. br
. ns
. TP
..
.
.ds d /etc/terminfo
.SH NAME
\fB\%ncurses\fP \-
character-cell terminal interface with optimized output
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.fi
.SH DESCRIPTION
The \*(``new curses\*('' library offers the programmer a
terminal-independent means of reading keyboard and mouse input and
updating character-cell terminals with output optimized to minimize
screen updates.
.I \%ncurses
replaces the
.I curses
libraries from
System V Release 4 Unix (\*(``SVr4\*('')
and
4.4BSD Unix,
the development of which ceased in the 1990s.
This document describes
.I \%ncurses
version 6.5
(patch 20240427).
.PP
.I \%ncurses
permits control of the terminal screen's contents;
abstraction and subdivision thereof with
.I windows
and
.IR pads ;
the reading of terminal input;
control of terminal input and output options;
environment query routines;
color manipulation;
the definition and use of
.I "soft label"
keys;
.I \%term\%info
capability access;
a
.I termcap
compatibility interface;
and an abstraction of the system's API for manipulating the terminal
(such as \fI\%termios\fP(3)).
.PP
.I \%ncurses
implements the standard interface described by
X/Open Curses Issue\ 7.
In many behavioral details not standardized by X/Open,
.I \%ncurses
emulates the
.I curses
library of SVr4 and provides numerous useful extensions.
.PP
.I \%ncurses
man pages employ several sections to clarify matters of usage and
interoperability with other
.I curses
implementations.
.bP
\*(``NOTES\*('' describes issues and caveats of which any user of the
.I \%ncurses
API should be aware,
such as limitations on the size of an underlying integral type or the
availability of a preprocessor macro exclusive of a function definition
(which prevents its address from being taken).
This section also describes implementation details that will be
significant to the programmer but which are not standardized.
.bP
\*(``EXTENSIONS\*('' presents
.I \%ncurses
innovations beyond the X/Open Curses standard and/or the SVr4
.I curses
implementation.
They are termed
.I extensions
to indicate that they cannot be implemented solely by using the library
API,
but require access to the library's internal state.
.bP
\*(``PORTABILITY\*('' discusses matters
(beyond the exercise of extensions)
that should be considered when writing to a
.I curses
standard,
or for multiple implementations.
.bP
\*(``HISTORY\*('' examines points of detail in
.I \%ncurses
and other
.I curses
implementations over the decades of their development,
particularly where precedent or inertia have frustrated better design
(and,
in a few cases,
where such inertia has been overcome).
.PP
A
.I curses
application must be linked with the library;
use the
.B \-lncurses
option to your compiler or linker.
A debugging version of the library may be available;
if so,
link with it using
.BR \-lncurses_g .
(Your system integrator may have installed these libraries such that you
can use the options
.B \-lcurses
and
.BR \-lcurses_g ,
respectively.)
The
.I \%ncurses_g
library generates trace logs
(in a file called
.I \%trace
in the current directory)
that describe
.I \%ncurses
actions.
See section \*(``ALTERNATE CONFIGURATIONS\*('' below.
.SS "Application Structure"
A
.I curses
application uses information from the system locale;
\fI\%setlocale\fP(3) prepares it for
.I curses
library calls.
.PP
.RS 4
.EX
setlocale(LC_ALL, "");
.EE
.RE
.PP
If the locale is not thus initialized,
the library assumes that characters are printable as in ISO\ 8859-1,
to work with certain legacy programs.
You should initialize the locale;
do not expect consistent behavior from the library when the locale has
not been set up.
.PP
\fB\%initscr\fP(3NCURSES) or \fB\%newterm\fP(3NCURSES)
must be called to initialize
.I curses
before use of any functions that deal with windows and screens.
.PP
To get character-at-a-time input without echoing\(emmost interactive,
screen-oriented programs want this\(emuse the following sequence.
.PP
.RS 4
.EX
initscr(); cbreak(); noecho();
.EE
.RE
.PP
Most applications perform further setup as follows.
.PP
.RS 4
.EX
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
.EE
.RE
.PP
A
.I curses
program then often enters an event loop of some sort.
Call \fB\%endwin\fP(3NCURSES) before exiting.
.SS Overview
A
.I curses
library abstracts the terminal screen by representing all or part of it
as a
.I \%WINDOW
data structure.
A
.I window
is a rectangular grid of character cells,
addressed by row and column coordinates
.RI ( y ,
.IR x ),
with the upper left corner as (0, 0).
A window called
.BR \%stdscr ,
the same size as the terminal screen,
is always available.
Create others with \fB\%newwin\fP(3NCURSES).
.PP
A
.I curses
library does not manage overlapping windows
(but see below).
You can either use
.B \%stdscr
to manage one screen-filling window,
or tile the screen into non-overlapping windows and not use
.B \%stdscr
at all.
Mixing the two approaches will result in unpredictable and undesired
effects.
.PP
Functions permit manipulation of a window and the
.I cursor
identifying the cell within it at which the next output operation will
occur.
Among those,
the most basic are \fB\%move\fP(3NCURSES) and \fB\%addch\fP(3NCURSES):
these place the cursor and write a character to
.BR \%stdscr ,
respectively.
.PP
Frequent changes to the terminal screen can cause unpleasant flicker or
inefficient use of the communication channel to the device,
so the library does not generally update it automatically.
Therefore,
after using
.I curses
functions to accumulate a set of desired updates that make sense to
present together,
call \fB\%refresh\fP(3NCURSES) to tell the library to make the user's screen
look like \fBstdscr\fP.
The library
.\" X/Open Curses Issue 7 assumes some optimization will be done, but
.\" does not mandate it in any way.
.I optimizes
its output by computing a minimal number of operations to mutate the
screen from its state at the previous refresh to the new one.
Effective optimization demands accurate information about the terminal
device:
the management of such information is the province of the
\fB\%terminfo\fP(3NCURSES) API,
a feature of every standard
.I curses
implementation.
.PP
Special windows called
.I pads
may also be manipulated.
These are windows that are not constrained to the size of the terminal
screen and whose contents need not be completely displayed.
See \fB\%pad\fP(3NCURSES).
.PP
In addition to drawing characters on the screen,
rendering attributes and colors may be supported,
causing the characters to show up in such modes as underlined,
in reverse video,
or in color on terminals that support such display enhancements.
See \fB\%attr\fP(3NCURSES).
.PP
.I curses
predefines constants for a small set of forms-drawing graphics
corresponding to the DEC Alternate Character Set (ACS),
a feature of VT100 and other terminals.
See \fB\%waddch\fP(3NCURSES).
.PP
.I curses
is implemented using the operating system's terminal driver;
keystroke events are received not as scan codes but as byte sequences.
Graphical keycaps
(alphanumeric and punctuation keys,
and the space)
appear as-is.
Everything else,
including the tab,
enter/return,
keypad,
arrow,
and function keys,
appears as a control character or a multibyte
.I "escape sequence."
.I curses
translates these into unique
.I "key codes."
See \fB\%getch\fP(3NCURSES).
.PP
.I \%ncurses
provides reimplementations of the SVr4 \fB\%panel\fP(3NCURSES), \fB\%form\fP(3FORM),
and \fB\%menu\fP(3MENU) libraries to ease construction of user interfaces
with
.IR curses .
.SS "Initialization"
The selection of an appropriate value of
.I TERM
in the process environment is essential to correct
.I curses
and
.I \%term\%info
library operation.
A well-configured system selects a correct
.I TERM
value automatically;
\fB\%tset\fP(1) may assist with troubleshooting exotic situations.
.PP
If you change the terminal type,
export the
.I TERM
environment variable in the shell,
then run \fB\%tset\fP(1) or the
.RB \*(`` "tput init" \*(''
command.
See subsection \*(``Tabs and Initialization\*('' of \fB\%terminfo\fP(5).
.PP
If the environment variables
.I \%LINES
and
.I \%COLUMNS
are set,
or if the
.I curses
program is executing in a graphical windowing environment,
the information obtained thence overrides that obtained by
.IR \%term\%info .
An
.I \%ncurses
extension supports resizable terminals;
see \fB\%wresize\fP(3NCURSES).
.PP
If the environment variable
.I \%TERMINFO
is defined,
a
.I curses
program checks first for a terminal type description in the location it
identifies.
.I \%TERMINFO
is useful for developing experimental type descriptions or when write
permission to
.I \%\*d
is not available.
.PP
See section \*(``ENVIRONMENT\*('' below.
.SS "Naming Conventions"
.I curses
offers many functions in variant forms using a regular set of
alternatives to the name of an elemental one.
Those prefixed with \*(``w\*('' require a
.I \%WINDOW
pointer argument;
those with a \*(``mv\*('' prefix first perform cursor movement using
\fB\%wmove\fP(3NCURSES);
a \*(``mvw\*('' prefix indicates both.
The \*(``w\*('' function is typically the elemental one;
the removal of this prefix usually indicates operation on
.BR \%stdscr .
.PP
Four functions prefixed with \*(``p\*('' require a pad argument.
.PP
In function synopses,
.I \%ncurses
man pages apply the following names to parameters.
.PP
.TS
center;
Li L.
bf \fIbool\fP (\fBTRUE\fP or \fBFALSE\fP)
c a \fIchar\fP or \fIint\fP
ch a \fIchtype\fP
wc a \fIwchar_t\fP or \fIwint_t\fP
wch a \fIcchar_t\fP
win pointer to a \fIWINDOW\fP
pad pointer to a \fIWINDOW\fP that is a pad
.TE
.SS "Wide and Non-wide Character Configurations"
This manual page describes functions that appear in any configuration
of the library.
There are two common configurations;
see section \*(``ALTERNATE CONFIGURATIONS\*('' below.
.TP 10 \" "ncursesw" + 2n
.I \%ncurses
is the library in its \*(``non-wide\*('' configuration,
handling only eight-bit characters.
It stores a character combined with attributes in a
.I \%chtype
datum,
which is often an alias of
.IR int .
.IP
Attributes alone
(with no corresponding character)
can be stored in variables of
.I \%chtype
or
.I \%attr_t
type.
In either case,
they are represented as an integral bit mask.
.IP
Each cell of a
.I \%WINDOW
is stored as a
.IR \%chtype .
.TP 10
.I \%ncursesw
is the library in its \*(``wide\*('' configuration,
which handles character encodings requiring a larger data type than
.I \%char
(a byte-sized type)
can represent.
It adds about one third more calls using additional data types that
can store such
.I multibyte
characters.
.RS 10 \" same as foregoing tag width
.TP 9 \" "cchar_t" + 2n
.I \%cchar_t
corresponds to the non-wide configuration's
.IR \%chtype .
It always a structure type,
because it stores more data than fit into a standard scalar type.
A character code may not be representable as a
.IR \%char ,
and moreover more than one character may occupy a cell
(as with accent marks and other diacritics).
Each character is of type
.IR \%wchar_t ;
a complex character contains one spacing character and zero or more
non-spacing characters
(see below).
Attributes and color data are stored in separate fields of the
structure,
not combined as in
.IR \%chtype .
.PP
Each cell of a
.I \%WINDOW
is stored as a
.IR \%cchar_t .
.PP
\fB\%setcchar\fP(3NCURSES) and \fB\%getcchar\fP(3NCURSES)
store and retrieve
.I \%cchar_t
data.
The wide library API of
.I \%ncurses
depends on two data types standardized by ISO C95.
.TP 9
.I \%wchar_t
stores a wide character.
Like
.IR \%chtype ,
it may be an alias of
.IR int .
Depending on the character encoding,
a wide character may be
.IR spacing ,
meaning that it occupies a character cell by itself and typically
accompanies cursor advancement,
or
.IR non-spacing ,
meaning that it occupies the same cell as a spacing character,
is often regarded as a \*(``modifier\*('' of the base glyph with which
it combines,
and typically does not advance the cursor.
.TP 9
.I \%wint_t
can store a
.I \%wchar_t
or the constant
.BR \%WEOF ,
analogously to the
.IR int -sized
character manipulation functions of ISO C and its constant
.BR \%EOF .
.RE
.IP
The wide library provides additional functions that complement those in
the non-wide library where the size of the underlying character type is
significant.
A somewhat regular naming convention relates many of the wide variants
to their non-wide counterparts;
where a non-wide function name contains \*(``ch\*('' or \*(``str\*('',
prefix it with \*(``_w\*('' to obtain the wide counterpart.
For example,
\fB\%waddch\fP becomes \fB\%wadd_wch\fP.
(Exceptions that add only \*(``w\*('' comprise
.BR \%addwstr ,
.BR \%inwstr ,
and their variants.)
.IP
This convention is inapplicable to some non-wide function names,
so other transformations are used for the wide configuration:
the window background management function \*(``bkgd\*('' becomes
\*(``bkgrnd\*('';
the window border-drawing and -clearing functions are suffixed with
\*(``_set\*('';
and character attribute manipulation functions like
\*(``attron\*('' become \*(``attr_on\*(''.
.\"
.SS "Function Name Index"
The following table lists the
.I curses
functions provided in the non-wide and wide APIs and the corresponding
man pages that describe them.
Those flagged with \*(``*\*(''
are
.IR \%ncurses "-specific,"
neither described by X/Open Curses nor present in SVr4.
.PP
.TS
center tab(/);
l l .
\f(BIcurses\fP Function Name/Man Page
_
COLOR_PAIR/\fB\%color\fP(3NCURSES)
PAIR_NUMBER/\fB\%color\fP(3NCURSES)
add_wch/\fB\%add_wch\fP(3NCURSES)
add_wchnstr/\fB\%add_wchstr\fP(3NCURSES)
add_wchstr/\fB\%add_wchstr\fP(3NCURSES)
addch/\fB\%addch\fP(3NCURSES)
addchnstr/\fB\%addchstr\fP(3NCURSES)
addchstr/\fB\%addchstr\fP(3NCURSES)
addnstr/\fB\%addstr\fP(3NCURSES)
addnwstr/\fB\%addwstr\fP(3NCURSES)
addstr/\fB\%addstr\fP(3NCURSES)
addwstr/\fB\%addwstr\fP(3NCURSES)
alloc_pair/\fB\%new_pair\fP(3NCURSES)*
assume_default_colors/\fB\%default_colors\fP(3NCURSES)*
attr_get/\fB\%attr\fP(3NCURSES)
attr_off/\fB\%attr\fP(3NCURSES)
attr_on/\fB\%attr\fP(3NCURSES)
attr_set/\fB\%attr\fP(3NCURSES)
attroff/\fB\%attr\fP(3NCURSES)
attron/\fB\%attr\fP(3NCURSES)
attrset/\fB\%attr\fP(3NCURSES)
baudrate/\fB\%termattrs\fP(3NCURSES)
beep/\fB\%beep\fP(3NCURSES)
bkgd/\fB\%bkgd\fP(3NCURSES)
bkgdset/\fB\%bkgd\fP(3NCURSES)
bkgrnd/\fB\%bkgrnd\fP(3NCURSES)
bkgrndset/\fB\%bkgrnd\fP(3NCURSES)
border/\fB\%border\fP(3NCURSES)
border_set/\fB\%border_set\fP(3NCURSES)
box/\fB\%border\fP(3NCURSES)
box_set/\fB\%border_set\fP(3NCURSES)
can_change_color/\fB\%color\fP(3NCURSES)
cbreak/\fB\%inopts\fP(3NCURSES)
chgat/\fB\%attr\fP(3NCURSES)
clear/\fB\%clear\fP(3NCURSES)
clearok/\fB\%outopts\fP(3NCURSES)
clrtobot/\fB\%clear\fP(3NCURSES)
clrtoeol/\fB\%clear\fP(3NCURSES)
color_content/\fB\%color\fP(3NCURSES)
color_set/\fB\%attr\fP(3NCURSES)
copywin/\fB\%overlay\fP(3NCURSES)
curs_set/\fB\%kernel\fP(3NCURSES)
curses_trace/\fB\%trace\fP(3NCURSES)*
curses_version/\fB\%extensions\fP(3NCURSES)*
def_prog_mode/\fB\%kernel\fP(3NCURSES)
def_shell_mode/\fB\%kernel\fP(3NCURSES)
define_key/\fB\%define_key\fP(3NCURSES)*
del_curterm/\fB\%terminfo\fP(3NCURSES)
delay_output/\fB\%util\fP(3NCURSES)
delch/\fB\%delch\fP(3NCURSES)
deleteln/\fB\%deleteln\fP(3NCURSES)
delscreen/\fB\%initscr\fP(3NCURSES)
delwin/\fB\%window\fP(3NCURSES)
derwin/\fB\%window\fP(3NCURSES)
doupdate/\fB\%refresh\fP(3NCURSES)
dupwin/\fB\%window\fP(3NCURSES)
echo/\fB\%inopts\fP(3NCURSES)
echo_wchar/\fB\%add_wch\fP(3NCURSES)
echochar/\fB\%addch\fP(3NCURSES)
endwin/\fB\%initscr\fP(3NCURSES)
erase/\fB\%clear\fP(3NCURSES)
erasechar/\fB\%termattrs\fP(3NCURSES)
erasewchar/\fB\%termattrs\fP(3NCURSES)
exit_curses/\fB\%memleaks\fP(3NCURSES)*
exit_terminfo/\fB\%memleaks\fP(3NCURSES)*
extended_color_content/\fB\%color\fP(3NCURSES)*
extended_pair_content/\fB\%color\fP(3NCURSES)*
extended_slk_color/\fB\%slk\fP(3NCURSES)*
filter/\fB\%util\fP(3NCURSES)
find_pair/\fB\%new_pair\fP(3NCURSES)*
flash/\fB\%beep\fP(3NCURSES)
flushinp/\fB\%util\fP(3NCURSES)
free_pair/\fB\%new_pair\fP(3NCURSES)*
get_escdelay/\fB\%threads\fP(3NCURSES)*
get_wch/\fB\%get_wch\fP(3NCURSES)
get_wstr/\fB\%get_wstr\fP(3NCURSES)
getattrs/\fB\%attr\fP(3NCURSES)
getbegx/\fB\%legacy\fP(3NCURSES)*
getbegy/\fB\%legacy\fP(3NCURSES)*
getbegyx/\fB\%getyx\fP(3NCURSES)
getbkgd/\fB\%bkgd\fP(3NCURSES)
getbkgrnd/\fB\%bkgrnd\fP(3NCURSES)
getcchar/\fB\%getcchar\fP(3NCURSES)
getch/\fB\%getch\fP(3NCURSES)
getcurx/\fB\%legacy\fP(3NCURSES)*
getcury/\fB\%legacy\fP(3NCURSES)*
getmaxx/\fB\%legacy\fP(3NCURSES)*
getmaxy/\fB\%legacy\fP(3NCURSES)*
getmaxyx/\fB\%getyx\fP(3NCURSES)
getmouse/\fB\%mouse\fP(3NCURSES)*
getn_wstr/\fB\%get_wstr\fP(3NCURSES)
getnstr/\fB\%getstr\fP(3NCURSES)
getparx/\fB\%legacy\fP(3NCURSES)*
getpary/\fB\%legacy\fP(3NCURSES)*
getparyx/\fB\%getyx\fP(3NCURSES)
getstr/\fB\%getstr\fP(3NCURSES)
getsyx/\fB\%kernel\fP(3NCURSES)
getwin/\fB\%util\fP(3NCURSES)
getyx/\fB\%getyx\fP(3NCURSES)
halfdelay/\fB\%inopts\fP(3NCURSES)
has_colors/\fB\%color\fP(3NCURSES)
has_ic/\fB\%termattrs\fP(3NCURSES)
has_il/\fB\%termattrs\fP(3NCURSES)
has_key/\fB\%getch\fP(3NCURSES)*
has_mouse/\fB\%mouse\fP(3NCURSES)*
hline/\fB\%border\fP(3NCURSES)
hline_set/\fB\%border_set\fP(3NCURSES)
idcok/\fB\%outopts\fP(3NCURSES)
idlok/\fB\%outopts\fP(3NCURSES)
immedok/\fB\%outopts\fP(3NCURSES)
in_wch/\fB\%in_wch\fP(3NCURSES)
in_wchnstr/\fB\%in_wchstr\fP(3NCURSES)
in_wchstr/\fB\%in_wchstr\fP(3NCURSES)
inch/\fB\%inch\fP(3NCURSES)
inchnstr/\fB\%inchstr\fP(3NCURSES)
inchstr/\fB\%inchstr\fP(3NCURSES)
init_color/\fB\%color\fP(3NCURSES)
init_extended_color/\fB\%color\fP(3NCURSES)*
init_extended_pair/\fB\%color\fP(3NCURSES)*
init_pair/\fB\%color\fP(3NCURSES)
initscr/\fB\%initscr\fP(3NCURSES)
innstr/\fB\%instr\fP(3NCURSES)
innwstr/\fB\%inwstr\fP(3NCURSES)
ins_nwstr/\fB\%ins_wstr\fP(3NCURSES)
ins_wch/\fB\%ins_wch\fP(3NCURSES)
ins_wstr/\fB\%ins_wstr\fP(3NCURSES)
insch/\fB\%insch\fP(3NCURSES)
insdelln/\fB\%deleteln\fP(3NCURSES)
insertln/\fB\%deleteln\fP(3NCURSES)
insnstr/\fB\%insstr\fP(3NCURSES)
insstr/\fB\%insstr\fP(3NCURSES)
instr/\fB\%instr\fP(3NCURSES)
intrflush/\fB\%inopts\fP(3NCURSES)
inwstr/\fB\%inwstr\fP(3NCURSES)
is_cbreak/\fB\%inopts\fP(3NCURSES)*
is_cleared/\fB\%opaque\fP(3NCURSES)*
is_echo/\fB\%inopts\fP(3NCURSES)*
is_idcok/\fB\%opaque\fP(3NCURSES)*
is_idlok/\fB\%opaque\fP(3NCURSES)*
is_immedok/\fB\%opaque\fP(3NCURSES)*
is_keypad/\fB\%opaque\fP(3NCURSES)*
is_leaveok/\fB\%opaque\fP(3NCURSES)*
is_linetouched/\fB\%touch\fP(3NCURSES)
is_nl/\fB\%inopts\fP(3NCURSES)*
is_nodelay/\fB\%opaque\fP(3NCURSES)*
is_notimeout/\fB\%opaque\fP(3NCURSES)*
is_pad/\fB\%opaque\fP(3NCURSES)*
is_raw/\fB\%inopts\fP(3NCURSES)*
is_scrollok/\fB\%opaque\fP(3NCURSES)*
is_subwin/\fB\%opaque\fP(3NCURSES)*
is_syncok/\fB\%opaque\fP(3NCURSES)*
is_term_resized/\fB\%resizeterm\fP(3NCURSES)*
is_wintouched/\fB\%touch\fP(3NCURSES)
isendwin/\fB\%initscr\fP(3NCURSES)
key_defined/\fB\%key_defined\fP(3NCURSES)*
key_name/\fB\%util\fP(3NCURSES)
keybound/\fB\%keybound\fP(3NCURSES)*
keyname/\fB\%util\fP(3NCURSES)
keyok/\fB\%keyok\fP(3NCURSES)*
keypad/\fB\%inopts\fP(3NCURSES)
killchar/\fB\%termattrs\fP(3NCURSES)
killwchar/\fB\%termattrs\fP(3NCURSES)
leaveok/\fB\%outopts\fP(3NCURSES)
longname/\fB\%termattrs\fP(3NCURSES)
mcprint/\fB\%print\fP(3NCURSES)*
meta/\fB\%inopts\fP(3NCURSES)
mouse_trafo/\fB\%mouse\fP(3NCURSES)*
mouseinterval/\fB\%mouse\fP(3NCURSES)*
mousemask/\fB\%mouse\fP(3NCURSES)*
move/\fB\%move\fP(3NCURSES)
mvadd_wch/\fB\%add_wch\fP(3NCURSES)
mvadd_wchnstr/\fB\%add_wchstr\fP(3NCURSES)
mvadd_wchstr/\fB\%add_wchstr\fP(3NCURSES)
mvaddch/\fB\%addch\fP(3NCURSES)
mvaddchnstr/\fB\%addchstr\fP(3NCURSES)
mvaddchstr/\fB\%addchstr\fP(3NCURSES)
mvaddnstr/\fB\%addstr\fP(3NCURSES)
mvaddnwstr/\fB\%addwstr\fP(3NCURSES)
mvaddstr/\fB\%addstr\fP(3NCURSES)
mvaddwstr/\fB\%addwstr\fP(3NCURSES)
mvchgat/\fB\%attr\fP(3NCURSES)
mvcur/\fB\%terminfo\fP(3NCURSES)
mvdelch/\fB\%delch\fP(3NCURSES)
mvderwin/\fB\%window\fP(3NCURSES)
mvget_wch/\fB\%get_wch\fP(3NCURSES)
mvget_wstr/\fB\%get_wstr\fP(3NCURSES)
mvgetch/\fB\%getch\fP(3NCURSES)
mvgetn_wstr/\fB\%get_wstr\fP(3NCURSES)
mvgetnstr/\fB\%getstr\fP(3NCURSES)
mvgetstr/\fB\%getstr\fP(3NCURSES)
mvhline/\fB\%border\fP(3NCURSES)
mvhline_set/\fB\%border_set\fP(3NCURSES)
mvin_wch/\fB\%in_wch\fP(3NCURSES)
mvin_wchnstr/\fB\%in_wchstr\fP(3NCURSES)
mvin_wchstr/\fB\%in_wchstr\fP(3NCURSES)
mvinch/\fB\%inch\fP(3NCURSES)
mvinchnstr/\fB\%inchstr\fP(3NCURSES)
mvinchstr/\fB\%inchstr\fP(3NCURSES)
mvinnstr/\fB\%instr\fP(3NCURSES)
mvinnwstr/\fB\%inwstr\fP(3NCURSES)
mvins_nwstr/\fB\%ins_wstr\fP(3NCURSES)
mvins_wch/\fB\%ins_wch\fP(3NCURSES)
mvins_wstr/\fB\%ins_wstr\fP(3NCURSES)
mvinsch/\fB\%insch\fP(3NCURSES)
mvinsnstr/\fB\%insstr\fP(3NCURSES)
mvinsstr/\fB\%insstr\fP(3NCURSES)
mvinstr/\fB\%instr\fP(3NCURSES)
mvinwstr/\fB\%inwstr\fP(3NCURSES)
mvprintw/\fB\%printw\fP(3NCURSES)
mvscanw/\fB\%scanw\fP(3NCURSES)
mvvline/\fB\%border\fP(3NCURSES)
mvvline_set/\fB\%border_set\fP(3NCURSES)
mvwadd_wch/\fB\%add_wch\fP(3NCURSES)
mvwadd_wchnstr/\fB\%add_wchstr\fP(3NCURSES)
mvwadd_wchstr/\fB\%add_wchstr\fP(3NCURSES)
mvwaddch/\fB\%addch\fP(3NCURSES)
mvwaddchnstr/\fB\%addchstr\fP(3NCURSES)
mvwaddchstr/\fB\%addchstr\fP(3NCURSES)
mvwaddnstr/\fB\%addstr\fP(3NCURSES)
mvwaddnwstr/\fB\%addwstr\fP(3NCURSES)
mvwaddstr/\fB\%addstr\fP(3NCURSES)
mvwaddwstr/\fB\%addwstr\fP(3NCURSES)
mvwchgat/\fB\%attr\fP(3NCURSES)
mvwdelch/\fB\%delch\fP(3NCURSES)
mvwget_wch/\fB\%get_wch\fP(3NCURSES)
mvwget_wstr/\fB\%get_wstr\fP(3NCURSES)
mvwgetch/\fB\%getch\fP(3NCURSES)
mvwgetn_wstr/\fB\%get_wstr\fP(3NCURSES)
mvwgetnstr/\fB\%getstr\fP(3NCURSES)
mvwgetstr/\fB\%getstr\fP(3NCURSES)
mvwhline/\fB\%border\fP(3NCURSES)
mvwhline_set/\fB\%border_set\fP(3NCURSES)
mvwin/\fB\%window\fP(3NCURSES)
mvwin_wch/\fB\%in_wch\fP(3NCURSES)
mvwin_wchnstr/\fB\%in_wchstr\fP(3NCURSES)
mvwin_wchstr/\fB\%in_wchstr\fP(3NCURSES)
mvwinch/\fB\%inch\fP(3NCURSES)
mvwinchnstr/\fB\%inchstr\fP(3NCURSES)
mvwinchstr/\fB\%inchstr\fP(3NCURSES)
mvwinnstr/\fB\%instr\fP(3NCURSES)
mvwinnwstr/\fB\%inwstr\fP(3NCURSES)
mvwins_nwstr/\fB\%ins_wstr\fP(3NCURSES)
mvwins_wch/\fB\%ins_wch\fP(3NCURSES)
mvwins_wstr/\fB\%ins_wstr\fP(3NCURSES)
mvwinsch/\fB\%insch\fP(3NCURSES)
mvwinsnstr/\fB\%insstr\fP(3NCURSES)
mvwinsstr/\fB\%insstr\fP(3NCURSES)
mvwinstr/\fB\%instr\fP(3NCURSES)
mvwinwstr/\fB\%inwstr\fP(3NCURSES)
mvwprintw/\fB\%printw\fP(3NCURSES)
mvwscanw/\fB\%scanw\fP(3NCURSES)
mvwvline/\fB\%border\fP(3NCURSES)
mvwvline_set/\fB\%border_set\fP(3NCURSES)
napms/\fB\%kernel\fP(3NCURSES)
newpad/\fB\%pad\fP(3NCURSES)
newterm/\fB\%initscr\fP(3NCURSES)
newwin/\fB\%window\fP(3NCURSES)
nl/\fB\%inopts\fP(3NCURSES)
nocbreak/\fB\%inopts\fP(3NCURSES)
nodelay/\fB\%inopts\fP(3NCURSES)
noecho/\fB\%inopts\fP(3NCURSES)
nofilter/\fB\%util\fP(3NCURSES)*
nonl/\fB\%inopts\fP(3NCURSES)
noqiflush/\fB\%inopts\fP(3NCURSES)
noraw/\fB\%inopts\fP(3NCURSES)
notimeout/\fB\%inopts\fP(3NCURSES)
overlay/\fB\%overlay\fP(3NCURSES)
overwrite/\fB\%overlay\fP(3NCURSES)
pair_content/\fB\%color\fP(3NCURSES)
pecho_wchar/\fB\%pad\fP(3NCURSES)
pechochar/\fB\%pad\fP(3NCURSES)
pnoutrefresh/\fB\%pad\fP(3NCURSES)
prefresh/\fB\%pad\fP(3NCURSES)
printw/\fB\%printw\fP(3NCURSES)
putp/\fB\%terminfo\fP(3NCURSES)
putwin/\fB\%util\fP(3NCURSES)
qiflush/\fB\%inopts\fP(3NCURSES)
raw/\fB\%inopts\fP(3NCURSES)
redrawwin/\fB\%refresh\fP(3NCURSES)
refresh/\fB\%refresh\fP(3NCURSES)
reset_color_pairs/\fB\%color\fP(3NCURSES)*
reset_prog_mode/\fB\%kernel\fP(3NCURSES)
reset_shell_mode/\fB\%kernel\fP(3NCURSES)
resetty/\fB\%kernel\fP(3NCURSES)
resize_term/\fB\%resizeterm\fP(3NCURSES)*
resizeterm/\fB\%resizeterm\fP(3NCURSES)*
restartterm/\fB\%terminfo\fP(3NCURSES)
ripoffline/\fB\%kernel\fP(3NCURSES)
savetty/\fB\%kernel\fP(3NCURSES)
scanw/\fB\%scanw\fP(3NCURSES)
scr_dump/\fB\%scr_dump\fP(3NCURSES)
scr_init/\fB\%scr_dump\fP(3NCURSES)
scr_restore/\fB\%scr_dump\fP(3NCURSES)
scr_set/\fB\%scr_dump\fP(3NCURSES)
scrl/\fB\%scroll\fP(3NCURSES)
scroll/\fB\%scroll\fP(3NCURSES)
scrollok/\fB\%outopts\fP(3NCURSES)
set_curterm/\fB\%terminfo\fP(3NCURSES)
set_escdelay/\fB\%threads\fP(3NCURSES)*
set_tabsize/\fB\%threads\fP(3NCURSES)*
set_term/\fB\%initscr\fP(3NCURSES)
setcchar/\fB\%getcchar\fP(3NCURSES)
setscrreg/\fB\%outopts\fP(3NCURSES)
setsyx/\fB\%kernel\fP(3NCURSES)
setupterm/\fB\%terminfo\fP(3NCURSES)
slk_attr/\fB\%slk\fP(3NCURSES)*
slk_attr_off/\fB\%slk\fP(3NCURSES)
slk_attr_on/\fB\%slk\fP(3NCURSES)
slk_attr_set/\fB\%slk\fP(3NCURSES)
slk_attroff/\fB\%slk\fP(3NCURSES)
slk_attron/\fB\%slk\fP(3NCURSES)
slk_attrset/\fB\%slk\fP(3NCURSES)
slk_clear/\fB\%slk\fP(3NCURSES)
slk_color/\fB\%slk\fP(3NCURSES)
slk_init/\fB\%slk\fP(3NCURSES)
slk_label/\fB\%slk\fP(3NCURSES)
slk_noutrefresh/\fB\%slk\fP(3NCURSES)
slk_refresh/\fB\%slk\fP(3NCURSES)
slk_restore/\fB\%slk\fP(3NCURSES)
slk_set/\fB\%slk\fP(3NCURSES)
slk_touch/\fB\%slk\fP(3NCURSES)
slk_wset/\fB\%slk\fP(3NCURSES)
standend/\fB\%attr\fP(3NCURSES)
standout/\fB\%attr\fP(3NCURSES)
start_color/\fB\%color\fP(3NCURSES)
subpad/\fB\%pad\fP(3NCURSES)
subwin/\fB\%window\fP(3NCURSES)
syncok/\fB\%window\fP(3NCURSES)
term_attrs/\fB\%termattrs\fP(3NCURSES)
termattrs/\fB\%termattrs\fP(3NCURSES)
termname/\fB\%termattrs\fP(3NCURSES)
tgetent/\fB\%termcap\fP(3NCURSES)
tgetflag/\fB\%termcap\fP(3NCURSES)
tgetnum/\fB\%termcap\fP(3NCURSES)
tgetstr/\fB\%termcap\fP(3NCURSES)
tgoto/\fB\%termcap\fP(3NCURSES)
tigetflag/\fB\%terminfo\fP(3NCURSES)
tigetnum/\fB\%terminfo\fP(3NCURSES)
tigetstr/\fB\%terminfo\fP(3NCURSES)
timeout/\fB\%inopts\fP(3NCURSES)
tiparm/\fB\%terminfo\fP(3NCURSES)
tiparm_s/\fB\%terminfo\fP(3NCURSES)*
tiscan_s/\fB\%terminfo\fP(3NCURSES)*
touchline/\fB\%touch\fP(3NCURSES)
touchwin/\fB\%touch\fP(3NCURSES)
tparm/\fB\%terminfo\fP(3NCURSES)
tputs/\fB\%termcap\fP(3NCURSES)
tputs/\fB\%terminfo\fP(3NCURSES)
trace/\fB\%trace\fP(3NCURSES)*
typeahead/\fB\%inopts\fP(3NCURSES)
unctrl/\fB\%util\fP(3NCURSES)
unget_wch/\fB\%get_wch\fP(3NCURSES)
ungetch/\fB\%getch\fP(3NCURSES)
ungetmouse/\fB\%mouse\fP(3NCURSES)*
untouchwin/\fB\%touch\fP(3NCURSES)
use_default_colors/\fB\%default_colors\fP(3NCURSES)*
use_env/\fB\%util\fP(3NCURSES)
use_extended_names/\fB\%extensions\fP(3NCURSES)*
use_legacy_coding/\fB\%legacy_coding\fP(3NCURSES)*
use_screen/\fB\%threads\fP(3NCURSES)*
use_tioctl/\fB\%util\fP(3NCURSES)*
use_window/\fB\%threads\fP(3NCURSES)*
vid_attr/\fB\%terminfo\fP(3NCURSES)
vid_puts/\fB\%terminfo\fP(3NCURSES)
vidattr/\fB\%terminfo\fP(3NCURSES)
vidputs/\fB\%terminfo\fP(3NCURSES)
vline/\fB\%border\fP(3NCURSES)
vline_set/\fB\%border_set\fP(3NCURSES)
vw_printw/\fB\%printw\fP(3NCURSES)
vw_scanw/\fB\%scanw\fP(3NCURSES)
vwprintw/\fB\%printw\fP(3NCURSES)
vwscanw/\fB\%scanw\fP(3NCURSES)
wadd_wch/\fB\%add_wch\fP(3NCURSES)
wadd_wchnstr/\fB\%add_wchstr\fP(3NCURSES)
wadd_wchstr/\fB\%add_wchstr\fP(3NCURSES)
waddch/\fB\%addch\fP(3NCURSES)
waddchnstr/\fB\%addchstr\fP(3NCURSES)
waddchstr/\fB\%addchstr\fP(3NCURSES)
waddnstr/\fB\%addstr\fP(3NCURSES)
waddnwstr/\fB\%addwstr\fP(3NCURSES)
waddstr/\fB\%addstr\fP(3NCURSES)
waddwstr/\fB\%addwstr\fP(3NCURSES)
wattr_get/\fB\%attr\fP(3NCURSES)
wattr_off/\fB\%attr\fP(3NCURSES)
wattr_on/\fB\%attr\fP(3NCURSES)
wattr_set/\fB\%attr\fP(3NCURSES)
wattroff/\fB\%attr\fP(3NCURSES)
wattron/\fB\%attr\fP(3NCURSES)
wattrset/\fB\%attr\fP(3NCURSES)
wbkgd/\fB\%bkgd\fP(3NCURSES)
wbkgdset/\fB\%bkgd\fP(3NCURSES)
wbkgrnd/\fB\%bkgrnd\fP(3NCURSES)
wbkgrndset/\fB\%bkgrnd\fP(3NCURSES)
wborder/\fB\%border\fP(3NCURSES)
wborder_set/\fB\%border_set\fP(3NCURSES)
wchgat/\fB\%attr\fP(3NCURSES)
wclear/\fB\%clear\fP(3NCURSES)
wclrtobot/\fB\%clear\fP(3NCURSES)
wclrtoeol/\fB\%clear\fP(3NCURSES)
wcolor_set/\fB\%attr\fP(3NCURSES)
wcursyncup/\fB\%window\fP(3NCURSES)
wdelch/\fB\%delch\fP(3NCURSES)
wdeleteln/\fB\%deleteln\fP(3NCURSES)
wecho_wchar/\fB\%add_wch\fP(3NCURSES)
wechochar/\fB\%addch\fP(3NCURSES)
wenclose/\fB\%mouse\fP(3NCURSES)*
werase/\fB\%clear\fP(3NCURSES)
wget_wch/\fB\%get_wch\fP(3NCURSES)
wget_wstr/\fB\%get_wstr\fP(3NCURSES)
wgetbkgrnd/\fB\%bkgrnd\fP(3NCURSES)
wgetch/\fB\%getch\fP(3NCURSES)
wgetdelay/\fB\%opaque\fP(3NCURSES)*
wgetn_wstr/\fB\%get_wstr\fP(3NCURSES)
wgetnstr/\fB\%getstr\fP(3NCURSES)
wgetparent/\fB\%opaque\fP(3NCURSES)*
wgetscrreg/\fB\%opaque\fP(3NCURSES)*
wgetstr/\fB\%getstr\fP(3NCURSES)
whline/\fB\%border\fP(3NCURSES)
whline_set/\fB\%border_set\fP(3NCURSES)
win_wch/\fB\%in_wch\fP(3NCURSES)
win_wchnstr/\fB\%in_wchstr\fP(3NCURSES)
win_wchstr/\fB\%in_wchstr\fP(3NCURSES)
winch/\fB\%inch\fP(3NCURSES)
winchnstr/\fB\%inchstr\fP(3NCURSES)
winchstr/\fB\%inchstr\fP(3NCURSES)
winnstr/\fB\%instr\fP(3NCURSES)
winnwstr/\fB\%inwstr\fP(3NCURSES)
wins_nwstr/\fB\%ins_wstr\fP(3NCURSES)
wins_wch/\fB\%ins_wch\fP(3NCURSES)
wins_wstr/\fB\%ins_wstr\fP(3NCURSES)
winsch/\fB\%insch\fP(3NCURSES)
winsdelln/\fB\%deleteln\fP(3NCURSES)
winsertln/\fB\%deleteln\fP(3NCURSES)
winsnstr/\fB\%insstr\fP(3NCURSES)
winsstr/\fB\%insstr\fP(3NCURSES)
winstr/\fB\%instr\fP(3NCURSES)
winwstr/\fB\%inwstr\fP(3NCURSES)
wmouse_trafo/\fB\%mouse\fP(3NCURSES)*
wmove/\fB\%move\fP(3NCURSES)
wnoutrefresh/\fB\%refresh\fP(3NCURSES)
wprintw/\fB\%printw\fP(3NCURSES)
wredrawln/\fB\%refresh\fP(3NCURSES)
wrefresh/\fB\%refresh\fP(3NCURSES)
wresize/\fB\%wresize\fP(3NCURSES)*
wscanw/\fB\%scanw\fP(3NCURSES)
wscrl/\fB\%scroll\fP(3NCURSES)
wsetscrreg/\fB\%outopts\fP(3NCURSES)
wstandend/\fB\%attr\fP(3NCURSES)
wstandout/\fB\%attr\fP(3NCURSES)
wsyncdown/\fB\%window\fP(3NCURSES)
wsyncup/\fB\%window\fP(3NCURSES)
wtimeout/\fB\%inopts\fP(3NCURSES)
wtouchln/\fB\%touch\fP(3NCURSES)
wunctrl/\fB\%util\fP(3NCURSES)
wvline/\fB\%border\fP(3NCURSES)
wvline_set/\fB\%border_set\fP(3NCURSES)
.TE
.PP
.IR \%ncurses 's
.I "screen-pointer extension"
adds additional functions corresponding to many of the above,
each with an \*(``_sp\*('' suffix;
see \fB\%sp_funcs\fP(3NCURSES).
.PP
The availability of some extensions is configurable when
.I \%ncurses
is compiled;
see sections \*(``ALTERNATE CONFIGURATIONS\*('' and \*(``EXTENSIONS\*(''
below.
.SH RETURN VALUE
Unless otherwise noted,
functions that return an integer return
.B OK
on success and
.B ERR
on failure.
Functions that return pointers return
.B NULL
on failure.
Typically,
.I \%ncurses
treats a null pointer passed as a function parameter as a failure.
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
.RI ( y ,
.IR x )
is outside the window boundaries.
.SH ENVIRONMENT
The following symbols from the process environment customize the
runtime behavior of
.I \%ncurses
applications.
The library may be configured to disregard the variables
.IR \%TERMINFO ,
.IR \%TERMINFO_DIRS ,
.IR \%TERMPATH ,
and
.IR HOME ,
if the user is the superuser (root),
or the application uses \fI\%setuid\fP(2) or \fI\%setgid\fP(2).
.SS "\fIBAUDRATE\fP"
The debugging library checks this variable when the application has
redirected output to a file.
Its integral value is used for the baud rate.
If that value is absent or invalid,
.I \%ncurses
uses 9600.
This feature allows testers to construct repeatable test cases
that take into account optimization decisions that depend on baud rate.
.SS "\fICC\fP (command character)"
When set,
the
.B \%command_character
.RB ( \%cmdch )
capability value of loaded
.I \%term\%info
entries changes to the value of this variable.
Very few
.I \%term\%info
entries provide this feature.
.PP
Because this name is also used in development environments to represent
the C compiler's name,
.I \%ncurses
ignores its value if it is not one character in length.
.SS "\fICOLUMNS\fP"
This variable specifies the width of the screen in characters.
Applications running in a windowing environment usually are able to
obtain the width of the window in which they are executing.
If
.I \%COLUMNS
is not defined and the terminal's screen size is not available from the
terminal driver,
.I \%ncurses
uses the size specified by the
.B \%columns
.RB ( \%cols )
capability of the terminal type's entry in the
.I \%term\%info
database,
if any.
.PP
It is important that your application use the correct screen size.
Automatic detection thereof is not always possible because an
application may be running on a host that does not honor NAWS
(Negotiations About Window Size)
or as a different user ID than the owner of the terminal device file.
Setting
.I \%COLUMNS
and/or
.I \%LINES
overrides the library's use of the screen size obtained from the
operating system.
.PP
The
.I \%COLUMNS
and
.I \%LINES
variables may be specified independently.
This property is useful to circumvent misfeatures of legacy terminal
type descriptions;
\fI\%xterm\fP(1) descriptions specifying 65 lines were once notorious.
For best results,
avoid specifying
.B cols
and
.B lines
capability codes in
.I \%term\%info
descriptions of terminal emulators.
.PP
\fB\%use_env\fP(3NCURSES) can disable use of the process environment
in determining the screen size.
\fB\%use_tioctl\fP(3NCURSES) can update
.I \%COLUMNS
and
.I \%LINES
to match the screen size obtained from system calls or the terminal
database.
.SS "\fIESCDELAY\fP"
For
.I curses
to distinguish the ESC character resulting from a user's press of the
\*(``Escape\*('' key on the input device from one beginning an
.I "escape sequence"
(as commonly produced by function keys),
it waits after receiving the escape character to see if further
characters are available on the input stream within a short interval.
A global variable
.B \%ESCDELAY
stores this interval in milliseconds.
The default value of 1000
(one second)
is adequate for most uses.
This environment variable overrides it.
.PP
The most common instance where you may wish to change this value
is to work with a remote host over a slow communication channel.
If the host running a
.I curses
application does not receive the characters of an escape sequence in a
timely manner,
the library can interpret them as multiple key stroke events.
.PP
\fI\%xterm\fP(1) mouse events are a form of escape sequence;
therefore,
if your application makes heavy use of multiple-clicking,
you may wish to lengthen the default value because the delay applies
to the composite multi-click event as well as the individual clicks.
.PP
Portable applications should not rely upon the presence of
.B \%ESCDELAY
in either form,
but setting the environment variable rather than the global variable
does not create problems when compiling an application.
.PP
If \fB\%keypad\fP(3NCURSES) is disabled for the
.I curses
window receiving input,
a program must disambiguate escape sequences itself.
.SS "\fIHOME\fP"
.I \%ncurses
may read and write auxiliary terminal descriptions in
.I \%.termcap
and
.I \%.terminfo
files in the user's home directory.
.SS "\fILINES\fP"
This counterpart to
.I \%COLUMNS
specifies the height of the screen in characters.
The corresponding
.I \%term\%info
capability and code is
.BR \%lines .
See the description of the
.I \%COLUMNS
variable above.
.SS "\fIMOUSE_BUTTONS_123\fP"
(OS/2 EMX port only)
OS/2 numbers a three-button mouse inconsistently with other platforms,
such that 1 is the left button,
2 the right,
and 3 the middle.
This variable customizes the mouse button numbering.
Its value must be three digits 1\-3 in any order.
By default,
.I \%ncurses
assumes a numbering of \*(``132\*(''.
.SS "\fINCURSES_ASSUMED_COLORS\fP"
If set,
this variable overrides the
.I \%ncurses
library's compiled-in assumption that the terminal's default colors are
white on black;
see \fB\%default_colors\fP(3NCURSES).
Set the foreground and background color values with this environment
variable by assigning it two integer values separated by a comma,
indicating foregound and background color numbers,
respectively.
.PP
For example,
to tell
.I \%ncurses
not to assume anything about the colors,
use a value of \*(``\-1,\-1\*(''.
To make the default color scheme green on black,
use \*(``2,0\*(''.
.I \%ncurses
accepts integral values from \-1 up to the value of the
.I \%term\%info
.B \%max_colors
.RB ( colors )
capability.
.SS "\fINCURSES_CONSOLE2\fP"
(MinGW port only)
The
.I \%Console2
.\" https://www.hanselman.com/blog/console2-a-better-windows-command-prompt
program defectively handles the Microsoft Console API call
.IR \%Create\%Console\%Screen\%Buffer .
Applications that use it will hang.
However,
it is possible to simulate the action of this call by mapping
coordinates,
explicitly saving and restoring the original screen contents.
Setting the environment variable
.I \%NCGDB
has the same effect.
.SS "\fINCURSES_GPM_TERMS\fP"
(Linux only)
When
.I \%ncurses
is configured to use the GPM interface,
this variable may list one or more terminal names
against which the
.I TERM
variable
(see below)
is matched.
An empty value disables the GPM interface,
using
.IR \%ncurses 's
built-in support for \fIxterm\fP(1) mouse protocols instead.
If the variable is absent,
.I \%ncurses
attempts to open GPM if
.I TERM
contains \*(``linux\*(''.
.SS "\fINCURSES_NO_HARD_TABS\fP"
.I \%ncurses
may use tab characters in cursor movement optimization.
In some cases,
your terminal driver may not handle them properly.
Set this environment variable to any value to disable the feature.
You can also adjust your \fI\%stty\fP(1) settings to avoid the problem.
.SS "\fINCURSES_NO_MAGIC_COOKIE\fP"
Many terminals store video attributes as a property of a character cell,
as
.I curses
does.
Historically,
some recorded changes in video attributes as data that logically
.I occupies
character cells on the display,
switching attributes on or off,
similarly to tags in a markup language;
these are termed \*(``magic cookies\*('',
and must be subsequently overprinted.
If the
.I \%term\%info
entry for your terminal type does not adequately describe its handling
of magic cookies,
set this variable to any value to instruct
.I \%ncurses
to disable attributes entirely.
.SS "\fINCURSES_NO_PADDING\fP"
Most terminal type descriptions in the
.I \%term\%info
database detail hardware devices.
Many people use
.IR curses -based
applications in terminal emulator programs that run in a windowing
environment.
These programs can duplicate all of the important features of a hardware
terminal,
but often lack their limitations.
Chief among these absent drawbacks is the problem of data flow
management;
that is,
limiting the speed of communication to what the hardware could handle.
Unless a hardware terminal is interfaced into a terminal concentrator
(which does flow control),
an application must manage flow control itself to prevent overruns and
data loss.
.PP
A solution that comes at no hardware cost is for an application to pause
after directing a terminal to execute an operation that it performs
slowly,
such as clearing the display.
Many terminal type descriptions,
including that for the VT100,
embed delay specifications in capabilities.
You may wish to use these terminal descriptions without paying the
performance penalty.
Set
.I \%NCURSES_NO_PADDING
to any value to disable all but mandatory padding.
Mandatory padding is used by such terminal capabilities as
.B \%flash_screen
.RB ( flash ).
.SS "\fINCURSES_NO_SETBUF\fP"
(Obsolete)
Prior to internal changes developed in
.I \%ncurses
5.9
(patches 20120825 through 20130126),
the library used \fI\%setbuf\fP(3) to enable fully buffered output when
initializing the terminal.
This was done,
as in SVr4
.IR curses ,
to increase performance.
For testing purposes,
both of
.I \%ncurses
and of certain applications,
this feature was made optional.
Setting this variable disabled output buffering,
leaving the output stream in the original
(usually line-buffered)
mode.
.PP
Nowadays,
.I \%ncurses
performs its own buffering and does not require this workaround;
it does not modify the buffering of the standard output stream.
This approach makes signal handling,
as for interrupts,
more robust.
A drawback is that certain unconventional programs mixed
\fI\%stdio\fP(3) calls with
.I \%ncurses
calls and (usually)
got the behavior they expected.
This is no longer the case;
.I \%ncurses
does not write to the standard output file descriptor through a
.IR stdio -buffered
stream.
.PP
As a special case,
low-level API calls such as \fB\%putp\fP(3NCURSES) still use the
standard output stream.
High-level
.I curses
calls such as \fB\%printw\fP(3NCURSES) do not.
.SS "\fINCURSES_NO_UTF8_ACS\fP"
At initialization,
.I \%ncurses
inspects the
.I TERM
environment variable for special cases where VT100 forms-drawing
characters
(and the corresponding alternate character set
.I \%term\%info
capabilities)
are known to be unsupported by terminal types that otherwise claim VT100
compatibility.
Specifically,
when running in a UTF-8 locale,
the Linux virtual console device and the GNU \fI\%screen\fP(1)
program ignore them.
Set this variable to a nonzero value to instruct
.I \%ncurses
that the terminal's ACS support is broken;
the library then outputs Unicode code points that correspond to the
forms-drawing
characters.
Set it to zero
(or a non-integer)
to disable the special check for terminal type names matching
\*(``linux\*('' or \*(``screen\*('',
directing
.I \%ncurses
to assume that the ACS feature works if the terminal type description
advertises it.
.PP
As an alternative to use of this variable,
.I \%ncurses
checks for an extended
.I \%term\%info
numeric capability \fBU8\fP
that can be compiled using
.RB \*(`` "tic \-x" \*(''.
Examples follow.
.PP
.RS 3
.EX
# linux console, if patched to provide working
# VT100 shift\-in/shift\-out, with corresponding font.
linux\-vt100|linux console with VT100 line\-graphics,
U8#0, use=linux,
\&
# uxterm with vt100Graphics resource set to false
xterm\-utf8|xterm relying on UTF\-8 line\-graphics,
U8#1, use=xterm,
.EE
.RE
.PP
The two-character name \*(``U8\*('' was chosen to permit its use via
.IR \%ncurses 's
.I termcap
interface.
.SS "\fINCURSES_TRACE\fP"
At initialization,
.I \%ncurses
(in its debugging configuration)
checks for this variable's presence.
If defined with an integral value,
the library calls \fB\%curses_trace\fP(3NCURSES) with that value as the
argument.
.SS "\fITERM\fP"
The
.I TERM
variable denotes the terminal type.
Each is distinct,
though many are similar.
It is commonly set by terminal emulators to help applications find a
workable terminal description.
Some choose a popular approximation such as \*(``ansi\*('',
\*(``vt100\*('', or \*(``xterm\*('' rather than an exact fit to their
capabilities.
Not infrequently,
an application will have problems with that approach;
for example,
a key stroke may not operate correctly,
or produce no effect but seeming garbage characters on the screen.
.PP
Setting
.I TERM
has no effect on hardware operation;
it affects the way applications communicate with the terminal.
Likewise,
as a general rule
(\fIxterm\fP(1) being a rare exception),
terminal emulators that allow you to specify
.I TERM
as a parameter or configuration value do not change their behavior to
match that setting.
.SS "\fITERMCAP\fP"
If
.I \%ncurses
is configured with
.I termcap
support,
it checks for a terminal type description in
.I termcap
format if one in
.I \%term\%info
format is not available.
Setting this variable directs
.I \%ncurses
to ignore the usual
.I termcap
database location,
.IR \%/etc/termcap ;
see
.I \%TERMPATH
below.
.I \%TERMCAP
should contain either a terminal description
(with newlines stripped out),
or a file name indicating where the information required by the
.I TERM
environment variable is stored.
.SS "\fITERMINFO\fP"
.I \%ncurses
can be configured to read terminal type description databases in various
locations using different formats.
This variable overrides the default location.
.bP
Descriptions in
.I \%term\%info
format are normally stored in a directory tree using subdirectories
named by the common first letters of the terminal types named therein.
This is the scheme used in System\ V.
.bP
If
.I \%ncurses
is configured to use hashed databases,
then
.I \%TERM\%INFO
may name its location,
such as
.IR \%/usr/share/terminfo.db ,
rather than
.IR \%/usr/share/terminfo/ .
.PP
The hashed database uses less disk space and is a little faster than the
directory tree.
However,
some applications assume the existence of the directory tree,
and read it directly
rather than using the
.I \%term\%info
API.
.bP
If
.I \%ncurses
is configured with
.I termcap
support,
this variable may contain the location of a
.I \%termcap
file.
.bP
If the value of
.I \%TERM\%INFO
begins with \*(``hex:\*('' or \*(``b64:\*('',
.I \%ncurses
uses the remainder of the value as a compiled
.I \%term\%info
description.
You might produce the base64 format using \fB\%infocmp\fP(1).
.RS 4
.IP
.EX
TERMINFO=$(infocmp \-0 \-Q2 \-q)
export TERMINFO
.EE
.RE
.IP
The compiled description is used only if it corresponds to the terminal
type identified by
.IR TERM .
.PP
Setting
.I \%TERM\%INFO
is the simplest,
but not the only,
way to direct
.I \%ncurses
to a terminal database.
The search path is as follows.
.bP
the last terminal database to which the running
.I \%ncurses
application wrote,
if any
.bP
the location specified by the
.I \%TERM\%INFO
environment variable
.bP
.I $HOME/.terminfo
.bP
locations listed in the
.I \%TERMINFO_DIRS
environment variable
.ds td \" empty
.if !'/etc/terminfo:/lib/terminfo:/usr/share/terminfo'no default value' .as td /etc/terminfo:/lib/terminfo:/usr/share/terminfo
.if !'/etc/terminfo\*(td'' \{\
.bP
location(s) configured and compiled into
.I \%ncurses
.RS 3
.if !'\*(td'' \{\
.bP
.I \%/etc/terminfo:/lib/terminfo:/usr/share/terminfo
.\}
.if !'@TERMINFO'' .if !'\*(td'/etc/terminfo' \{\
.bP
.I \%/etc/terminfo
.\}
.\}
.RE
.SS "\fITERMINFO_DIRS\fP"
This variable specifies a list of locations,
akin to
.IR PATH ,
in which
.I \%ncurses
searches for the terminal type descriptions described by
.I \%TERMINFO
above.
The list items are separated by colons on Unix
and semicolons on OS/2 EMX.
System\ V
.I \%term\%info
lacks a corresponding feature;
.I \%TERMINFO_DIRS
is an
.I \%ncurses
extension.
.SS "\fITERMPATH\fP"
If
.I \%TERMCAP
does not hold a terminal type description or file name,
then
.I \%ncurses
checks the contents of
.IR \%TERMPATH ,
a list of locations,
akin to
.IR PATH ,
in which it searches for
.I termcap
terminal type descriptions.
The list items are separated by colons on Unix
and semicolons on OS/2 EMX.
.PP
If both
.I \%TERMCAP
and
.I \%TERMPATH
are unset or invalid,
.I \%ncurses
searches for the files
.IR \%/etc/termcap ,
.IR \%/usr/share/misc/termcap ,
and
.IR \%$HOME/.termcap ,
in that order.
.SH "ALTERNATE CONFIGURATIONS"
Many different
.I \%ncurses
configurations are possible,
determined by the options given to the
.I \%configure
script when building the library.
Run the script with the
.B \-\-help
option to peruse them all.
A few are of particular significance to the application developer
employing
.IR \%ncurses .
.TP 5
.B \-\-disable\-overwrite
The standard include for \fI\%ncurses\fP is as noted in \fBSYNOPSIS\fP:
.RS 5
.PP
.RS 4
.EX
\fB#include <curses.h>\fP
.EE
.RE
.PP
This option is used to avoid filename conflicts when \fI\%ncurses\fP
is not the main implementation of curses of the computer.
If \fI\%ncurses\fP is installed disabling overwrite,
it puts its headers in a subdirectory,
e.g.,
.PP
.RS 4
.EX
\fB#include <ncurses/curses.h>\fP
.EE
.RE
.PP
It also omits a symbolic link which would allow you to use \fB\-lcurses\fP
to build executables.
.RE
.TP 5
.B \-\-enable\-widec
The configure script renames the library and
(if the \fB\-\-disable\-overwrite\fP option is used)
puts the header files in a different subdirectory.
All of the library names have a \*(``w\*('' appended to them,
i.e., instead of
.RS 5
.PP
.RS 4
.EX
\fB\-lncurses\fP
.EE
.RE
.PP
you link with
.PP
.RS 4
.EX
\fB\-lncursesw\fP
.EE
.RE
.PP
You must also enable the wide-character features in the header file
when compiling for the wide-character library
to use the extended (wide-character) functions.
The symbol which enables these features has changed
since X/Open Curses, Issue 4:
.bP
Originally, the wide-character feature required the symbol
\fB_XOPEN_SOURCE_EXTENDED\fP
but that was only valid for XPG4 (1996).
.bP
Later, that was deemed conflicting with \fB_XOPEN_SOURCE\fP defined to 500.
.bP
As of mid-2018,
none of the features in this implementation require a \fB_XOPEN_SOURCE\fP
feature greater than 600.
However, X/Open Curses, Issue 7 (2009) recommends defining it to 700.
.bP
Alternatively, you can enable the feature by defining \fBNCURSES_WIDECHAR\fP
with the caveat that some other header file than \fBcurses.h\fP
may require a specific value for \fB_XOPEN_SOURCE\fP
(or a system-specific symbol).
.PP
The \fI\%curses.h\fP header file installed for the wide-character
library is designed to be compatible with the non-wide library's header.
Only the size of the \fI\%WINDOW\fP structure differs;
few applications require more than pointers to \fI\%WINDOW\fPs.
.PP
If the headers are installed allowing overwrite,
the wide-character library's headers should be installed last,
to allow applications to be built using either library
from the same set of headers.
.RE
.TP 5
.B \-\-with\-pthread
The configure script renames the library.
All of the library names have a \*(``t\*('' appended to them
(before any \*(``w\*('' added by \fB\-\-enable\-widec\fP).
.IP
The global variables such as \fBLINES\fP are replaced by macros to
allow read-only access.
At the same time, setter-functions are provided to set these values.
Some applications (very few) may require changes to work with this convention.
.TP 5
.B \-\-with\-shared
.tQ
.B \-\-with\-normal
.tQ
.B \-\-with\-debug
.tQ
.B \-\-with\-profile
The shared and normal (static) library names differ by their suffixes,
e.g., \fBlibncurses.so\fP and \fBlibncurses.a\fP.
The debug and profiling libraries add a \*(``_g\*(''
and a \*(``_p\*('' to the root names respectively,
e.g., \fBlibncurses_g.a\fP and \fBlibncurses_p.a\fP.
.TP 5
.B \-\-with\-termlib
Low-level functions which do not depend upon whether the library
supports wide-characters, are provided in the tinfo library.
.IP
By doing this, it is possible to share the tinfo library between
wide/normal configurations as well as reduce the size of the library
when only low-level functions are needed.
.IP
Those functions are described in these pages:
.RS
.bP
\fB\%extensions\fP(3NCURSES) \- miscellaneous \fIcurses\fP extensions
.bP
\fB\%inopts\fP(3NCURSES) \- \fIcurses\fP input options
.bP
\fB\%kernel\fP(3NCURSES) \- low-level \fIcurses\fP routines
.bP
\fB\%termattrs\fP(3NCURSES) \- \fIcurses\fP environment query routines
.bP
\fB\%termcap\fP(3NCURSES) \- \fIcurses\fP emulation of \fItermcap\fP
.bP
\fB\%terminfo\fP(3NCURSES) \- \fIcurses\fP interface to \fIterminfo\fP
database
.bP
\fB\%util\fP(3NCURSES) \- miscellaneous \fIcurses\fP utility routines
.RE
.TP 5
.B \-\-with\-trace
The \fBtrace\fP function normally resides in the debug library,
but it is sometimes useful to configure this in the shared library.
Configure scripts should check for the function's existence rather
than assuming it is always in the debug library.
.SH FILES
.TP
.I /usr/share/tabset
tab stop initialization database
.TP
.I \*d
compiled terminal capability database
.SH NOTES
X/Open Curses permits most functions it specifies to be made available
as macros as well.
.\" See X/Open Curses Issue 4, Version 2, pp. 227-234.
.\" See X/Open Curses Issue 7, pp. 311-318.
\fI\%ncurses\fP does so
.bP
for functions that return values via their parameters,
.bP
to support obsolete features,
.bP
to reuse functions
(for example,
those that move the cursor before another operation),
and
.bP
a few special cases.
.PP
If the standard output file descriptor of an
.I \%ncurses
program is redirected to something that is not a terminal device,
the library writes screen updates to the standard error file descriptor.
This was an undocumented feature of SVr3
.IR curses .
.PP
See subsection \*(``Header Files\*('' below regarding symbols exposed by
inclusion of \fI\%curses.h\fP.
.SH EXTENSIONS
.I \%ncurses
enables an application to capture mouse events on certain terminals,
including \fI\%xterm\fP(1);
see \fB\%mouse\fP(3NCURSES).
.PP
.I \%ncurses
provides a means of responding to window resizing events,
as when running in a GUI terminal emulator application such as
.IR \%xterm ;
see \fB\%resizeterm\fP(3NCURSES) and \fB\%wresize\fP(3NCURSES).
.PP
.I \%ncurses
allows an application to query the terminal for the presence of a wide
variety of special keys;
see \fB\%has_key\fP(3NCURSES).
.PP
.I \%ncurses
extends the fixed set of function key capabilities specified by X/Open
Curses by allowing the application programmer to define additional key
events at runtime;
see
\fB\%define_key\fP(3NCURSES),
\fB\%key_defined\fP(3NCURSES),
\fB\%keybound\fP(3NCURSES),
and
\fB\%keyok\fP(3NCURSES).
.PP
.I \%ncurses
can exploit the capabilities of terminals implementing ISO\ 6429/ECMA-48
SGR\ 39 and SGR\ 49 sequences,
which allow an application to reset the terminal to its original
foreground and background colors.
From a user's perspective,
the application is able to draw colored text on a background whose color
is set independently,
providing better control over color contrasts.
See \fB\%default_colors\fP(3NCURSES).
.PP
An
.I \%ncurses
application can eschew knowledge of
.I \%WINDOW
structure internals,
instead using accessor functions such as
\fB\%is_scrollok\fP(3NCURSES).
.PP
.I \%ncurses
enables an application to direct application output to a printer
attached to the terminal device;
see \fB\%print\fP(3NCURSES).
.PP
.I \%ncurses
offers \fB\%slk_attr\fP(3NCURSES) as a counterpart of \fB\%attr_get\fP(3NCURSES) for
soft-label key lines,
and \fB\%extended_slk_color\fP(3NCURSES) as a form of \fB\%slk_color\fP(3NCURSES)
that can gather color information from them when many colors are
supported.
.PP
Some extensions are available only if
.I \%ncurses
permits modification of \fB\%unctrl\fP(3NCURSES)'s behavior;
see \fB\%use_legacy_coding\fP(3NCURSES).
.I \%ncurses
is compiled to support them;
section \*(``ALTERNATE CONFIGURATIONS\*('' describes how.
.bP
Rudimentary support for multi-threaded applications may be available;
see \fB\%threads\fP(3NCURSES).
.bP
Functions that ease the management of multiple screens can be exposed;
see \fB\%sp_funcs\fP(3NCURSES).
.bP
To aid applications to debug their memory usage,
.I ncurses
optionally offers functions to more aggressively free memory it
dynamically allocates itself;
see \fB\%memleaks\fP(3NCURSES).
.bP
The library facilitates auditing and troubleshooting of its behavior;
see \fB\%trace\fP(3NCURSES).
.bP
The compiler option
.B \%\-DUSE_GETCAP
causes the library to fall back to reading
.I \%/etc/termcap
if the terminal setup code cannot find a
.I \%term\%info
entry corresponding to
.IR TERM .
Use of this feature is not recommended,
as it essentially includes an entire
.I termcap
compiler in the
.I \%ncurses
startup code,
at a cost in memory usage and application launch latency.
.PP
.I \%PDCurses
and NetBSD
.I curses
incorporate some
.I \%ncurses
extensions.
Individual man pages indicate where this is the case.
.SH PORTABILITY
X/Open Curses defines two levels of conformance,
\*(``base\*('' and \*(``enhanced\*(''.
The latter includes several additional features,
such as wide-character and color support.
.I \%ncurses
intends base-level conformance with X/Open Curses,
and supports all features of its enhanced level
except the \fB\%untic\fP utility.
.PP
Differences between X/Open Curses and
.I \%ncurses
are documented in the \*(``PORTABILITY\*('' sections of applicable man
pages.
.SS "Error Checking"
In many cases, X/Open Curses is vague about error conditions,
omitting some of the SVr4 documentation.
.PP
Unlike other implementations,
.I \%ncurses
checks pointer parameters,
such as those to
.I \%WINDOW
structures,
to ensure that they are not null.
This is done primarily to guard against programmer error.
The standard interface does not provide a way for the library
to tell an application which of several possible errors occurred.
Relying on this
(or some other)
extension adversely affects the portability of
.I curses
applications.
.SS "Padding Differences"
In historical
.I curses
implementations,
delays embedded in the
.I \%term\%info
capabilities
.B \%carriage_return
.RB ( cr ),
.B \%scroll_forward
.RB ( ind ),
.B \%cursor_left
.RB ( cub1 ),
.B \%form_feed
.RB ( ff ),
and
.B \%tab
.RB ( ht )
activated corresponding delay bits in the Unix terminal driver.
.I \%ncurses
performs all padding by sending NUL bytes to the device.
This method is slightly more expensive,
but narrows the interface to the Unix kernel significantly and
correspondingly increases the package's portability.
.SS "Header Files"
The header file
.I \%curses.h
itself includes the header files
.I \%stdio.h
and
.IR \%unctrl.h .
.PP
X/Open Curses has more to say,
.RS 4
.PP
The inclusion of
.I \%curses.h
may make visible all symbols from the headers
.IR \%stdio.h ,
.IR \%term.h ,
.IR \%termios.h ,
and
.IR \%wchar.h .
.RE
.PP
but does not finish the story.
A more complete account follows.
.bP
Starting with 4BSD
.I curses
(1980)
all implementations have provided a
.I \%curses.h
file.
.IP
BSD
.I curses
code included
.I \%curses.h
and
.I \%unctrl.h
from an internal header file
.IR \%curses.ext ,
where
\*(``ext\*('' abbreviated \*(``externs\*(''.
.IP
The implementations of
.I \%printw
and
.I \%scanw
used undocumented internal functions of the standard I/O library
.RI ( _doprnt
and
.IR _doscan ),
but nothing in
.I \%curses.h
itself relied upon
.IR \%stdio.h .
.bP
SVr2
.I curses
added
.IR \%newterm ,
which relies upon
.I \%stdio.h
because its function prototype employs the
.I FILE
type.
.IP
SVr4
.I curses
added
.I \%putwin
and
.IR \%getwin ,
which also use
.IR \%stdio.h .
.IP
X/Open Curses specifies all three of these functions.
.IP
SVr4
.I curses
and X/Open Curses do not require the developer to include
.I \%stdio.h
before
.IR \%curses.h .
Both document use of
.I curses
as requiring only
.IR \%curses.h .
.IP
As a result,
standard
.I \%curses.h
always includes
.IR \%stdio.h .
.bP
X/Open Curses and SVr4
.I curses
are inconsistent with respect to
.IR \%unctrl.h .
.IP
As noted in \fB\%util\fP(3NCURSES),
.I \%ncurses
includes
.I \%unctrl.h
from
.I \%curses.h
(as SVr4 does).
.bP
X/Open Curses's comments about
.I \%term.h
and
.I \%termios.h
may refer to HP-UX and AIX.
.IP
HP-UX
.I curses
includes
.I \%term.h
from
.I \%curses.h
to declare
.I \%setupterm
in
.IR \%curses.h ,
but
.I \%ncurses
and Solaris
.I curses
do not.
.IP
AIX
.I curses
includes
.I \%term.h
and
.IR \% termios.h .
Again,
.I \%ncurses
and Solaris
.I curses
do not.
.bP
X/Open Curses says that
.I \%curses.h
.B may
include
.IR \%term.h ,
but does not require it to do so.
.IP
Some programs use functions declared in both
.I \%curses.h
and
.IR \%term.h ,
and must include both header files in the same module.
Very old versions of AIX
.I curses
required inclusion of
.I \%curses.h
before
.IR \%term.h .
.IP
The header files supplied by
.I \%ncurses
include the standard library headers required for its declarations,
so
.IR \%ncurses 's
own header files can be included in any order.
But for portability,
you should include
.I \%curses.h
before
.IR \%term.h .
.bP
X/Open Curses says \*(``may make visible\*('' because including a header
file does not necessarily make visible all of the symbols in it
(consider
.B \%#ifdef
and similar).
.IP
For instance,
.IR \%ncurses 's
.I \%curses.h
.B may \" bold to contrast with preceding italic
include
.I \%wchar.h
if the proper symbol is defined,
and if
.I \%ncurses
is configured for wide-character support.
If
.I \%wchar.h
is included,
its symbols
.B may \" bold for consistency in this paragraph
be made visible depending on the value of the
.B _XOPEN_SOURCE
feature test macro.
.bP
X/Open Curses mandates an application's inclusion of one standard C
library header in a special case:
.I \%stdarg.h
before
.I \%curses.h
to prototype the functions
.I \%vw_printw
and
.I \%vw_scanw
(as well as the obsolete
.I \%vwprintw
and
.IR \%vwscanw ).
Each of these takes a variadic argument list,
a
.I \%va_list
parameter,
like that of \fI\%printf\fP(3).
.IP
SVr3
.I curses
introduced
the two obsolete functions,
and X/Open Curses the others.
In between,
SVr4
.I curses
provided for the possibility that an application might include either
.I \%varargs.h
or
.IR \%stdarg.h .
These represented contrasting approaches to handling variadic
argument lists.
The older interface,
.IR \%varargs.h ,
used a pointer to
.I char \" V7, 32V, System III, 3BSD
for variadic functions'
.I \%va_list
parameter.
Later,
the list acquired its own standard data type,
.IR \%va_list ,
defined in
.IR \%stdarg.h ,
empowering the compiler to check the types of a function call's actual
parameters against the formal ones declared in its prototype.
.IP
No conforming implementations of X/Open Curses require an application
to include
.I \%stdarg.h
before
.I \%curses.h
because they either have allowed for a special type,
or,
like
.IR \%ncurses ,
they include
.I \%stdarg.h
themselves to provide a portable interface.
.SH AUTHORS
Zeyd M. Ben-Halim,
Eric S. Raymond,
Thomas E. Dickey.
Based on
.I \%pcurses
by Pavel Curtis.
.SH SEE ALSO
\fB\%curses_variables\fP(3NCURSES),
\fB\%terminfo\fP(5),
\fB\%user_caps\fP(5)
|