Legacy functions
X/Open notes that vidattr
and vidputs
may be macros.
The function setterm
is not described by X/Open and must be
considered non-portable. All other functions are as described by
X/Open.
Legacy data
setupterm
copies the terminal name to the array ttytype
. This is
not part of X/Open Curses, but is assumed by some applications.
Other implementions may not declare the capability name arrays.
Some provide them without declaring them. X/Open does not
specify them.
Extended terminal capability names, e.g., as defined by @TIC@ -x
,
are not stored in the arrays described here.
Output buffering
Older versions of ncurses
assumed that the file descriptor passed
to setupterm
from initscr
or newterm
uses buffered I/O, and would
write to the corresponding stream. In addition to the limitation
that the terminal was left in block-buffered mode on exit (like
System V curses), it was problematic because ncurses
did not
allow a reliable way to cleanup on receiving SIGTSTP.
The current version (ncurses6) uses output buffers managed
directly by ncurses
. Some of the low-level functions described
in this manual page write to the standard output. They are not
signal-safe. The high-level functions in ncurses
use alternate
versions of these functions using the more reliable buffering
scheme.
Function prototypes
The X/Open Curses prototypes are based on the SVr4 curses header
declarations, which were defined at the same time the C language
was first standardized in the late 1980s.
• X/Open Curses uses const
less effectively than a later design
might, in some cases applying it needlessly to values are
already constant, and in most cases overlooking parameters
which normally would use const
. Using constant parameters
for functions which do not use const
may prevent the program
from compiling. On the other hand, writable strings are an
obsolescent feature.
As an extension, this implementation can be configured to
change the function prototypes to use the const
keyword. The
ncurses ABI 6 enables this feature by default.
• X/Open Curses prototypes tparm
with a fixed number of
parameters, rather than a variable argument list.
This implementation uses a variable argument list, but can be
configured to use the fixed-parameter list. Portable
applications should provide 9 parameters after the format;
zeroes are fine for this purpose.
In response to review comments by Thomas E. Dickey, X/Open
Curses Issue 7 proposed the tiparm
function in mid-2009.
Special TERM treatment
If configured to use the terminal-driver, e.g., for the MinGW
port,
• setupterm
interprets a missing/empty TERM variable as the
special value 'unknown'.
• setupterm
allows explicit use of the the windows console
driver by checking if $TERM is set to '#win32con' or an
abbreviation of that string.
Other portability issues
In System V Release 4, set_curterm
has an int
return type and
returns OK
or ERR
. We have chosen to implement the X/Open Curses
semantics.
In System V Release 4, the third argument of tputs
has the type
int (*putc)(char)
.
At least one implementation of X/Open Curses (Solaris) returns a
value other than OK
/ERR
from tputs
. That returns the length of
the string, and does no error-checking.
X/Open notes that after calling mvcur
, the curses state may not
match the actual terminal state, and that an application should
touch and refresh the window before resuming normal curses calls.
Both ncurses
and System V Release 4 curses implement mvcur
using
the SCREEN data allocated in either initscr
or newterm
. So
though it is documented as a terminfo function, mvcur
is really a
curses function which is not well specified.
X/Open states that the old location must be given for mvcur
.
This implementation allows the caller to use -1's for the old
ordinates. In that case, the old location is unknown.