Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | '\" t |
| 2 | .\"*************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 3 | .\" Copyright 2018-2023,2024 Thomas E. Dickey * |
| 4 | .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 5 | .\" * |
| 6 | .\" Permission is hereby granted, free of charge, to any person obtaining a * |
| 7 | .\" copy of this software and associated documentation files (the * |
| 8 | .\" "Software"), to deal in the Software without restriction, including * |
| 9 | .\" without limitation the rights to use, copy, modify, merge, publish, * |
| 10 | .\" distribute, distribute with modifications, sublicense, and/or sell * |
| 11 | .\" copies of the Software, and to permit persons to whom the Software is * |
| 12 | .\" furnished to do so, subject to the following conditions: * |
| 13 | .\" * |
| 14 | .\" The above copyright notice and this permission notice shall be included * |
| 15 | .\" in all copies or substantial portions of the Software. * |
| 16 | .\" * |
| 17 | .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 18 | .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 19 | .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 20 | .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 21 | .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 22 | .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 23 | .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 24 | .\" * |
| 25 | .\" Except as contained in this notice, the name(s) of the above copyright * |
| 26 | .\" holders shall not be used in advertising or otherwise to promote the * |
| 27 | .\" sale, use or other dealings in this Software without prior written * |
| 28 | .\" authorization. * |
| 29 | .\"*************************************************************************** |
| 30 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 31 | .\" $Id: ncurses.3x,v 1.214 2024/04/27 17:55:43 tom Exp $ |
| 32 | .TH ncurses 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" |
| 33 | .ie \n(.g \{\ |
| 34 | .ds `` \(lq |
| 35 | .ds '' \(rq |
| 36 | .\} |
| 37 | .el \{\ |
| 38 | .ie t .ds `` `` |
| 39 | .el .ds `` "" |
| 40 | .ie t .ds '' '' |
| 41 | .el .ds '' "" |
| 42 | .\} |
| 43 | . |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 44 | .de bP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 45 | .ie n .IP \(bu 4 |
| 46 | .el .IP \(bu 2 |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 47 | .. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 48 | . |
| 49 | .\" Add supplementary paragraph tag on its own line after TP. |
| 50 | .\" Adapted from TQ (which would produce mandoc warnings). |
| 51 | .de tQ |
| 52 | . br |
| 53 | . ns |
| 54 | . TP |
| 55 | .. |
| 56 | . |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 57 | .ds d @TERMINFO@ |
| 58 | .SH NAME |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 59 | \fB\%ncurses\fP \- |
| 60 | character-cell terminal interface with optimized output |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 61 | .SH SYNOPSIS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 62 | .nf |
| 63 | \fB#include <curses.h> |
| 64 | .fi |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 65 | .SH DESCRIPTION |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 66 | The \*(``new curses\*('' library offers the programmer a |
| 67 | terminal-independent means of reading keyboard and mouse input and |
| 68 | updating character-cell terminals with output optimized to minimize |
| 69 | screen updates. |
| 70 | .I \%ncurses |
| 71 | replaces the |
| 72 | .I curses |
| 73 | libraries from |
| 74 | System V Release 4 Unix (\*(``SVr4\*('') |
| 75 | and |
| 76 | 4.4BSD Unix, |
| 77 | the development of which ceased in the 1990s. |
| 78 | This document describes |
| 79 | .I \%ncurses |
| 80 | version @NCURSES_MAJOR@.@NCURSES_MINOR@ |
| 81 | (patch @NCURSES_PATCH@). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 82 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 83 | .I \%ncurses |
| 84 | permits control of the terminal screen's contents; |
| 85 | abstraction and subdivision thereof with |
| 86 | .I windows |
| 87 | and |
| 88 | .IR pads ; |
| 89 | the reading of terminal input; |
| 90 | control of terminal input and output options; |
| 91 | environment query routines; |
| 92 | color manipulation; |
| 93 | the definition and use of |
| 94 | .I "soft label" |
| 95 | keys; |
| 96 | .I \%term\%info |
| 97 | capability access; |
| 98 | a |
| 99 | .I termcap |
| 100 | compatibility interface; |
| 101 | and an abstraction of the system's API for manipulating the terminal |
| 102 | (such as \fI\%termios\fP(3)). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 103 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 104 | .I \%ncurses |
| 105 | implements the standard interface described by |
| 106 | X/Open Curses Issue\ 7. |
| 107 | In many behavioral details not standardized by X/Open, |
| 108 | .I \%ncurses |
| 109 | emulates the |
| 110 | .I curses |
| 111 | library of SVr4 and provides numerous useful extensions. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 112 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 113 | .I \%ncurses |
| 114 | man pages employ several sections to clarify matters of usage and |
| 115 | interoperability with other |
| 116 | .I curses |
| 117 | implementations. |
| 118 | .bP |
| 119 | \*(``NOTES\*('' describes issues and caveats of which any user of the |
| 120 | .I \%ncurses |
| 121 | API should be aware, |
| 122 | such as limitations on the size of an underlying integral type or the |
| 123 | availability of a preprocessor macro exclusive of a function definition |
| 124 | (which prevents its address from being taken). |
| 125 | This section also describes implementation details that will be |
| 126 | significant to the programmer but which are not standardized. |
| 127 | .bP |
| 128 | \*(``EXTENSIONS\*('' presents |
| 129 | .I \%ncurses |
| 130 | innovations beyond the X/Open Curses standard and/or the SVr4 |
| 131 | .I curses |
| 132 | implementation. |
| 133 | They are termed |
| 134 | .I extensions |
| 135 | to indicate that they cannot be implemented solely by using the library |
| 136 | API, |
| 137 | but require access to the library's internal state. |
| 138 | .bP |
| 139 | \*(``PORTABILITY\*('' discusses matters |
| 140 | (beyond the exercise of extensions) |
| 141 | that should be considered when writing to a |
| 142 | .I curses |
| 143 | standard, |
| 144 | or for multiple implementations. |
| 145 | .bP |
| 146 | \*(``HISTORY\*('' examines points of detail in |
| 147 | .I \%ncurses |
| 148 | and other |
| 149 | .I curses |
| 150 | implementations over the decades of their development, |
| 151 | particularly where precedent or inertia have frustrated better design |
| 152 | (and, |
| 153 | in a few cases, |
| 154 | where such inertia has been overcome). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 155 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 156 | A |
| 157 | .I curses |
| 158 | application must be linked with the library; |
| 159 | use the |
| 160 | .B \-lncurses |
| 161 | option to your compiler or linker. |
| 162 | A debugging version of the library may be available; |
| 163 | if so, |
| 164 | link with it using |
| 165 | .BR \-lncurses_g . |
| 166 | (Your system integrator may have installed these libraries such that you |
| 167 | can use the options |
| 168 | .B \-lcurses |
| 169 | and |
| 170 | .BR \-lcurses_g , |
| 171 | respectively.) |
| 172 | The |
| 173 | .I \%ncurses_g |
| 174 | library generates trace logs |
| 175 | (in a file called |
| 176 | .I \%trace |
| 177 | in the current directory) |
| 178 | that describe |
| 179 | .I \%ncurses |
| 180 | actions. |
| 181 | See section \*(``ALTERNATE CONFIGURATIONS\*('' below. |
| 182 | .SS "Application Structure" |
| 183 | A |
| 184 | .I curses |
| 185 | application uses information from the system locale; |
| 186 | \fI\%setlocale\fP(3) prepares it for |
| 187 | .I curses |
| 188 | library calls. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 189 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 190 | .RS 4 |
| 191 | .EX |
| 192 | setlocale(LC_ALL, ""); |
| 193 | .EE |
| 194 | .RE |
| 195 | .PP |
| 196 | If the locale is not thus initialized, |
| 197 | the library assumes that characters are printable as in ISO\ 8859-1, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 198 | to work with certain legacy programs. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 199 | You should initialize the locale; |
| 200 | do not expect consistent behavior from the library when the locale has |
| 201 | not been set up. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 202 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 203 | \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) |
| 204 | must be called to initialize |
| 205 | .I curses |
| 206 | before use of any functions that deal with windows and screens. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 207 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 208 | To get character-at-a-time input without echoing\(emmost interactive, |
| 209 | screen-oriented programs want this\(emuse the following sequence. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 210 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 211 | .RS 4 |
| 212 | .EX |
| 213 | initscr(); cbreak(); noecho(); |
| 214 | .EE |
| 215 | .RE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 216 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 217 | Most applications perform further setup as follows. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 218 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 219 | .RS 4 |
| 220 | .EX |
| 221 | intrflush(stdscr, FALSE); |
| 222 | keypad(stdscr, TRUE); |
| 223 | .EE |
| 224 | .RE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 225 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 226 | A |
| 227 | .I curses |
| 228 | program then often enters an event loop of some sort. |
| 229 | Call \fB\%endwin\fP(3X) before exiting. |
| 230 | .SS Overview |
| 231 | A |
| 232 | .I curses |
| 233 | library abstracts the terminal screen by representing all or part of it |
| 234 | as a |
| 235 | .I \%WINDOW |
| 236 | data structure. |
| 237 | A |
| 238 | .I window |
| 239 | is a rectangular grid of character cells, |
| 240 | addressed by row and column coordinates |
| 241 | .RI ( y , |
| 242 | .IR x ), |
| 243 | with the upper left corner as (0, 0). |
| 244 | A window called |
| 245 | .BR \%stdscr , |
| 246 | the same size as the terminal screen, |
| 247 | is always available. |
| 248 | Create others with \fB\%newwin\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 249 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 250 | A |
| 251 | .I curses |
| 252 | library does not manage overlapping windows |
| 253 | (but see below). |
| 254 | You can either use |
| 255 | .B \%stdscr |
| 256 | to manage one screen-filling window, |
| 257 | or tile the screen into non-overlapping windows and not use |
| 258 | .B \%stdscr |
| 259 | at all. |
| 260 | Mixing the two approaches will result in unpredictable and undesired |
| 261 | effects. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 262 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 263 | Functions permit manipulation of a window and the |
| 264 | .I cursor |
| 265 | identifying the cell within it at which the next output operation will |
| 266 | occur. |
| 267 | Among those, |
| 268 | the most basic are \fB\%move\fP(3X) and \fB\%addch\fP(3X): |
| 269 | these place the cursor and write a character to |
| 270 | .BR \%stdscr , |
| 271 | respectively. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 272 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 273 | Frequent changes to the terminal screen can cause unpleasant flicker or |
| 274 | inefficient use of the communication channel to the device, |
| 275 | so the library does not generally update it automatically. |
| 276 | Therefore, |
| 277 | after using |
| 278 | .I curses |
| 279 | functions to accumulate a set of desired updates that make sense to |
| 280 | present together, |
| 281 | call \fB\%refresh\fP(3X) to tell the library to make the user's screen |
| 282 | look like \fBstdscr\fP. |
| 283 | The library |
| 284 | .\" X/Open Curses Issue 7 assumes some optimization will be done, but |
| 285 | .\" does not mandate it in any way. |
| 286 | .I optimizes |
| 287 | its output by computing a minimal number of operations to mutate the |
| 288 | screen from its state at the previous refresh to the new one. |
| 289 | Effective optimization demands accurate information about the terminal |
| 290 | device: |
| 291 | the management of such information is the province of the |
| 292 | \fB\%terminfo\fP(3X) API, |
| 293 | a feature of every standard |
| 294 | .I curses |
| 295 | implementation. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 296 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 297 | Special windows called |
| 298 | .I pads |
| 299 | may also be manipulated. |
| 300 | These are windows that are not constrained to the size of the terminal |
| 301 | screen and whose contents need not be completely displayed. |
| 302 | See \fB\%curs_pad\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 303 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 304 | In addition to drawing characters on the screen, |
| 305 | rendering attributes and colors may be supported, |
| 306 | causing the characters to show up in such modes as underlined, |
| 307 | in reverse video, |
| 308 | or in color on terminals that support such display enhancements. |
| 309 | See \fB\%curs_attr\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 310 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 311 | .I curses |
| 312 | predefines constants for a small set of forms-drawing graphics |
| 313 | corresponding to the DEC Alternate Character Set (ACS), |
| 314 | a feature of VT100 and other terminals. |
| 315 | See \fB\%waddch\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 316 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 317 | .I curses |
| 318 | is implemented using the operating system's terminal driver; |
| 319 | keystroke events are received not as scan codes but as byte sequences. |
| 320 | Graphical keycaps |
| 321 | (alphanumeric and punctuation keys, |
| 322 | and the space) |
| 323 | appear as-is. |
| 324 | Everything else, |
| 325 | including the tab, |
| 326 | enter/return, |
| 327 | keypad, |
| 328 | arrow, |
| 329 | and function keys, |
| 330 | appears as a control character or a multibyte |
| 331 | .I "escape sequence." |
| 332 | .I curses |
| 333 | translates these into unique |
| 334 | .I "key codes." |
| 335 | See \fB\%getch\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 336 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 337 | .I \%ncurses |
| 338 | provides reimplementations of the SVr4 \fBpanel\fP(3X), \fBform\fP(3X), |
| 339 | and \fBmenu\fP(3X) libraries to ease construction of user interfaces |
| 340 | with |
| 341 | .IR curses . |
| 342 | .SS "Initialization" |
| 343 | The selection of an appropriate value of |
| 344 | .I TERM |
| 345 | in the process environment is essential to correct |
| 346 | .I curses |
| 347 | and |
| 348 | .I \%term\%info |
| 349 | library operation. |
| 350 | A well-configured system selects a correct |
| 351 | .I TERM |
| 352 | value automatically; |
| 353 | \fB\%tset\fP(1) may assist with troubleshooting exotic situations. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 354 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 355 | If you change the terminal type, |
| 356 | export the |
| 357 | .I TERM |
| 358 | environment variable in the shell, |
| 359 | then run \fB\%tset\fP(1) or the |
| 360 | .RB \*(`` "@TPUT@ init" \*('' |
| 361 | command. |
| 362 | See subsection \*(``Tabs and Initialization\*('' of \fB\%terminfo\fP(5). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 363 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 364 | If the environment variables |
| 365 | .I \%LINES |
| 366 | and |
| 367 | .I \%COLUMNS |
| 368 | are set, |
| 369 | or if the |
| 370 | .I curses |
| 371 | program is executing in a graphical windowing environment, |
| 372 | the information obtained thence overrides that obtained by |
| 373 | .IR \%term\%info . |
| 374 | An |
| 375 | .I \%ncurses |
| 376 | extension supports resizable terminals; |
| 377 | see \fB\%wresize\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 378 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 379 | If the environment variable |
| 380 | .I \%TERMINFO |
| 381 | is defined, |
| 382 | a |
| 383 | .I curses |
| 384 | program checks first for a terminal type description in the location it |
| 385 | identifies. |
| 386 | .I \%TERMINFO |
| 387 | is useful for developing experimental type descriptions or when write |
| 388 | permission to |
| 389 | .I \%\*d |
| 390 | is not available. |
| 391 | .PP |
| 392 | See section \*(``ENVIRONMENT\*('' below. |
| 393 | .SS "Naming Conventions" |
| 394 | .I curses |
| 395 | offers many functions in variant forms using a regular set of |
| 396 | alternatives to the name of an elemental one. |
| 397 | Those prefixed with \*(``w\*('' require a |
| 398 | .I \%WINDOW |
| 399 | pointer argument; |
| 400 | those with a \*(``mv\*('' prefix first perform cursor movement using |
| 401 | \fB\%wmove\fP(3X); |
| 402 | a \*(``mvw\*('' prefix indicates both. |
| 403 | The \*(``w\*('' function is typically the elemental one; |
| 404 | the removal of this prefix usually indicates operation on |
| 405 | .BR \%stdscr . |
| 406 | .PP |
| 407 | Four functions prefixed with \*(``p\*('' require a pad argument. |
| 408 | .PP |
| 409 | In function synopses, |
| 410 | .I \%ncurses |
| 411 | man pages apply the following names to parameters. |
| 412 | .PP |
| 413 | .TS |
| 414 | center; |
| 415 | Li L. |
| 416 | bf \fIbool\fP (\fBTRUE\fP or \fBFALSE\fP) |
| 417 | c a \fIchar\fP or \fIint\fP |
| 418 | ch a \fIchtype\fP |
| 419 | wc a \fIwchar_t\fP or \fIwint_t\fP |
| 420 | wch a \fIcchar_t\fP |
| 421 | win pointer to a \fIWINDOW\fP |
| 422 | pad pointer to a \fIWINDOW\fP that is a pad |
| 423 | .TE |
| 424 | .SS "Wide and Non-wide Character Configurations" |
| 425 | This manual page describes functions that appear in any configuration |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 426 | of the library. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 427 | There are two common configurations; |
| 428 | see section \*(``ALTERNATE CONFIGURATIONS\*('' below. |
| 429 | .TP 10 \" "ncursesw" + 2n |
| 430 | .I \%ncurses |
| 431 | is the library in its \*(``non-wide\*('' configuration, |
| 432 | handling only eight-bit characters. |
| 433 | It stores a character combined with attributes in a |
| 434 | .I \%chtype |
| 435 | datum, |
| 436 | which is often an alias of |
| 437 | .IR int . |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 438 | .IP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 439 | Attributes alone |
| 440 | (with no corresponding character) |
| 441 | can be stored in variables of |
| 442 | .I \%chtype |
| 443 | or |
| 444 | .I \%attr_t |
| 445 | type. |
| 446 | In either case, |
| 447 | they are represented as an integral bit mask. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 448 | .IP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 449 | Each cell of a |
| 450 | .I \%WINDOW |
| 451 | is stored as a |
| 452 | .IR \%chtype . |
| 453 | .TP 10 |
| 454 | .I \%ncursesw |
| 455 | is the library in its \*(``wide\*('' configuration, |
| 456 | which handles character encodings requiring a larger data type than |
| 457 | .I \%char |
| 458 | (a byte-sized type) |
| 459 | can represent. |
| 460 | It adds about one third more calls using additional data types that |
| 461 | can store such |
| 462 | .I multibyte |
| 463 | characters. |
| 464 | .RS 10 \" same as foregoing tag width |
| 465 | .TP 9 \" "cchar_t" + 2n |
| 466 | .I \%cchar_t |
| 467 | corresponds to the non-wide configuration's |
| 468 | .IR \%chtype . |
| 469 | It always a structure type, |
| 470 | because it stores more data than fit into a standard scalar type. |
| 471 | A character code may not be representable as a |
| 472 | .IR \%char , |
| 473 | and moreover more than one character may occupy a cell |
| 474 | (as with accent marks and other diacritics). |
| 475 | Each character is of type |
| 476 | .IR \%wchar_t ; |
| 477 | a complex character contains one spacing character and zero or more |
| 478 | non-spacing characters |
| 479 | (see below). |
| 480 | Attributes and color data are stored in separate fields of the |
| 481 | structure, |
| 482 | not combined as in |
| 483 | .IR \%chtype . |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 484 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 485 | Each cell of a |
| 486 | .I \%WINDOW |
| 487 | is stored as a |
| 488 | .IR \%cchar_t . |
| 489 | .PP |
| 490 | \fB\%setcchar\fP(3X) and \fB\%getcchar\fP(3X) |
| 491 | store and retrieve |
| 492 | .I \%cchar_t |
| 493 | data. |
| 494 | The wide library API of |
| 495 | .I \%ncurses |
| 496 | depends on two data types standardized by ISO C95. |
| 497 | .TP 9 |
| 498 | .I \%wchar_t |
| 499 | stores a wide character. |
| 500 | Like |
| 501 | .IR \%chtype , |
| 502 | it may be an alias of |
| 503 | .IR int . |
| 504 | Depending on the character encoding, |
| 505 | a wide character may be |
| 506 | .IR spacing , |
| 507 | meaning that it occupies a character cell by itself and typically |
| 508 | accompanies cursor advancement, |
| 509 | or |
| 510 | .IR non-spacing , |
| 511 | meaning that it occupies the same cell as a spacing character, |
| 512 | is often regarded as a \*(``modifier\*('' of the base glyph with which |
| 513 | it combines, |
| 514 | and typically does not advance the cursor. |
| 515 | .TP 9 |
| 516 | .I \%wint_t |
| 517 | can store a |
| 518 | .I \%wchar_t |
| 519 | or the constant |
| 520 | .BR \%WEOF , |
| 521 | analogously to the |
| 522 | .IR int -sized |
| 523 | character manipulation functions of ISO C and its constant |
| 524 | .BR \%EOF . |
| 525 | .RE |
| 526 | .IP |
| 527 | The wide library provides additional functions that complement those in |
| 528 | the non-wide library where the size of the underlying character type is |
| 529 | significant. |
| 530 | A somewhat regular naming convention relates many of the wide variants |
| 531 | to their non-wide counterparts; |
| 532 | where a non-wide function name contains \*(``ch\*('' or \*(``str\*('', |
| 533 | prefix it with \*(``_w\*('' to obtain the wide counterpart. |
| 534 | For example, |
| 535 | \fB\%waddch\fP becomes \fB\%wadd_wch\fP. |
| 536 | (Exceptions that add only \*(``w\*('' comprise |
| 537 | .BR \%addwstr , |
| 538 | .BR \%inwstr , |
| 539 | and their variants.) |
| 540 | .IP |
| 541 | This convention is inapplicable to some non-wide function names, |
| 542 | so other transformations are used for the wide configuration: |
| 543 | the window background management function \*(``bkgd\*('' becomes |
| 544 | \*(``bkgrnd\*(''; |
| 545 | the window border-drawing and -clearing functions are suffixed with |
| 546 | \*(``_set\*(''; |
| 547 | and character attribute manipulation functions like |
| 548 | \*(``attron\*('' become \*(``attr_on\*(''. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 549 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 550 | .SS "Function Name Index" |
| 551 | The following table lists the |
| 552 | .I curses |
| 553 | functions provided in the non-wide and wide APIs and the corresponding |
| 554 | man pages that describe them. |
| 555 | Those flagged with \*(``*\*('' |
| 556 | are |
| 557 | .IR \%ncurses "-specific," |
| 558 | neither described by X/Open Curses nor present in SVr4. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 559 | .PP |
| 560 | .TS |
| 561 | center tab(/); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 562 | l l . |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 563 | \f(BIcurses\fP Function Name/Man Page |
| 564 | _ |
| 565 | COLOR_PAIR/\fBcurs_color\fP(3X) |
| 566 | PAIR_NUMBER/\fBcurs_color\fP(3X) |
| 567 | add_wch/\fBcurs_add_wch\fP(3X) |
| 568 | add_wchnstr/\fBcurs_add_wchstr\fP(3X) |
| 569 | add_wchstr/\fBcurs_add_wchstr\fP(3X) |
| 570 | addch/\fBcurs_addch\fP(3X) |
| 571 | addchnstr/\fBcurs_addchstr\fP(3X) |
| 572 | addchstr/\fBcurs_addchstr\fP(3X) |
| 573 | addnstr/\fBcurs_addstr\fP(3X) |
| 574 | addnwstr/\fBcurs_addwstr\fP(3X) |
| 575 | addstr/\fBcurs_addstr\fP(3X) |
| 576 | addwstr/\fBcurs_addwstr\fP(3X) |
| 577 | alloc_pair/\fBnew_pair\fP(3X)* |
| 578 | assume_default_colors/\fBdefault_colors\fP(3X)* |
| 579 | attr_get/\fBcurs_attr\fP(3X) |
| 580 | attr_off/\fBcurs_attr\fP(3X) |
| 581 | attr_on/\fBcurs_attr\fP(3X) |
| 582 | attr_set/\fBcurs_attr\fP(3X) |
| 583 | attroff/\fBcurs_attr\fP(3X) |
| 584 | attron/\fBcurs_attr\fP(3X) |
| 585 | attrset/\fBcurs_attr\fP(3X) |
| 586 | baudrate/\fBcurs_termattrs\fP(3X) |
| 587 | beep/\fBcurs_beep\fP(3X) |
| 588 | bkgd/\fBcurs_bkgd\fP(3X) |
| 589 | bkgdset/\fBcurs_bkgd\fP(3X) |
| 590 | bkgrnd/\fBcurs_bkgrnd\fP(3X) |
| 591 | bkgrndset/\fBcurs_bkgrnd\fP(3X) |
| 592 | border/\fBcurs_border\fP(3X) |
| 593 | border_set/\fBcurs_border_set\fP(3X) |
| 594 | box/\fBcurs_border\fP(3X) |
| 595 | box_set/\fBcurs_border_set\fP(3X) |
| 596 | can_change_color/\fBcurs_color\fP(3X) |
| 597 | cbreak/\fBcurs_inopts\fP(3X) |
| 598 | chgat/\fBcurs_attr\fP(3X) |
| 599 | clear/\fBcurs_clear\fP(3X) |
| 600 | clearok/\fBcurs_outopts\fP(3X) |
| 601 | clrtobot/\fBcurs_clear\fP(3X) |
| 602 | clrtoeol/\fBcurs_clear\fP(3X) |
| 603 | color_content/\fBcurs_color\fP(3X) |
| 604 | color_set/\fBcurs_attr\fP(3X) |
| 605 | copywin/\fBcurs_overlay\fP(3X) |
| 606 | curs_set/\fBcurs_kernel\fP(3X) |
| 607 | curses_trace/\fBcurs_trace\fP(3X)* |
| 608 | curses_version/\fBcurs_extend\fP(3X)* |
| 609 | def_prog_mode/\fBcurs_kernel\fP(3X) |
| 610 | def_shell_mode/\fBcurs_kernel\fP(3X) |
| 611 | define_key/\fBdefine_key\fP(3X)* |
| 612 | del_curterm/\fBcurs_terminfo\fP(3X) |
| 613 | delay_output/\fBcurs_util\fP(3X) |
| 614 | delch/\fBcurs_delch\fP(3X) |
| 615 | deleteln/\fBcurs_deleteln\fP(3X) |
| 616 | delscreen/\fBcurs_initscr\fP(3X) |
| 617 | delwin/\fBcurs_window\fP(3X) |
| 618 | derwin/\fBcurs_window\fP(3X) |
| 619 | doupdate/\fBcurs_refresh\fP(3X) |
| 620 | dupwin/\fBcurs_window\fP(3X) |
| 621 | echo/\fBcurs_inopts\fP(3X) |
| 622 | echo_wchar/\fBcurs_add_wch\fP(3X) |
| 623 | echochar/\fBcurs_addch\fP(3X) |
| 624 | endwin/\fBcurs_initscr\fP(3X) |
| 625 | erase/\fBcurs_clear\fP(3X) |
| 626 | erasechar/\fBcurs_termattrs\fP(3X) |
| 627 | erasewchar/\fBcurs_termattrs\fP(3X) |
| 628 | exit_curses/\fBcurs_memleaks\fP(3X)* |
| 629 | exit_terminfo/\fBcurs_memleaks\fP(3X)* |
| 630 | extended_color_content/\fBcurs_color\fP(3X)* |
| 631 | extended_pair_content/\fBcurs_color\fP(3X)* |
| 632 | extended_slk_color/\fBcurs_slk\fP(3X)* |
| 633 | filter/\fBcurs_util\fP(3X) |
| 634 | find_pair/\fBnew_pair\fP(3X)* |
| 635 | flash/\fBcurs_beep\fP(3X) |
| 636 | flushinp/\fBcurs_util\fP(3X) |
| 637 | free_pair/\fBnew_pair\fP(3X)* |
| 638 | get_escdelay/\fBcurs_threads\fP(3X)* |
| 639 | get_wch/\fBcurs_get_wch\fP(3X) |
| 640 | get_wstr/\fBcurs_get_wstr\fP(3X) |
| 641 | getattrs/\fBcurs_attr\fP(3X) |
| 642 | getbegx/\fBcurs_legacy\fP(3X)* |
| 643 | getbegy/\fBcurs_legacy\fP(3X)* |
| 644 | getbegyx/\fBcurs_getyx\fP(3X) |
| 645 | getbkgd/\fBcurs_bkgd\fP(3X) |
| 646 | getbkgrnd/\fBcurs_bkgrnd\fP(3X) |
| 647 | getcchar/\fBcurs_getcchar\fP(3X) |
| 648 | getch/\fBcurs_getch\fP(3X) |
| 649 | getcurx/\fBcurs_legacy\fP(3X)* |
| 650 | getcury/\fBcurs_legacy\fP(3X)* |
| 651 | getmaxx/\fBcurs_legacy\fP(3X)* |
| 652 | getmaxy/\fBcurs_legacy\fP(3X)* |
| 653 | getmaxyx/\fBcurs_getyx\fP(3X) |
| 654 | getmouse/\fBcurs_mouse\fP(3X)* |
| 655 | getn_wstr/\fBcurs_get_wstr\fP(3X) |
| 656 | getnstr/\fBcurs_getstr\fP(3X) |
| 657 | getparx/\fBcurs_legacy\fP(3X)* |
| 658 | getpary/\fBcurs_legacy\fP(3X)* |
| 659 | getparyx/\fBcurs_getyx\fP(3X) |
| 660 | getstr/\fBcurs_getstr\fP(3X) |
| 661 | getsyx/\fBcurs_kernel\fP(3X) |
| 662 | getwin/\fBcurs_util\fP(3X) |
| 663 | getyx/\fBcurs_getyx\fP(3X) |
| 664 | halfdelay/\fBcurs_inopts\fP(3X) |
| 665 | has_colors/\fBcurs_color\fP(3X) |
| 666 | has_ic/\fBcurs_termattrs\fP(3X) |
| 667 | has_il/\fBcurs_termattrs\fP(3X) |
| 668 | has_key/\fBcurs_getch\fP(3X)* |
| 669 | has_mouse/\fBcurs_mouse\fP(3X)* |
| 670 | hline/\fBcurs_border\fP(3X) |
| 671 | hline_set/\fBcurs_border_set\fP(3X) |
| 672 | idcok/\fBcurs_outopts\fP(3X) |
| 673 | idlok/\fBcurs_outopts\fP(3X) |
| 674 | immedok/\fBcurs_outopts\fP(3X) |
| 675 | in_wch/\fBcurs_in_wch\fP(3X) |
| 676 | in_wchnstr/\fBcurs_in_wchstr\fP(3X) |
| 677 | in_wchstr/\fBcurs_in_wchstr\fP(3X) |
| 678 | inch/\fBcurs_inch\fP(3X) |
| 679 | inchnstr/\fBcurs_inchstr\fP(3X) |
| 680 | inchstr/\fBcurs_inchstr\fP(3X) |
| 681 | init_color/\fBcurs_color\fP(3X) |
| 682 | init_extended_color/\fBcurs_color\fP(3X)* |
| 683 | init_extended_pair/\fBcurs_color\fP(3X)* |
| 684 | init_pair/\fBcurs_color\fP(3X) |
| 685 | initscr/\fBcurs_initscr\fP(3X) |
| 686 | innstr/\fBcurs_instr\fP(3X) |
| 687 | innwstr/\fBcurs_inwstr\fP(3X) |
| 688 | ins_nwstr/\fBcurs_ins_wstr\fP(3X) |
| 689 | ins_wch/\fBcurs_ins_wch\fP(3X) |
| 690 | ins_wstr/\fBcurs_ins_wstr\fP(3X) |
| 691 | insch/\fBcurs_insch\fP(3X) |
| 692 | insdelln/\fBcurs_deleteln\fP(3X) |
| 693 | insertln/\fBcurs_deleteln\fP(3X) |
| 694 | insnstr/\fBcurs_insstr\fP(3X) |
| 695 | insstr/\fBcurs_insstr\fP(3X) |
| 696 | instr/\fBcurs_instr\fP(3X) |
| 697 | intrflush/\fBcurs_inopts\fP(3X) |
| 698 | inwstr/\fBcurs_inwstr\fP(3X) |
| 699 | is_cbreak/\fBcurs_inopts\fP(3X)* |
| 700 | is_cleared/\fBcurs_opaque\fP(3X)* |
| 701 | is_echo/\fBcurs_inopts\fP(3X)* |
| 702 | is_idcok/\fBcurs_opaque\fP(3X)* |
| 703 | is_idlok/\fBcurs_opaque\fP(3X)* |
| 704 | is_immedok/\fBcurs_opaque\fP(3X)* |
| 705 | is_keypad/\fBcurs_opaque\fP(3X)* |
| 706 | is_leaveok/\fBcurs_opaque\fP(3X)* |
| 707 | is_linetouched/\fBcurs_touch\fP(3X) |
| 708 | is_nl/\fBcurs_inopts\fP(3X)* |
| 709 | is_nodelay/\fBcurs_opaque\fP(3X)* |
| 710 | is_notimeout/\fBcurs_opaque\fP(3X)* |
| 711 | is_pad/\fBcurs_opaque\fP(3X)* |
| 712 | is_raw/\fBcurs_inopts\fP(3X)* |
| 713 | is_scrollok/\fBcurs_opaque\fP(3X)* |
| 714 | is_subwin/\fBcurs_opaque\fP(3X)* |
| 715 | is_syncok/\fBcurs_opaque\fP(3X)* |
| 716 | is_term_resized/\fBresizeterm\fP(3X)* |
| 717 | is_wintouched/\fBcurs_touch\fP(3X) |
| 718 | isendwin/\fBcurs_initscr\fP(3X) |
| 719 | key_defined/\fBkey_defined\fP(3X)* |
| 720 | key_name/\fBcurs_util\fP(3X) |
| 721 | keybound/\fBkeybound\fP(3X)* |
| 722 | keyname/\fBcurs_util\fP(3X) |
| 723 | keyok/\fBkeyok\fP(3X)* |
| 724 | keypad/\fBcurs_inopts\fP(3X) |
| 725 | killchar/\fBcurs_termattrs\fP(3X) |
| 726 | killwchar/\fBcurs_termattrs\fP(3X) |
| 727 | leaveok/\fBcurs_outopts\fP(3X) |
| 728 | longname/\fBcurs_termattrs\fP(3X) |
| 729 | mcprint/\fBcurs_print\fP(3X)* |
| 730 | meta/\fBcurs_inopts\fP(3X) |
| 731 | mouse_trafo/\fBcurs_mouse\fP(3X)* |
| 732 | mouseinterval/\fBcurs_mouse\fP(3X)* |
| 733 | mousemask/\fBcurs_mouse\fP(3X)* |
| 734 | move/\fBcurs_move\fP(3X) |
| 735 | mvadd_wch/\fBcurs_add_wch\fP(3X) |
| 736 | mvadd_wchnstr/\fBcurs_add_wchstr\fP(3X) |
| 737 | mvadd_wchstr/\fBcurs_add_wchstr\fP(3X) |
| 738 | mvaddch/\fBcurs_addch\fP(3X) |
| 739 | mvaddchnstr/\fBcurs_addchstr\fP(3X) |
| 740 | mvaddchstr/\fBcurs_addchstr\fP(3X) |
| 741 | mvaddnstr/\fBcurs_addstr\fP(3X) |
| 742 | mvaddnwstr/\fBcurs_addwstr\fP(3X) |
| 743 | mvaddstr/\fBcurs_addstr\fP(3X) |
| 744 | mvaddwstr/\fBcurs_addwstr\fP(3X) |
| 745 | mvchgat/\fBcurs_attr\fP(3X) |
| 746 | mvcur/\fBcurs_terminfo\fP(3X) |
| 747 | mvdelch/\fBcurs_delch\fP(3X) |
| 748 | mvderwin/\fBcurs_window\fP(3X) |
| 749 | mvget_wch/\fBcurs_get_wch\fP(3X) |
| 750 | mvget_wstr/\fBcurs_get_wstr\fP(3X) |
| 751 | mvgetch/\fBcurs_getch\fP(3X) |
| 752 | mvgetn_wstr/\fBcurs_get_wstr\fP(3X) |
| 753 | mvgetnstr/\fBcurs_getstr\fP(3X) |
| 754 | mvgetstr/\fBcurs_getstr\fP(3X) |
| 755 | mvhline/\fBcurs_border\fP(3X) |
| 756 | mvhline_set/\fBcurs_border_set\fP(3X) |
| 757 | mvin_wch/\fBcurs_in_wch\fP(3X) |
| 758 | mvin_wchnstr/\fBcurs_in_wchstr\fP(3X) |
| 759 | mvin_wchstr/\fBcurs_in_wchstr\fP(3X) |
| 760 | mvinch/\fBcurs_inch\fP(3X) |
| 761 | mvinchnstr/\fBcurs_inchstr\fP(3X) |
| 762 | mvinchstr/\fBcurs_inchstr\fP(3X) |
| 763 | mvinnstr/\fBcurs_instr\fP(3X) |
| 764 | mvinnwstr/\fBcurs_inwstr\fP(3X) |
| 765 | mvins_nwstr/\fBcurs_ins_wstr\fP(3X) |
| 766 | mvins_wch/\fBcurs_ins_wch\fP(3X) |
| 767 | mvins_wstr/\fBcurs_ins_wstr\fP(3X) |
| 768 | mvinsch/\fBcurs_insch\fP(3X) |
| 769 | mvinsnstr/\fBcurs_insstr\fP(3X) |
| 770 | mvinsstr/\fBcurs_insstr\fP(3X) |
| 771 | mvinstr/\fBcurs_instr\fP(3X) |
| 772 | mvinwstr/\fBcurs_inwstr\fP(3X) |
| 773 | mvprintw/\fBcurs_printw\fP(3X) |
| 774 | mvscanw/\fBcurs_scanw\fP(3X) |
| 775 | mvvline/\fBcurs_border\fP(3X) |
| 776 | mvvline_set/\fBcurs_border_set\fP(3X) |
| 777 | mvwadd_wch/\fBcurs_add_wch\fP(3X) |
| 778 | mvwadd_wchnstr/\fBcurs_add_wchstr\fP(3X) |
| 779 | mvwadd_wchstr/\fBcurs_add_wchstr\fP(3X) |
| 780 | mvwaddch/\fBcurs_addch\fP(3X) |
| 781 | mvwaddchnstr/\fBcurs_addchstr\fP(3X) |
| 782 | mvwaddchstr/\fBcurs_addchstr\fP(3X) |
| 783 | mvwaddnstr/\fBcurs_addstr\fP(3X) |
| 784 | mvwaddnwstr/\fBcurs_addwstr\fP(3X) |
| 785 | mvwaddstr/\fBcurs_addstr\fP(3X) |
| 786 | mvwaddwstr/\fBcurs_addwstr\fP(3X) |
| 787 | mvwchgat/\fBcurs_attr\fP(3X) |
| 788 | mvwdelch/\fBcurs_delch\fP(3X) |
| 789 | mvwget_wch/\fBcurs_get_wch\fP(3X) |
| 790 | mvwget_wstr/\fBcurs_get_wstr\fP(3X) |
| 791 | mvwgetch/\fBcurs_getch\fP(3X) |
| 792 | mvwgetn_wstr/\fBcurs_get_wstr\fP(3X) |
| 793 | mvwgetnstr/\fBcurs_getstr\fP(3X) |
| 794 | mvwgetstr/\fBcurs_getstr\fP(3X) |
| 795 | mvwhline/\fBcurs_border\fP(3X) |
| 796 | mvwhline_set/\fBcurs_border_set\fP(3X) |
| 797 | mvwin/\fBcurs_window\fP(3X) |
| 798 | mvwin_wch/\fBcurs_in_wch\fP(3X) |
| 799 | mvwin_wchnstr/\fBcurs_in_wchstr\fP(3X) |
| 800 | mvwin_wchstr/\fBcurs_in_wchstr\fP(3X) |
| 801 | mvwinch/\fBcurs_inch\fP(3X) |
| 802 | mvwinchnstr/\fBcurs_inchstr\fP(3X) |
| 803 | mvwinchstr/\fBcurs_inchstr\fP(3X) |
| 804 | mvwinnstr/\fBcurs_instr\fP(3X) |
| 805 | mvwinnwstr/\fBcurs_inwstr\fP(3X) |
| 806 | mvwins_nwstr/\fBcurs_ins_wstr\fP(3X) |
| 807 | mvwins_wch/\fBcurs_ins_wch\fP(3X) |
| 808 | mvwins_wstr/\fBcurs_ins_wstr\fP(3X) |
| 809 | mvwinsch/\fBcurs_insch\fP(3X) |
| 810 | mvwinsnstr/\fBcurs_insstr\fP(3X) |
| 811 | mvwinsstr/\fBcurs_insstr\fP(3X) |
| 812 | mvwinstr/\fBcurs_instr\fP(3X) |
| 813 | mvwinwstr/\fBcurs_inwstr\fP(3X) |
| 814 | mvwprintw/\fBcurs_printw\fP(3X) |
| 815 | mvwscanw/\fBcurs_scanw\fP(3X) |
| 816 | mvwvline/\fBcurs_border\fP(3X) |
| 817 | mvwvline_set/\fBcurs_border_set\fP(3X) |
| 818 | napms/\fBcurs_kernel\fP(3X) |
| 819 | newpad/\fBcurs_pad\fP(3X) |
| 820 | newterm/\fBcurs_initscr\fP(3X) |
| 821 | newwin/\fBcurs_window\fP(3X) |
| 822 | nl/\fBcurs_inopts\fP(3X) |
| 823 | nocbreak/\fBcurs_inopts\fP(3X) |
| 824 | nodelay/\fBcurs_inopts\fP(3X) |
| 825 | noecho/\fBcurs_inopts\fP(3X) |
| 826 | nofilter/\fBcurs_util\fP(3X)* |
| 827 | nonl/\fBcurs_inopts\fP(3X) |
| 828 | noqiflush/\fBcurs_inopts\fP(3X) |
| 829 | noraw/\fBcurs_inopts\fP(3X) |
| 830 | notimeout/\fBcurs_inopts\fP(3X) |
| 831 | overlay/\fBcurs_overlay\fP(3X) |
| 832 | overwrite/\fBcurs_overlay\fP(3X) |
| 833 | pair_content/\fBcurs_color\fP(3X) |
| 834 | pecho_wchar/\fBcurs_pad\fP(3X) |
| 835 | pechochar/\fBcurs_pad\fP(3X) |
| 836 | pnoutrefresh/\fBcurs_pad\fP(3X) |
| 837 | prefresh/\fBcurs_pad\fP(3X) |
| 838 | printw/\fBcurs_printw\fP(3X) |
| 839 | putp/\fBcurs_terminfo\fP(3X) |
| 840 | putwin/\fBcurs_util\fP(3X) |
| 841 | qiflush/\fBcurs_inopts\fP(3X) |
| 842 | raw/\fBcurs_inopts\fP(3X) |
| 843 | redrawwin/\fBcurs_refresh\fP(3X) |
| 844 | refresh/\fBcurs_refresh\fP(3X) |
| 845 | reset_color_pairs/\fBcurs_color\fP(3X)* |
| 846 | reset_prog_mode/\fBcurs_kernel\fP(3X) |
| 847 | reset_shell_mode/\fBcurs_kernel\fP(3X) |
| 848 | resetty/\fBcurs_kernel\fP(3X) |
| 849 | resize_term/\fBresizeterm\fP(3X)* |
| 850 | resizeterm/\fBresizeterm\fP(3X)* |
| 851 | restartterm/\fBcurs_terminfo\fP(3X) |
| 852 | ripoffline/\fBcurs_kernel\fP(3X) |
| 853 | savetty/\fBcurs_kernel\fP(3X) |
| 854 | scanw/\fBcurs_scanw\fP(3X) |
| 855 | scr_dump/\fBcurs_scr_dump\fP(3X) |
| 856 | scr_init/\fBcurs_scr_dump\fP(3X) |
| 857 | scr_restore/\fBcurs_scr_dump\fP(3X) |
| 858 | scr_set/\fBcurs_scr_dump\fP(3X) |
| 859 | scrl/\fBcurs_scroll\fP(3X) |
| 860 | scroll/\fBcurs_scroll\fP(3X) |
| 861 | scrollok/\fBcurs_outopts\fP(3X) |
| 862 | set_curterm/\fBcurs_terminfo\fP(3X) |
| 863 | set_escdelay/\fBcurs_threads\fP(3X)* |
| 864 | set_tabsize/\fBcurs_threads\fP(3X)* |
| 865 | set_term/\fBcurs_initscr\fP(3X) |
| 866 | setcchar/\fBcurs_getcchar\fP(3X) |
| 867 | setscrreg/\fBcurs_outopts\fP(3X) |
| 868 | setsyx/\fBcurs_kernel\fP(3X) |
| 869 | setupterm/\fBcurs_terminfo\fP(3X) |
| 870 | slk_attr/\fBcurs_slk\fP(3X)* |
| 871 | slk_attr_off/\fBcurs_slk\fP(3X) |
| 872 | slk_attr_on/\fBcurs_slk\fP(3X) |
| 873 | slk_attr_set/\fBcurs_slk\fP(3X) |
| 874 | slk_attroff/\fBcurs_slk\fP(3X) |
| 875 | slk_attron/\fBcurs_slk\fP(3X) |
| 876 | slk_attrset/\fBcurs_slk\fP(3X) |
| 877 | slk_clear/\fBcurs_slk\fP(3X) |
| 878 | slk_color/\fBcurs_slk\fP(3X) |
| 879 | slk_init/\fBcurs_slk\fP(3X) |
| 880 | slk_label/\fBcurs_slk\fP(3X) |
| 881 | slk_noutrefresh/\fBcurs_slk\fP(3X) |
| 882 | slk_refresh/\fBcurs_slk\fP(3X) |
| 883 | slk_restore/\fBcurs_slk\fP(3X) |
| 884 | slk_set/\fBcurs_slk\fP(3X) |
| 885 | slk_touch/\fBcurs_slk\fP(3X) |
| 886 | slk_wset/\fBcurs_slk\fP(3X) |
| 887 | standend/\fBcurs_attr\fP(3X) |
| 888 | standout/\fBcurs_attr\fP(3X) |
| 889 | start_color/\fBcurs_color\fP(3X) |
| 890 | subpad/\fBcurs_pad\fP(3X) |
| 891 | subwin/\fBcurs_window\fP(3X) |
| 892 | syncok/\fBcurs_window\fP(3X) |
| 893 | term_attrs/\fBcurs_termattrs\fP(3X) |
| 894 | termattrs/\fBcurs_termattrs\fP(3X) |
| 895 | termname/\fBcurs_termattrs\fP(3X) |
| 896 | tgetent/\fBcurs_termcap\fP(3X) |
| 897 | tgetflag/\fBcurs_termcap\fP(3X) |
| 898 | tgetnum/\fBcurs_termcap\fP(3X) |
| 899 | tgetstr/\fBcurs_termcap\fP(3X) |
| 900 | tgoto/\fBcurs_termcap\fP(3X) |
| 901 | tigetflag/\fBcurs_terminfo\fP(3X) |
| 902 | tigetnum/\fBcurs_terminfo\fP(3X) |
| 903 | tigetstr/\fBcurs_terminfo\fP(3X) |
| 904 | timeout/\fBcurs_inopts\fP(3X) |
| 905 | tiparm/\fBcurs_terminfo\fP(3X) |
| 906 | tiparm_s/\fBcurs_terminfo\fP(3X)* |
| 907 | tiscan_s/\fBcurs_terminfo\fP(3X)* |
| 908 | touchline/\fBcurs_touch\fP(3X) |
| 909 | touchwin/\fBcurs_touch\fP(3X) |
| 910 | tparm/\fBcurs_terminfo\fP(3X) |
| 911 | tputs/\fBcurs_termcap\fP(3X) |
| 912 | tputs/\fBcurs_terminfo\fP(3X) |
| 913 | trace/\fBcurs_trace\fP(3X)* |
| 914 | typeahead/\fBcurs_inopts\fP(3X) |
| 915 | unctrl/\fBcurs_util\fP(3X) |
| 916 | unget_wch/\fBcurs_get_wch\fP(3X) |
| 917 | ungetch/\fBcurs_getch\fP(3X) |
| 918 | ungetmouse/\fBcurs_mouse\fP(3X)* |
| 919 | untouchwin/\fBcurs_touch\fP(3X) |
| 920 | use_default_colors/\fBdefault_colors\fP(3X)* |
| 921 | use_env/\fBcurs_util\fP(3X) |
| 922 | use_extended_names/\fBcurs_extend\fP(3X)* |
| 923 | use_legacy_coding/\fBlegacy_coding\fP(3X)* |
| 924 | use_screen/\fBcurs_threads\fP(3X)* |
| 925 | use_tioctl/\fBcurs_util\fP(3X)* |
| 926 | use_window/\fBcurs_threads\fP(3X)* |
| 927 | vid_attr/\fBcurs_terminfo\fP(3X) |
| 928 | vid_puts/\fBcurs_terminfo\fP(3X) |
| 929 | vidattr/\fBcurs_terminfo\fP(3X) |
| 930 | vidputs/\fBcurs_terminfo\fP(3X) |
| 931 | vline/\fBcurs_border\fP(3X) |
| 932 | vline_set/\fBcurs_border_set\fP(3X) |
| 933 | vw_printw/\fBcurs_printw\fP(3X) |
| 934 | vw_scanw/\fBcurs_scanw\fP(3X) |
| 935 | vwprintw/\fBcurs_printw\fP(3X) |
| 936 | vwscanw/\fBcurs_scanw\fP(3X) |
| 937 | wadd_wch/\fBcurs_add_wch\fP(3X) |
| 938 | wadd_wchnstr/\fBcurs_add_wchstr\fP(3X) |
| 939 | wadd_wchstr/\fBcurs_add_wchstr\fP(3X) |
| 940 | waddch/\fBcurs_addch\fP(3X) |
| 941 | waddchnstr/\fBcurs_addchstr\fP(3X) |
| 942 | waddchstr/\fBcurs_addchstr\fP(3X) |
| 943 | waddnstr/\fBcurs_addstr\fP(3X) |
| 944 | waddnwstr/\fBcurs_addwstr\fP(3X) |
| 945 | waddstr/\fBcurs_addstr\fP(3X) |
| 946 | waddwstr/\fBcurs_addwstr\fP(3X) |
| 947 | wattr_get/\fBcurs_attr\fP(3X) |
| 948 | wattr_off/\fBcurs_attr\fP(3X) |
| 949 | wattr_on/\fBcurs_attr\fP(3X) |
| 950 | wattr_set/\fBcurs_attr\fP(3X) |
| 951 | wattroff/\fBcurs_attr\fP(3X) |
| 952 | wattron/\fBcurs_attr\fP(3X) |
| 953 | wattrset/\fBcurs_attr\fP(3X) |
| 954 | wbkgd/\fBcurs_bkgd\fP(3X) |
| 955 | wbkgdset/\fBcurs_bkgd\fP(3X) |
| 956 | wbkgrnd/\fBcurs_bkgrnd\fP(3X) |
| 957 | wbkgrndset/\fBcurs_bkgrnd\fP(3X) |
| 958 | wborder/\fBcurs_border\fP(3X) |
| 959 | wborder_set/\fBcurs_border_set\fP(3X) |
| 960 | wchgat/\fBcurs_attr\fP(3X) |
| 961 | wclear/\fBcurs_clear\fP(3X) |
| 962 | wclrtobot/\fBcurs_clear\fP(3X) |
| 963 | wclrtoeol/\fBcurs_clear\fP(3X) |
| 964 | wcolor_set/\fBcurs_attr\fP(3X) |
| 965 | wcursyncup/\fBcurs_window\fP(3X) |
| 966 | wdelch/\fBcurs_delch\fP(3X) |
| 967 | wdeleteln/\fBcurs_deleteln\fP(3X) |
| 968 | wecho_wchar/\fBcurs_add_wch\fP(3X) |
| 969 | wechochar/\fBcurs_addch\fP(3X) |
| 970 | wenclose/\fBcurs_mouse\fP(3X)* |
| 971 | werase/\fBcurs_clear\fP(3X) |
| 972 | wget_wch/\fBcurs_get_wch\fP(3X) |
| 973 | wget_wstr/\fBcurs_get_wstr\fP(3X) |
| 974 | wgetbkgrnd/\fBcurs_bkgrnd\fP(3X) |
| 975 | wgetch/\fBcurs_getch\fP(3X) |
| 976 | wgetdelay/\fBcurs_opaque\fP(3X)* |
| 977 | wgetn_wstr/\fBcurs_get_wstr\fP(3X) |
| 978 | wgetnstr/\fBcurs_getstr\fP(3X) |
| 979 | wgetparent/\fBcurs_opaque\fP(3X)* |
| 980 | wgetscrreg/\fBcurs_opaque\fP(3X)* |
| 981 | wgetstr/\fBcurs_getstr\fP(3X) |
| 982 | whline/\fBcurs_border\fP(3X) |
| 983 | whline_set/\fBcurs_border_set\fP(3X) |
| 984 | win_wch/\fBcurs_in_wch\fP(3X) |
| 985 | win_wchnstr/\fBcurs_in_wchstr\fP(3X) |
| 986 | win_wchstr/\fBcurs_in_wchstr\fP(3X) |
| 987 | winch/\fBcurs_inch\fP(3X) |
| 988 | winchnstr/\fBcurs_inchstr\fP(3X) |
| 989 | winchstr/\fBcurs_inchstr\fP(3X) |
| 990 | winnstr/\fBcurs_instr\fP(3X) |
| 991 | winnwstr/\fBcurs_inwstr\fP(3X) |
| 992 | wins_nwstr/\fBcurs_ins_wstr\fP(3X) |
| 993 | wins_wch/\fBcurs_ins_wch\fP(3X) |
| 994 | wins_wstr/\fBcurs_ins_wstr\fP(3X) |
| 995 | winsch/\fBcurs_insch\fP(3X) |
| 996 | winsdelln/\fBcurs_deleteln\fP(3X) |
| 997 | winsertln/\fBcurs_deleteln\fP(3X) |
| 998 | winsnstr/\fBcurs_insstr\fP(3X) |
| 999 | winsstr/\fBcurs_insstr\fP(3X) |
| 1000 | winstr/\fBcurs_instr\fP(3X) |
| 1001 | winwstr/\fBcurs_inwstr\fP(3X) |
| 1002 | wmouse_trafo/\fBcurs_mouse\fP(3X)* |
| 1003 | wmove/\fBcurs_move\fP(3X) |
| 1004 | wnoutrefresh/\fBcurs_refresh\fP(3X) |
| 1005 | wprintw/\fBcurs_printw\fP(3X) |
| 1006 | wredrawln/\fBcurs_refresh\fP(3X) |
| 1007 | wrefresh/\fBcurs_refresh\fP(3X) |
| 1008 | wresize/\fBwresize\fP(3X)* |
| 1009 | wscanw/\fBcurs_scanw\fP(3X) |
| 1010 | wscrl/\fBcurs_scroll\fP(3X) |
| 1011 | wsetscrreg/\fBcurs_outopts\fP(3X) |
| 1012 | wstandend/\fBcurs_attr\fP(3X) |
| 1013 | wstandout/\fBcurs_attr\fP(3X) |
| 1014 | wsyncdown/\fBcurs_window\fP(3X) |
| 1015 | wsyncup/\fBcurs_window\fP(3X) |
| 1016 | wtimeout/\fBcurs_inopts\fP(3X) |
| 1017 | wtouchln/\fBcurs_touch\fP(3X) |
| 1018 | wunctrl/\fBcurs_util\fP(3X) |
| 1019 | wvline/\fBcurs_border\fP(3X) |
| 1020 | wvline_set/\fBcurs_border_set\fP(3X) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1021 | .TE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1022 | .PP |
| 1023 | .IR \%ncurses 's |
| 1024 | .I "screen-pointer extension" |
| 1025 | adds additional functions corresponding to many of the above, |
| 1026 | each with an \*(``_sp\*('' suffix; |
| 1027 | see \fBcurs_sp_funcs\fP(3X). |
| 1028 | .PP |
| 1029 | The availability of some extensions is configurable when |
| 1030 | .I \%ncurses |
| 1031 | is compiled; |
| 1032 | see sections \*(``ALTERNATE CONFIGURATIONS\*('' and \*(``EXTENSIONS\*('' |
| 1033 | below. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1034 | .SH RETURN VALUE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1035 | Unless otherwise noted, |
| 1036 | functions that return an integer return |
| 1037 | .B OK |
| 1038 | on success and |
| 1039 | .B ERR |
| 1040 | on failure. |
| 1041 | Functions that return pointers return |
| 1042 | .B NULL |
| 1043 | on failure. |
| 1044 | Typically, |
| 1045 | .I \%ncurses |
| 1046 | treats a null pointer passed as a function parameter as a failure. |
| 1047 | Functions prefixed with \*(``mv\*('' first perform cursor movement and |
| 1048 | fail if the position |
| 1049 | .RI ( y , |
| 1050 | .IR x ) |
| 1051 | is outside the window boundaries. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1052 | .SH ENVIRONMENT |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1053 | The following symbols from the process environment customize the |
| 1054 | runtime behavior of |
| 1055 | .I \%ncurses |
| 1056 | applications. |
| 1057 | The library may be configured to disregard the variables |
| 1058 | .IR \%TERMINFO , |
| 1059 | .IR \%TERMINFO_DIRS , |
| 1060 | .IR \%TERMPATH , |
| 1061 | and |
| 1062 | .IR HOME , |
| 1063 | if the user is the superuser (root), |
| 1064 | or the application uses \fI\%setuid\fP(2) or \fI\%setgid\fP(2). |
| 1065 | .SS "\fIBAUDRATE\fP" |
| 1066 | The debugging library checks this variable when the application has |
| 1067 | redirected output to a file. |
| 1068 | Its integral value is used for the baud rate. |
| 1069 | If that value is absent or invalid, |
| 1070 | .I \%ncurses |
| 1071 | uses 9600. |
| 1072 | This feature allows testers to construct repeatable test cases |
| 1073 | that take into account optimization decisions that depend on baud rate. |
| 1074 | .SS "\fICC\fP (command character)" |
| 1075 | When set, |
| 1076 | the |
| 1077 | .B \%command_character |
| 1078 | .RB ( \%cmdch ) |
| 1079 | capability value of loaded |
| 1080 | .I \%term\%info |
| 1081 | entries changes to the value of this variable. |
| 1082 | Very few |
| 1083 | .I \%term\%info |
| 1084 | entries provide this feature. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1085 | .PP |
| 1086 | Because this name is also used in development environments to represent |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1087 | the C compiler's name, |
| 1088 | .I \%ncurses |
| 1089 | ignores its value if it is not one character in length. |
| 1090 | .SS "\fICOLUMNS\fP" |
| 1091 | This variable specifies the width of the screen in characters. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1092 | Applications running in a windowing environment usually are able to |
| 1093 | obtain the width of the window in which they are executing. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1094 | If |
| 1095 | .I \%COLUMNS |
| 1096 | is not defined and the terminal's screen size is not available from the |
| 1097 | terminal driver, |
| 1098 | .I \%ncurses |
| 1099 | uses the size specified by the |
| 1100 | .B \%columns |
| 1101 | .RB ( \%cols ) |
| 1102 | capability of the terminal type's entry in the |
| 1103 | .I \%term\%info |
| 1104 | database, |
| 1105 | if any. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1106 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1107 | It is important that your application use the correct screen size. |
| 1108 | Automatic detection thereof is not always possible because an |
| 1109 | application may be running on a host that does not honor NAWS |
| 1110 | (Negotiations About Window Size) |
| 1111 | or as a different user ID than the owner of the terminal device file. |
| 1112 | Setting |
| 1113 | .I \%COLUMNS |
| 1114 | and/or |
| 1115 | .I \%LINES |
| 1116 | overrides the library's use of the screen size obtained from the |
| 1117 | operating system. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1118 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1119 | The |
| 1120 | .I \%COLUMNS |
| 1121 | and |
| 1122 | .I \%LINES |
| 1123 | variables may be specified independently. |
| 1124 | This property is useful to circumvent misfeatures of legacy terminal |
| 1125 | type descriptions; |
| 1126 | \fI\%xterm\fP(1) descriptions specifying 65 lines were once notorious. |
| 1127 | For best results, |
| 1128 | avoid specifying |
| 1129 | .B cols |
| 1130 | and |
| 1131 | .B lines |
| 1132 | capability codes in |
| 1133 | .I \%term\%info |
| 1134 | descriptions of terminal emulators. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1135 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1136 | \fBuse_env\fP(3X) can disable use of the process environment |
| 1137 | in determining the screen size. |
| 1138 | \fBuse_tioctl\fP(3X) can update |
| 1139 | .I \%COLUMNS |
| 1140 | and |
| 1141 | .I \%LINES |
| 1142 | to match the screen size obtained from system calls or the terminal |
| 1143 | database. |
| 1144 | .SS "\fIESCDELAY\fP" |
| 1145 | For |
| 1146 | .I curses |
| 1147 | to distinguish the ESC character resulting from a user's press of the |
| 1148 | \*(``Escape\*('' key on the input device from one beginning an |
| 1149 | .I "escape sequence" |
| 1150 | (as commonly produced by function keys), |
| 1151 | it waits after receiving the escape character to see if further |
| 1152 | characters are available on the input stream within a short interval. |
| 1153 | A global variable |
| 1154 | .B \%ESCDELAY |
| 1155 | stores this interval in milliseconds. |
| 1156 | The default value of 1000 |
| 1157 | (one second) |
| 1158 | is adequate for most uses. |
| 1159 | This environment variable overrides it. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1160 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1161 | The most common instance where you may wish to change this value |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1162 | is to work with a remote host over a slow communication channel. |
| 1163 | If the host running a |
| 1164 | .I curses |
| 1165 | application does not receive the characters of an escape sequence in a |
| 1166 | timely manner, |
| 1167 | the library can interpret them as multiple key stroke events. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1168 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1169 | \fI\%xterm\fP(1) mouse events are a form of escape sequence; |
| 1170 | therefore, |
| 1171 | if your application makes heavy use of multiple-clicking, |
| 1172 | you may wish to lengthen the default value because the delay applies |
| 1173 | to the composite multi-click event as well as the individual clicks. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1174 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1175 | Portable applications should not rely upon the presence of |
| 1176 | .B \%ESCDELAY |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1177 | in either form, |
| 1178 | but setting the environment variable rather than the global variable |
| 1179 | does not create problems when compiling an application. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1180 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1181 | If \fB\%keypad\fP(3X) is disabled for the |
| 1182 | .I curses |
| 1183 | window receiving input, |
| 1184 | a program must disambiguate escape sequences itself. |
| 1185 | .SS "\fIHOME\fP" |
| 1186 | .I \%ncurses |
| 1187 | may read and write auxiliary terminal descriptions in |
| 1188 | .I \%.termcap |
| 1189 | and |
| 1190 | .I \%.terminfo |
| 1191 | files in the user's home directory. |
| 1192 | .SS "\fILINES\fP" |
| 1193 | This counterpart to |
| 1194 | .I \%COLUMNS |
| 1195 | specifies the height of the screen in characters. |
| 1196 | The corresponding |
| 1197 | .I \%term\%info |
| 1198 | capability and code is |
| 1199 | .BR \%lines . |
| 1200 | See the description of the |
| 1201 | .I \%COLUMNS |
| 1202 | variable above. |
| 1203 | .SS "\fIMOUSE_BUTTONS_123\fP" |
| 1204 | (OS/2 EMX port only) |
| 1205 | OS/2 numbers a three-button mouse inconsistently with other platforms, |
| 1206 | such that 1 is the left button, |
| 1207 | 2 the right, |
| 1208 | and 3 the middle. |
| 1209 | This variable customizes the mouse button numbering. |
| 1210 | Its value must be three digits 1\-3 in any order. |
| 1211 | By default, |
| 1212 | .I \%ncurses |
| 1213 | assumes a numbering of \*(``132\*(''. |
| 1214 | .SS "\fINCURSES_ASSUMED_COLORS\fP" |
| 1215 | If set, |
| 1216 | this variable overrides the |
| 1217 | .I \%ncurses |
| 1218 | library's compiled-in assumption that the terminal's default colors are |
| 1219 | white on black; |
| 1220 | see \fB\%default_colors\fP(3X). |
| 1221 | Set the foreground and background color values with this environment |
| 1222 | variable by assigning it two integer values separated by a comma, |
| 1223 | indicating foregound and background color numbers, |
| 1224 | respectively. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1225 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1226 | For example, |
| 1227 | to tell |
| 1228 | .I \%ncurses |
| 1229 | not to assume anything about the colors, |
| 1230 | use a value of \*(``\-1,\-1\*(''. |
| 1231 | To make the default color scheme green on black, |
| 1232 | use \*(``2,0\*(''. |
| 1233 | .I \%ncurses |
| 1234 | accepts integral values from \-1 up to the value of the |
| 1235 | .I \%term\%info |
| 1236 | .B \%max_colors |
| 1237 | .RB ( colors ) |
| 1238 | capability. |
| 1239 | .SS "\fINCURSES_CONSOLE2\fP" |
| 1240 | (MinGW port only) |
| 1241 | The |
| 1242 | .I \%Console2 |
| 1243 | .\" https://www.hanselman.com/blog/console2-a-better-windows-command-prompt |
| 1244 | program defectively handles the Microsoft Console API call |
| 1245 | .IR \%Create\%Console\%Screen\%Buffer . |
| 1246 | Applications that use it will hang. |
| 1247 | However, |
| 1248 | it is possible to simulate the action of this call by mapping |
| 1249 | coordinates, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1250 | explicitly saving and restoring the original screen contents. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1251 | Setting the environment variable |
| 1252 | .I \%NCGDB |
| 1253 | has the same effect. |
| 1254 | .SS "\fINCURSES_GPM_TERMS\fP" |
| 1255 | (Linux only) |
| 1256 | When |
| 1257 | .I \%ncurses |
| 1258 | is configured to use the GPM interface, |
| 1259 | this variable may list one or more terminal names |
| 1260 | against which the |
| 1261 | .I TERM |
| 1262 | variable |
| 1263 | (see below) |
| 1264 | is matched. |
| 1265 | An empty value disables the GPM interface, |
| 1266 | using |
| 1267 | .IR \%ncurses 's |
| 1268 | built-in support for \fIxterm\fP(1) mouse protocols instead. |
| 1269 | If the variable is absent, |
| 1270 | .I \%ncurses |
| 1271 | attempts to open GPM if |
| 1272 | .I TERM |
| 1273 | contains \*(``linux\*(''. |
| 1274 | .SS "\fINCURSES_NO_HARD_TABS\fP" |
| 1275 | .I \%ncurses |
| 1276 | may use tab characters in cursor movement optimization. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1277 | In some cases, |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1278 | your terminal driver may not handle them properly. |
| 1279 | Set this environment variable to any value to disable the feature. |
| 1280 | You can also adjust your \fI\%stty\fP(1) settings to avoid the problem. |
| 1281 | .SS "\fINCURSES_NO_MAGIC_COOKIE\fP" |
| 1282 | Many terminals store video attributes as a property of a character cell, |
| 1283 | as |
| 1284 | .I curses |
| 1285 | does. |
| 1286 | Historically, |
| 1287 | some recorded changes in video attributes as data that logically |
| 1288 | .I occupies |
| 1289 | character cells on the display, |
| 1290 | switching attributes on or off, |
| 1291 | similarly to tags in a markup language; |
| 1292 | these are termed \*(``magic cookies\*('', |
| 1293 | and must be subsequently overprinted. |
| 1294 | If the |
| 1295 | .I \%term\%info |
| 1296 | entry for your terminal type does not adequately describe its handling |
| 1297 | of magic cookies, |
| 1298 | set this variable to any value to instruct |
| 1299 | .I \%ncurses |
| 1300 | to disable attributes entirely. |
| 1301 | .SS "\fINCURSES_NO_PADDING\fP" |
| 1302 | Most terminal type descriptions in the |
| 1303 | .I \%term\%info |
| 1304 | database detail hardware devices. |
| 1305 | Many people use |
| 1306 | .IR curses -based |
| 1307 | applications in terminal emulator programs that run in a windowing |
| 1308 | environment. |
| 1309 | These programs can duplicate all of the important features of a hardware |
| 1310 | terminal, |
| 1311 | but often lack their limitations. |
| 1312 | Chief among these absent drawbacks is the problem of data flow |
| 1313 | management; |
| 1314 | that is, |
| 1315 | limiting the speed of communication to what the hardware could handle. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1316 | Unless a hardware terminal is interfaced into a terminal concentrator |
| 1317 | (which does flow control), |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1318 | an application must manage flow control itself to prevent overruns and |
| 1319 | data loss. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1320 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1321 | A solution that comes at no hardware cost is for an application to pause |
| 1322 | after directing a terminal to execute an operation that it performs |
| 1323 | slowly, |
| 1324 | such as clearing the display. |
| 1325 | Many terminal type descriptions, |
| 1326 | including that for the VT100, |
| 1327 | embed delay specifications in capabilities. |
| 1328 | You may wish to use these terminal descriptions without paying the |
| 1329 | performance penalty. |
| 1330 | Set |
| 1331 | .I \%NCURSES_NO_PADDING |
| 1332 | to any value to disable all but mandatory padding. |
| 1333 | Mandatory padding is used by such terminal capabilities as |
| 1334 | .B \%flash_screen |
| 1335 | .RB ( flash ). |
| 1336 | .SS "\fINCURSES_NO_SETBUF\fP" |
| 1337 | (Obsolete) |
| 1338 | Prior to internal changes developed in |
| 1339 | .I \%ncurses |
| 1340 | 5.9 |
| 1341 | (patches 20120825 through 20130126), |
| 1342 | the library used \fI\%setbuf\fP(3) to enable fully buffered output when |
| 1343 | initializing the terminal. |
| 1344 | This was done, |
| 1345 | as in SVr4 |
| 1346 | .IR curses , |
| 1347 | to increase performance. |
| 1348 | For testing purposes, |
| 1349 | both of |
| 1350 | .I \%ncurses |
| 1351 | and of certain applications, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1352 | this feature was made optional. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1353 | Setting this variable disabled output buffering, |
| 1354 | leaving the output stream in the original |
| 1355 | (usually line-buffered) |
| 1356 | mode. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1357 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1358 | Nowadays, |
| 1359 | .I \%ncurses |
| 1360 | performs its own buffering and does not require this workaround; |
| 1361 | it does not modify the buffering of the standard output stream. |
| 1362 | This approach makes signal handling, |
| 1363 | as for interrupts, |
| 1364 | more robust. |
| 1365 | A drawback is that certain unconventional programs mixed |
| 1366 | \fI\%stdio\fP(3) calls with |
| 1367 | .I \%ncurses |
| 1368 | calls and (usually) |
| 1369 | got the behavior they expected. |
| 1370 | This is no longer the case; |
| 1371 | .I \%ncurses |
| 1372 | does not write to the standard output file descriptor through a |
| 1373 | .IR stdio -buffered |
| 1374 | stream. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1375 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1376 | As a special case, |
| 1377 | low-level API calls such as \fB\%putp\fP(3X) still use the |
| 1378 | standard output stream. |
| 1379 | High-level |
| 1380 | .I curses |
| 1381 | calls such as \fB\%printw\fP(3X) do not. |
| 1382 | .SS "\fINCURSES_NO_UTF8_ACS\fP" |
| 1383 | At initialization, |
| 1384 | .I \%ncurses |
| 1385 | inspects the |
| 1386 | .I TERM |
| 1387 | environment variable for special cases where VT100 forms-drawing |
| 1388 | characters |
| 1389 | (and the corresponding alternate character set |
| 1390 | .I \%term\%info |
| 1391 | capabilities) |
| 1392 | are known to be unsupported by terminal types that otherwise claim VT100 |
| 1393 | compatibility. |
| 1394 | Specifically, |
| 1395 | when running in a UTF-8 locale, |
| 1396 | the Linux virtual console device and the GNU \fI\%screen\fP(1) |
| 1397 | program ignore them. |
| 1398 | Set this variable to a nonzero value to instruct |
| 1399 | .I \%ncurses |
| 1400 | that the terminal's ACS support is broken; |
| 1401 | the library then outputs Unicode code points that correspond to the |
| 1402 | forms-drawing |
| 1403 | characters. |
| 1404 | Set it to zero |
| 1405 | (or a non-integer) |
| 1406 | to disable the special check for terminal type names matching |
| 1407 | \*(``linux\*('' or \*(``screen\*('', |
| 1408 | directing |
| 1409 | .I \%ncurses |
| 1410 | to assume that the ACS feature works if the terminal type description |
| 1411 | advertises it. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1412 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1413 | As an alternative to use of this variable, |
| 1414 | .I \%ncurses |
| 1415 | checks for an extended |
| 1416 | .I \%term\%info |
| 1417 | numeric capability \fBU8\fP |
| 1418 | that can be compiled using |
| 1419 | .RB \*(`` "@TIC@ \-x" \*(''. |
| 1420 | Examples follow. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1421 | .PP |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1422 | .RS 3 |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1423 | .EX |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1424 | # linux console, if patched to provide working |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1425 | # VT100 shift\-in/shift\-out, with corresponding font. |
| 1426 | linux\-vt100|linux console with VT100 line\-graphics, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1427 | U8#0, use=linux, |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1428 | \& |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1429 | # uxterm with vt100Graphics resource set to false |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1430 | xterm\-utf8|xterm relying on UTF\-8 line\-graphics, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1431 | U8#1, use=xterm, |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1432 | .EE |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1433 | .RE |
| 1434 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1435 | The two-character name \*(``U8\*('' was chosen to permit its use via |
| 1436 | .IR \%ncurses 's |
| 1437 | .I termcap |
| 1438 | interface. |
| 1439 | .SS "\fINCURSES_TRACE\fP" |
| 1440 | At initialization, |
| 1441 | .I \%ncurses |
| 1442 | (in its debugging configuration) |
| 1443 | checks for this variable's presence. |
| 1444 | If defined with an integral value, |
| 1445 | the library calls \fB\%curses_trace\fP(3X) with that value as the |
| 1446 | argument. |
| 1447 | .SS "\fITERM\fP" |
| 1448 | The |
| 1449 | .I TERM |
| 1450 | variable denotes the terminal type. |
| 1451 | Each is distinct, |
| 1452 | though many are similar. |
| 1453 | It is commonly set by terminal emulators to help applications find a |
| 1454 | workable terminal description. |
| 1455 | Some choose a popular approximation such as \*(``ansi\*('', |
| 1456 | \*(``vt100\*('', or \*(``xterm\*('' rather than an exact fit to their |
| 1457 | capabilities. |
| 1458 | Not infrequently, |
| 1459 | an application will have problems with that approach; |
| 1460 | for example, |
| 1461 | a key stroke may not operate correctly, |
| 1462 | or produce no effect but seeming garbage characters on the screen. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1463 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1464 | Setting |
| 1465 | .I TERM |
| 1466 | has no effect on hardware operation; |
| 1467 | it affects the way applications communicate with the terminal. |
| 1468 | Likewise, |
| 1469 | as a general rule |
| 1470 | (\fIxterm\fP(1) being a rare exception), |
| 1471 | terminal emulators that allow you to specify |
| 1472 | .I TERM |
| 1473 | as a parameter or configuration value do not change their behavior to |
| 1474 | match that setting. |
| 1475 | .SS "\fITERMCAP\fP" |
| 1476 | If |
| 1477 | .I \%ncurses |
| 1478 | is configured with |
| 1479 | .I termcap |
| 1480 | support, |
| 1481 | it checks for a terminal type description in |
| 1482 | .I termcap |
| 1483 | format if one in |
| 1484 | .I \%term\%info |
| 1485 | format is not available. |
| 1486 | Setting this variable directs |
| 1487 | .I \%ncurses |
| 1488 | to ignore the usual |
| 1489 | .I termcap |
| 1490 | database location, |
| 1491 | .IR \%/etc/termcap ; |
| 1492 | see |
| 1493 | .I \%TERMPATH |
| 1494 | below. |
| 1495 | .I \%TERMCAP |
| 1496 | should contain either a terminal description |
| 1497 | (with newlines stripped out), |
| 1498 | or a file name indicating where the information required by the |
| 1499 | .I TERM |
| 1500 | environment variable is stored. |
| 1501 | .SS "\fITERMINFO\fP" |
| 1502 | .I \%ncurses |
| 1503 | can be configured to read terminal type description databases in various |
| 1504 | locations using different formats. |
| 1505 | This variable overrides the default location. |
| 1506 | .bP |
| 1507 | Descriptions in |
| 1508 | .I \%term\%info |
| 1509 | format are normally stored in a directory tree using subdirectories |
| 1510 | named by the common first letters of the terminal types named therein. |
| 1511 | This is the scheme used in System\ V. |
| 1512 | .bP |
| 1513 | If |
| 1514 | .I \%ncurses |
| 1515 | is configured to use hashed databases, |
| 1516 | then |
| 1517 | .I \%TERM\%INFO |
| 1518 | may name its location, |
| 1519 | such as |
| 1520 | .IR \%/usr/share/terminfo.db , |
| 1521 | rather than |
| 1522 | .IR \%/usr/share/terminfo/ . |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1523 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1524 | The hashed database uses less disk space and is a little faster than the |
| 1525 | directory tree. |
| 1526 | However, |
| 1527 | some applications assume the existence of the directory tree, |
| 1528 | and read it directly |
| 1529 | rather than using the |
| 1530 | .I \%term\%info |
| 1531 | API. |
| 1532 | .bP |
| 1533 | If |
| 1534 | .I \%ncurses |
| 1535 | is configured with |
| 1536 | .I termcap |
| 1537 | support, |
| 1538 | this variable may contain the location of a |
| 1539 | .I \%termcap |
| 1540 | file. |
| 1541 | .bP |
| 1542 | If the value of |
| 1543 | .I \%TERM\%INFO |
| 1544 | begins with \*(``hex:\*('' or \*(``b64:\*('', |
| 1545 | .I \%ncurses |
| 1546 | uses the remainder of the value as a compiled |
| 1547 | .I \%term\%info |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1548 | description. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1549 | You might produce the base64 format using \fB\%infocmp\fP(1M). |
| 1550 | .RS 4 |
| 1551 | .IP |
| 1552 | .EX |
| 1553 | TERMINFO=$(infocmp \-0 \-Q2 \-q) |
| 1554 | export TERMINFO |
| 1555 | .EE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1556 | .RE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1557 | .IP |
| 1558 | The compiled description is used only if it corresponds to the terminal |
| 1559 | type identified by |
| 1560 | .IR TERM . |
| 1561 | .PP |
| 1562 | Setting |
| 1563 | .I \%TERM\%INFO |
| 1564 | is the simplest, |
| 1565 | but not the only, |
| 1566 | way to direct |
| 1567 | .I \%ncurses |
| 1568 | to a terminal database. |
| 1569 | The search path is as follows. |
| 1570 | .bP |
| 1571 | the last terminal database to which the running |
| 1572 | .I \%ncurses |
| 1573 | application wrote, |
| 1574 | if any |
| 1575 | .bP |
| 1576 | the location specified by the |
| 1577 | .I \%TERM\%INFO |
| 1578 | environment variable |
| 1579 | .bP |
| 1580 | .I $HOME/.terminfo |
| 1581 | .bP |
| 1582 | locations listed in the |
| 1583 | .I \%TERMINFO_DIRS |
| 1584 | environment variable |
| 1585 | .ds td \" empty |
| 1586 | .if !'@TERMINFO_DIRS@'no default value' .as td @TERMINFO_DIRS@ |
| 1587 | .if !'@TERMINFO@\*(td'' \{\ |
| 1588 | .bP |
| 1589 | location(s) configured and compiled into |
| 1590 | .I \%ncurses |
| 1591 | .RS 3 |
| 1592 | .if !'\*(td'' \{\ |
| 1593 | .bP |
| 1594 | .I \%@TERMINFO_DIRS@ |
| 1595 | .\} |
| 1596 | .if !'@TERMINFO'' .if !'\*(td'@TERMINFO@' \{\ |
| 1597 | .bP |
| 1598 | .I \%@TERMINFO@ |
| 1599 | .\} |
| 1600 | .\} |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1601 | .RE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1602 | .SS "\fITERMINFO_DIRS\fP" |
| 1603 | This variable specifies a list of locations, |
| 1604 | akin to |
| 1605 | .IR PATH , |
| 1606 | in which |
| 1607 | .I \%ncurses |
| 1608 | searches for the terminal type descriptions described by |
| 1609 | .I \%TERMINFO |
| 1610 | above. |
| 1611 | The list items are separated by colons on Unix |
| 1612 | and semicolons on OS/2 EMX. |
| 1613 | System\ V |
| 1614 | .I \%term\%info |
| 1615 | lacks a corresponding feature; |
| 1616 | .I \%TERMINFO_DIRS |
| 1617 | is an |
| 1618 | .I \%ncurses |
| 1619 | extension. |
| 1620 | .SS "\fITERMPATH\fP" |
| 1621 | If |
| 1622 | .I \%TERMCAP |
| 1623 | does not hold a terminal type description or file name, |
| 1624 | then |
| 1625 | .I \%ncurses |
| 1626 | checks the contents of |
| 1627 | .IR \%TERMPATH , |
| 1628 | a list of locations, |
| 1629 | akin to |
| 1630 | .IR PATH , |
| 1631 | in which it searches for |
| 1632 | .I termcap |
| 1633 | terminal type descriptions. |
| 1634 | The list items are separated by colons on Unix |
| 1635 | and semicolons on OS/2 EMX. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1636 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1637 | If both |
| 1638 | .I \%TERMCAP |
| 1639 | and |
| 1640 | .I \%TERMPATH |
| 1641 | are unset or invalid, |
| 1642 | .I \%ncurses |
| 1643 | searches for the files |
| 1644 | .IR \%/etc/termcap , |
| 1645 | .IR \%/usr/share/misc/termcap , |
| 1646 | and |
| 1647 | .IR \%$HOME/.termcap , |
| 1648 | in that order. |
| 1649 | .SH "ALTERNATE CONFIGURATIONS" |
| 1650 | Many different |
| 1651 | .I \%ncurses |
| 1652 | configurations are possible, |
| 1653 | determined by the options given to the |
| 1654 | .I \%configure |
| 1655 | script when building the library. |
| 1656 | Run the script with the |
| 1657 | .B \-\-help |
| 1658 | option to peruse them all. |
| 1659 | A few are of particular significance to the application developer |
| 1660 | employing |
| 1661 | .IR \%ncurses . |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1662 | .TP 5 |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1663 | .B \-\-disable\-overwrite |
| 1664 | The standard include for \fI\%ncurses\fP is as noted in \fBSYNOPSIS\fP: |
| 1665 | .RS 5 |
| 1666 | .PP |
| 1667 | .RS 4 |
| 1668 | .EX |
| 1669 | \fB#include <curses.h>\fP |
| 1670 | .EE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1671 | .RE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1672 | .PP |
| 1673 | This option is used to avoid filename conflicts when \fI\%ncurses\fP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1674 | is not the main implementation of curses of the computer. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1675 | If \fI\%ncurses\fP is installed disabling overwrite, |
| 1676 | it puts its headers in a subdirectory, |
| 1677 | e.g., |
| 1678 | .PP |
| 1679 | .RS 4 |
| 1680 | .EX |
| 1681 | \fB#include <ncurses/curses.h>\fP |
| 1682 | .EE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1683 | .RE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1684 | .PP |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1685 | It also omits a symbolic link which would allow you to use \fB\-lcurses\fP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1686 | to build executables. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1687 | .RE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1688 | .TP 5 |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1689 | .B \-\-enable\-widec |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1690 | The configure script renames the library and |
| 1691 | (if the \fB\-\-disable\-overwrite\fP option is used) |
| 1692 | puts the header files in a different subdirectory. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1693 | All of the library names have a \*(``w\*('' appended to them, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1694 | i.e., instead of |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1695 | .RS 5 |
| 1696 | .PP |
| 1697 | .RS 4 |
| 1698 | .EX |
| 1699 | \fB\-lncurses\fP |
| 1700 | .EE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1701 | .RE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1702 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1703 | you link with |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1704 | .PP |
| 1705 | .RS 4 |
| 1706 | .EX |
| 1707 | \fB\-lncursesw\fP |
| 1708 | .EE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1709 | .RE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1710 | .PP |
| 1711 | You must also enable the wide-character features in the header file |
| 1712 | when compiling for the wide-character library |
| 1713 | to use the extended (wide-character) functions. |
| 1714 | The symbol which enables these features has changed |
| 1715 | since X/Open Curses, Issue 4: |
| 1716 | .bP |
| 1717 | Originally, the wide-character feature required the symbol |
| 1718 | \fB_XOPEN_SOURCE_EXTENDED\fP |
| 1719 | but that was only valid for XPG4 (1996). |
| 1720 | .bP |
| 1721 | Later, that was deemed conflicting with \fB_XOPEN_SOURCE\fP defined to 500. |
| 1722 | .bP |
| 1723 | As of mid-2018, |
| 1724 | none of the features in this implementation require a \fB_XOPEN_SOURCE\fP |
| 1725 | feature greater than 600. |
| 1726 | However, X/Open Curses, Issue 7 (2009) recommends defining it to 700. |
| 1727 | .bP |
| 1728 | Alternatively, you can enable the feature by defining \fBNCURSES_WIDECHAR\fP |
| 1729 | with the caveat that some other header file than \fBcurses.h\fP |
| 1730 | may require a specific value for \fB_XOPEN_SOURCE\fP |
| 1731 | (or a system-specific symbol). |
| 1732 | .PP |
| 1733 | The \fI\%curses.h\fP header file installed for the wide-character |
| 1734 | library is designed to be compatible with the non-wide library's header. |
| 1735 | Only the size of the \fI\%WINDOW\fP structure differs; |
| 1736 | few applications require more than pointers to \fI\%WINDOW\fPs. |
| 1737 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1738 | If the headers are installed allowing overwrite, |
| 1739 | the wide-character library's headers should be installed last, |
| 1740 | to allow applications to be built using either library |
| 1741 | from the same set of headers. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1742 | .RE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1743 | .TP 5 |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1744 | .B \-\-with\-pthread |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1745 | The configure script renames the library. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1746 | All of the library names have a \*(``t\*('' appended to them |
| 1747 | (before any \*(``w\*('' added by \fB\-\-enable\-widec\fP). |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1748 | .IP |
| 1749 | The global variables such as \fBLINES\fP are replaced by macros to |
| 1750 | allow read-only access. |
| 1751 | At the same time, setter-functions are provided to set these values. |
| 1752 | Some applications (very few) may require changes to work with this convention. |
| 1753 | .TP 5 |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1754 | .B \-\-with\-shared |
| 1755 | .tQ |
| 1756 | .B \-\-with\-normal |
| 1757 | .tQ |
| 1758 | .B \-\-with\-debug |
| 1759 | .tQ |
| 1760 | .B \-\-with\-profile |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1761 | The shared and normal (static) library names differ by their suffixes, |
| 1762 | e.g., \fBlibncurses.so\fP and \fBlibncurses.a\fP. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1763 | The debug and profiling libraries add a \*(``_g\*('' |
| 1764 | and a \*(``_p\*('' to the root names respectively, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1765 | e.g., \fBlibncurses_g.a\fP and \fBlibncurses_p.a\fP. |
| 1766 | .TP 5 |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1767 | .B \-\-with\-termlib |
| 1768 | Low-level functions which do not depend upon whether the library |
| 1769 | supports wide-characters, are provided in the tinfo library. |
| 1770 | .IP |
| 1771 | By doing this, it is possible to share the tinfo library between |
| 1772 | wide/normal configurations as well as reduce the size of the library |
| 1773 | when only low-level functions are needed. |
| 1774 | .IP |
| 1775 | Those functions are described in these pages: |
| 1776 | .RS |
| 1777 | .bP |
| 1778 | \fB\%curs_extend\fP(3X) \- miscellaneous \fIcurses\fP extensions |
| 1779 | .bP |
| 1780 | \fB\%curs_inopts\fP(3X) \- \fIcurses\fP input options |
| 1781 | .bP |
| 1782 | \fB\%curs_kernel\fP(3X) \- low-level \fIcurses\fP routines |
| 1783 | .bP |
| 1784 | \fB\%curs_termattrs\fP(3X) \- \fIcurses\fP environment query routines |
| 1785 | .bP |
| 1786 | \fB\%curs_termcap\fP(3X) \- \fIcurses\fP emulation of \fItermcap\fP |
| 1787 | .bP |
| 1788 | \fB\%curs_terminfo\fP(3X) \- \fIcurses\fP interface to \fIterminfo\fP |
| 1789 | database |
| 1790 | .bP |
| 1791 | \fB\%curs_util\fP(3X) \- miscellaneous \fIcurses\fP utility routines |
| 1792 | .RE |
| 1793 | .TP 5 |
| 1794 | .B \-\-with\-trace |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1795 | The \fBtrace\fP function normally resides in the debug library, |
| 1796 | but it is sometimes useful to configure this in the shared library. |
| 1797 | Configure scripts should check for the function's existence rather |
| 1798 | than assuming it is always in the debug library. |
| 1799 | .SH FILES |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1800 | .TP |
| 1801 | .I @DATADIR@/tabset |
| 1802 | tab stop initialization database |
| 1803 | .TP |
| 1804 | .I \*d |
| 1805 | compiled terminal capability database |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1806 | .SH NOTES |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1807 | X/Open Curses permits most functions it specifies to be made available |
| 1808 | as macros as well. |
| 1809 | .\" See X/Open Curses Issue 4, Version 2, pp. 227-234. |
| 1810 | .\" See X/Open Curses Issue 7, pp. 311-318. |
| 1811 | \fI\%ncurses\fP does so |
| 1812 | .bP |
| 1813 | for functions that return values via their parameters, |
| 1814 | .bP |
| 1815 | to support obsolete features, |
| 1816 | .bP |
| 1817 | to reuse functions |
| 1818 | (for example, |
| 1819 | those that move the cursor before another operation), |
| 1820 | and |
| 1821 | .bP |
| 1822 | a few special cases. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1823 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 1824 | If the standard output file descriptor of an |
| 1825 | .I \%ncurses |
| 1826 | program is redirected to something that is not a terminal device, |
| 1827 | the library writes screen updates to the standard error file descriptor. |
| 1828 | This was an undocumented feature of SVr3 |
| 1829 | .IR curses . |
| 1830 | .PP |
| 1831 | See subsection \*(``Header Files\*('' below regarding symbols exposed by |
| 1832 | inclusion of \fI\%curses.h\fP. |
| 1833 | .SH EXTENSIONS |
| 1834 | .I \%ncurses |
| 1835 | enables an application to capture mouse events on certain terminals, |
| 1836 | including \fI\%xterm\fP(1); |
| 1837 | see \fB\%curs_mouse\fP(3X). |
| 1838 | .PP |
| 1839 | .I \%ncurses |
| 1840 | provides a means of responding to window resizing events, |
| 1841 | as when running in a GUI terminal emulator application such as |
| 1842 | .IR \%xterm ; |
| 1843 | see \fB\%resizeterm\fP(3X) and \fB\%wresize\fP(3X). |
| 1844 | .PP |
| 1845 | .I \%ncurses |
| 1846 | allows an application to query the terminal for the presence of a wide |
| 1847 | variety of special keys; |
| 1848 | see \fB\%has_key\fP(3X). |
| 1849 | .PP |
| 1850 | .I \%ncurses |
| 1851 | extends the fixed set of function key capabilities specified by X/Open |
| 1852 | Curses by allowing the application programmer to define additional key |
| 1853 | events at runtime; |
| 1854 | see |
| 1855 | \fB\%define_key\fP(3X), |
| 1856 | \fB\%key_defined\fP(3X), |
| 1857 | \fB\%keybound\fP(3X), |
| 1858 | and |
| 1859 | \fB\%keyok\fP(3X). |
| 1860 | .PP |
| 1861 | .I \%ncurses |
| 1862 | can exploit the capabilities of terminals implementing ISO\ 6429/ECMA-48 |
| 1863 | SGR\ 39 and SGR\ 49 sequences, |
| 1864 | which allow an application to reset the terminal to its original |
| 1865 | foreground and background colors. |
| 1866 | From a user's perspective, |
| 1867 | the application is able to draw colored text on a background whose color |
| 1868 | is set independently, |
| 1869 | providing better control over color contrasts. |
| 1870 | See \fB\%default_colors\fP(3X). |
| 1871 | .PP |
| 1872 | An |
| 1873 | .I \%ncurses |
| 1874 | application can eschew knowledge of |
| 1875 | .I \%WINDOW |
| 1876 | structure internals, |
| 1877 | instead using accessor functions such as |
| 1878 | \fB\%is_scrollok\fP(3X). |
| 1879 | .PP |
| 1880 | .I \%ncurses |
| 1881 | enables an application to direct application output to a printer |
| 1882 | attached to the terminal device; |
| 1883 | see \fB\%curs_print\fP(3X). |
| 1884 | .PP |
| 1885 | .I \%ncurses |
| 1886 | offers \fB\%slk_attr\fP(3X) as a counterpart of \fB\%attr_get\fP(3X) for |
| 1887 | soft-label key lines, |
| 1888 | and \fB\%extended_slk_color\fP(3X) as a form of \fB\%slk_color\fP(3X) |
| 1889 | that can gather color information from them when many colors are |
| 1890 | supported. |
| 1891 | .PP |
| 1892 | Some extensions are available only if |
| 1893 | .I \%ncurses |
| 1894 | permits modification of \fB\%unctrl\fP(3X)'s behavior; |
| 1895 | see \fB\%use_legacy_coding\fP(3X). |
| 1896 | .I \%ncurses |
| 1897 | is compiled to support them; |
| 1898 | section \*(``ALTERNATE CONFIGURATIONS\*('' describes how. |
| 1899 | .bP |
| 1900 | Rudimentary support for multi-threaded applications may be available; |
| 1901 | see \fBcurs_threads\fP(3X). |
| 1902 | .bP |
| 1903 | Functions that ease the management of multiple screens can be exposed; |
| 1904 | see \fBcurs_sp_funcs\fP(3X). |
| 1905 | .bP |
| 1906 | To aid applications to debug their memory usage, |
| 1907 | .I ncurses |
| 1908 | optionally offers functions to more aggressively free memory it |
| 1909 | dynamically allocates itself; |
| 1910 | see \fBcurs_memleaks\fP(3X). |
| 1911 | .bP |
| 1912 | The library facilitates auditing and troubleshooting of its behavior; |
| 1913 | see \fBcurs_trace\fP(3X). |
| 1914 | .bP |
| 1915 | The compiler option |
| 1916 | .B \%\-DUSE_GETCAP |
| 1917 | causes the library to fall back to reading |
| 1918 | .I \%/etc/termcap |
| 1919 | if the terminal setup code cannot find a |
| 1920 | .I \%term\%info |
| 1921 | entry corresponding to |
| 1922 | .IR TERM . |
| 1923 | Use of this feature is not recommended, |
| 1924 | as it essentially includes an entire |
| 1925 | .I termcap |
| 1926 | compiler in the |
| 1927 | .I \%ncurses |
| 1928 | startup code, |
| 1929 | at a cost in memory usage and application launch latency. |
| 1930 | .PP |
| 1931 | .I \%PDCurses |
| 1932 | and NetBSD |
| 1933 | .I curses |
| 1934 | incorporate some |
| 1935 | .I \%ncurses |
| 1936 | extensions. |
| 1937 | Individual man pages indicate where this is the case. |
| 1938 | .SH PORTABILITY |
| 1939 | X/Open Curses defines two levels of conformance, |
| 1940 | \*(``base\*('' and \*(``enhanced\*(''. |
| 1941 | The latter includes several additional features, |
| 1942 | such as wide-character and color support. |
| 1943 | .I \%ncurses |
| 1944 | intends base-level conformance with X/Open Curses, |
| 1945 | and supports all features of its enhanced level |
| 1946 | except the \fB\%untic\fP utility. |
| 1947 | .PP |
| 1948 | Differences between X/Open Curses and |
| 1949 | .I \%ncurses |
| 1950 | are documented in the \*(``PORTABILITY\*('' sections of applicable man |
| 1951 | pages. |
| 1952 | .SS "Error Checking" |
| 1953 | In many cases, X/Open Curses is vague about error conditions, |
| 1954 | omitting some of the SVr4 documentation. |
| 1955 | .PP |
| 1956 | Unlike other implementations, |
| 1957 | .I \%ncurses |
| 1958 | checks pointer parameters, |
| 1959 | such as those to |
| 1960 | .I \%WINDOW |
| 1961 | structures, |
| 1962 | to ensure that they are not null. |
| 1963 | This is done primarily to guard against programmer error. |
| 1964 | The standard interface does not provide a way for the library |
| 1965 | to tell an application which of several possible errors occurred. |
| 1966 | Relying on this |
| 1967 | (or some other) |
| 1968 | extension adversely affects the portability of |
| 1969 | .I curses |
| 1970 | applications. |
| 1971 | .SS "Padding Differences" |
| 1972 | In historical |
| 1973 | .I curses |
| 1974 | implementations, |
| 1975 | delays embedded in the |
| 1976 | .I \%term\%info |
| 1977 | capabilities |
| 1978 | .B \%carriage_return |
| 1979 | .RB ( cr ), |
| 1980 | .B \%scroll_forward |
| 1981 | .RB ( ind ), |
| 1982 | .B \%cursor_left |
| 1983 | .RB ( cub1 ), |
| 1984 | .B \%form_feed |
| 1985 | .RB ( ff ), |
| 1986 | and |
| 1987 | .B \%tab |
| 1988 | .RB ( ht ) |
| 1989 | activated corresponding delay bits in the Unix terminal driver. |
| 1990 | .I \%ncurses |
| 1991 | performs all padding by sending NUL bytes to the device. |
| 1992 | This method is slightly more expensive, |
| 1993 | but narrows the interface to the Unix kernel significantly and |
| 1994 | correspondingly increases the package's portability. |
| 1995 | .SS "Header Files" |
| 1996 | The header file |
| 1997 | .I \%curses.h |
| 1998 | itself includes the header files |
| 1999 | .I \%stdio.h |
| 2000 | and |
| 2001 | .IR \%unctrl.h . |
| 2002 | .PP |
| 2003 | X/Open Curses has more to say, |
| 2004 | .RS 4 |
| 2005 | .PP |
| 2006 | The inclusion of |
| 2007 | .I \%curses.h |
| 2008 | may make visible all symbols from the headers |
| 2009 | .IR \%stdio.h , |
| 2010 | .IR \%term.h , |
| 2011 | .IR \%termios.h , |
| 2012 | and |
| 2013 | .IR \%wchar.h . |
| 2014 | .RE |
| 2015 | .PP |
| 2016 | but does not finish the story. |
| 2017 | A more complete account follows. |
| 2018 | .bP |
| 2019 | Starting with 4BSD |
| 2020 | .I curses |
| 2021 | (1980) |
| 2022 | all implementations have provided a |
| 2023 | .I \%curses.h |
| 2024 | file. |
| 2025 | .IP |
| 2026 | BSD |
| 2027 | .I curses |
| 2028 | code included |
| 2029 | .I \%curses.h |
| 2030 | and |
| 2031 | .I \%unctrl.h |
| 2032 | from an internal header file |
| 2033 | .IR \%curses.ext , |
| 2034 | where |
| 2035 | \*(``ext\*('' abbreviated \*(``externs\*(''. |
| 2036 | .IP |
| 2037 | The implementations of |
| 2038 | .I \%printw |
| 2039 | and |
| 2040 | .I \%scanw |
| 2041 | used undocumented internal functions of the standard I/O library |
| 2042 | .RI ( _doprnt |
| 2043 | and |
| 2044 | .IR _doscan ), |
| 2045 | but nothing in |
| 2046 | .I \%curses.h |
| 2047 | itself relied upon |
| 2048 | .IR \%stdio.h . |
| 2049 | .bP |
| 2050 | SVr2 |
| 2051 | .I curses |
| 2052 | added |
| 2053 | .IR \%newterm , |
| 2054 | which relies upon |
| 2055 | .I \%stdio.h |
| 2056 | because its function prototype employs the |
| 2057 | .I FILE |
| 2058 | type. |
| 2059 | .IP |
| 2060 | SVr4 |
| 2061 | .I curses |
| 2062 | added |
| 2063 | .I \%putwin |
| 2064 | and |
| 2065 | .IR \%getwin , |
| 2066 | which also use |
| 2067 | .IR \%stdio.h . |
| 2068 | .IP |
| 2069 | X/Open Curses specifies all three of these functions. |
| 2070 | .IP |
| 2071 | SVr4 |
| 2072 | .I curses |
| 2073 | and X/Open Curses do not require the developer to include |
| 2074 | .I \%stdio.h |
| 2075 | before |
| 2076 | .IR \%curses.h . |
| 2077 | Both document use of |
| 2078 | .I curses |
| 2079 | as requiring only |
| 2080 | .IR \%curses.h . |
| 2081 | .IP |
| 2082 | As a result, |
| 2083 | standard |
| 2084 | .I \%curses.h |
| 2085 | always includes |
| 2086 | .IR \%stdio.h . |
| 2087 | .bP |
| 2088 | X/Open Curses and SVr4 |
| 2089 | .I curses |
| 2090 | are inconsistent with respect to |
| 2091 | .IR \%unctrl.h . |
| 2092 | .IP |
| 2093 | As noted in \fBcurs_util\fP(3X), |
| 2094 | .I \%ncurses |
| 2095 | includes |
| 2096 | .I \%unctrl.h |
| 2097 | from |
| 2098 | .I \%curses.h |
| 2099 | (as SVr4 does). |
| 2100 | .bP |
| 2101 | X/Open Curses's comments about |
| 2102 | .I \%term.h |
| 2103 | and |
| 2104 | .I \%termios.h |
| 2105 | may refer to HP-UX and AIX. |
| 2106 | .IP |
| 2107 | HP-UX |
| 2108 | .I curses |
| 2109 | includes |
| 2110 | .I \%term.h |
| 2111 | from |
| 2112 | .I \%curses.h |
| 2113 | to declare |
| 2114 | .I \%setupterm |
| 2115 | in |
| 2116 | .IR \%curses.h , |
| 2117 | but |
| 2118 | .I \%ncurses |
| 2119 | and Solaris |
| 2120 | .I curses |
| 2121 | do not. |
| 2122 | .IP |
| 2123 | AIX |
| 2124 | .I curses |
| 2125 | includes |
| 2126 | .I \%term.h |
| 2127 | and |
| 2128 | .IR \% termios.h . |
| 2129 | Again, |
| 2130 | .I \%ncurses |
| 2131 | and Solaris |
| 2132 | .I curses |
| 2133 | do not. |
| 2134 | .bP |
| 2135 | X/Open Curses says that |
| 2136 | .I \%curses.h |
| 2137 | .B may |
| 2138 | include |
| 2139 | .IR \%term.h , |
| 2140 | but does not require it to do so. |
| 2141 | .IP |
| 2142 | Some programs use functions declared in both |
| 2143 | .I \%curses.h |
| 2144 | and |
| 2145 | .IR \%term.h , |
| 2146 | and must include both header files in the same module. |
| 2147 | Very old versions of AIX |
| 2148 | .I curses |
| 2149 | required inclusion of |
| 2150 | .I \%curses.h |
| 2151 | before |
| 2152 | .IR \%term.h . |
| 2153 | .IP |
| 2154 | The header files supplied by |
| 2155 | .I \%ncurses |
| 2156 | include the standard library headers required for its declarations, |
| 2157 | so |
| 2158 | .IR \%ncurses 's |
| 2159 | own header files can be included in any order. |
| 2160 | But for portability, |
| 2161 | you should include |
| 2162 | .I \%curses.h |
| 2163 | before |
| 2164 | .IR \%term.h . |
| 2165 | .bP |
| 2166 | X/Open Curses says \*(``may make visible\*('' because including a header |
| 2167 | file does not necessarily make visible all of the symbols in it |
| 2168 | (consider |
| 2169 | .B \%#ifdef |
| 2170 | and similar). |
| 2171 | .IP |
| 2172 | For instance, |
| 2173 | .IR \%ncurses 's |
| 2174 | .I \%curses.h |
| 2175 | .B may \" bold to contrast with preceding italic |
| 2176 | include |
| 2177 | .I \%wchar.h |
| 2178 | if the proper symbol is defined, |
| 2179 | and if |
| 2180 | .I \%ncurses |
| 2181 | is configured for wide-character support. |
| 2182 | If |
| 2183 | .I \%wchar.h |
| 2184 | is included, |
| 2185 | its symbols |
| 2186 | .B may \" bold for consistency in this paragraph |
| 2187 | be made visible depending on the value of the |
| 2188 | .B _XOPEN_SOURCE |
| 2189 | feature test macro. |
| 2190 | .bP |
| 2191 | X/Open Curses mandates an application's inclusion of one standard C |
| 2192 | library header in a special case: |
| 2193 | .I \%stdarg.h |
| 2194 | before |
| 2195 | .I \%curses.h |
| 2196 | to prototype the functions |
| 2197 | .I \%vw_printw |
| 2198 | and |
| 2199 | .I \%vw_scanw |
| 2200 | (as well as the obsolete |
| 2201 | .I \%vwprintw |
| 2202 | and |
| 2203 | .IR \%vwscanw ). |
| 2204 | Each of these takes a variadic argument list, |
| 2205 | a |
| 2206 | .I \%va_list |
| 2207 | parameter, |
| 2208 | like that of \fI\%printf\fP(3). |
| 2209 | .IP |
| 2210 | SVr3 |
| 2211 | .I curses |
| 2212 | introduced |
| 2213 | the two obsolete functions, |
| 2214 | and X/Open Curses the others. |
| 2215 | In between, |
| 2216 | SVr4 |
| 2217 | .I curses |
| 2218 | provided for the possibility that an application might include either |
| 2219 | .I \%varargs.h |
| 2220 | or |
| 2221 | .IR \%stdarg.h . |
| 2222 | These represented contrasting approaches to handling variadic |
| 2223 | argument lists. |
| 2224 | The older interface, |
| 2225 | .IR \%varargs.h , |
| 2226 | used a pointer to |
| 2227 | .I char \" V7, 32V, System III, 3BSD |
| 2228 | for variadic functions' |
| 2229 | .I \%va_list |
| 2230 | parameter. |
| 2231 | Later, |
| 2232 | the list acquired its own standard data type, |
| 2233 | .IR \%va_list , |
| 2234 | defined in |
| 2235 | .IR \%stdarg.h , |
| 2236 | empowering the compiler to check the types of a function call's actual |
| 2237 | parameters against the formal ones declared in its prototype. |
| 2238 | .IP |
| 2239 | No conforming implementations of X/Open Curses require an application |
| 2240 | to include |
| 2241 | .I \%stdarg.h |
| 2242 | before |
| 2243 | .I \%curses.h |
| 2244 | because they either have allowed for a special type, |
| 2245 | or, |
| 2246 | like |
| 2247 | .IR \%ncurses , |
| 2248 | they include |
| 2249 | .I \%stdarg.h |
| 2250 | themselves to provide a portable interface. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 2251 | .SH AUTHORS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 2252 | Zeyd M. Ben-Halim, |
| 2253 | Eric S. Raymond, |
| 2254 | Thomas E. Dickey. |
| 2255 | Based on |
| 2256 | .I \%pcurses |
| 2257 | by Pavel Curtis. |
| 2258 | .SH SEE ALSO |
| 2259 | \fB\%curs_variables\fP(3X), |
| 2260 | \fB\%terminfo\fP(5), |
| 2261 | \fB\%user_caps\fP(5) |