HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)

c
curses_intro(3X) curses_intro(3X)
(X/Open CURSES)
NAME
curses() - Terminal and printer handling and optimization package
DESCRIPTION
Use and Implementation of Interfaces
These routines provide a method for updating screens with reasonable optimization in a terminal indepen-
dent manner. Each of the following statements applies unless explicitly stated otherwise in the detailed
descriptions that follow. If an argument to a function has an invalid value (such as a value outside the
domain of the function, or a pointer outside the address space of the program, or a null pointer), the
behaviour is undefined. Any function declared in a header may also be implemented as a macro defined in
the header, so a library function should not be declared explicitly if its header is included. Any macro
definition of a function can be suppressed locally by enclosing the name of the function in parentheses,
because the name is then not followed by the left parenthesis that indicates expansion of a macro function
name. For the same syntactic reason, it is permitted to take the address of a library function even if it is
also defined as a macro. The use of the C-language #undef construct to remove any such macro definition
will also ensure that an actual function is referred to. Any invocation of a library function that is imple-
mented as a macro will expand to code that evaluates each of its arguments exactly once, fully protected by
parentheses where necessary, so it is generally safe to use arbitrary expressions as arguments. Likewise,
those function-like macros described in the following sections may be invoked in an expression anywhere a
function with a compatible return type could be called.
Provided that a library function can be declared without reference to any type defined in a header, it is also
permissible to declare the function, either explicitly or implicitly, and use it without including its associated
header. If a function that accepts a variable number of arguments is not declared (explicitly or by including
its associated header), the behaviour is undefined.
As a result of changes introduced in this version of the Curses Specification, application writers are only
required to include the minimum number of headers. Implementations of XSI-conformant systems will
make all necessary symbols visible as described in the Headers section of this document.
C Language Definition
The C language that is the basis for the synopses and code examples in this document is ISO C, as specified
in the referenced ISO C standard. Common Usage C, which refers to the C language before standardisa-
tion, was the basis for previous editions of this specification.
The Compilation Environment
Applications should ensure that the feature test macro _XOPEN_SOURCE is defined before inclusion of
any header. This is needed to enable the functionality described in this document, and possibly to enable
functionality defined elsewhere in the Common Applications Environment.
The _XOPEN_SOURCE macro may be defined automatically by the compilation process, but to ensure
maximum portability, applications should make sure that _XOPEN_SOURCE is defined by using either
compiler options or #define directives in the source files, before any #include directives. Identifiers in this
document may only be undefined using the #undef directive. These #undef directives must follow all
#include directives of any headers.
Most strictly conforming POSIX and ISO C applications will compile on systems compliant to this
specification. However, an application which uses any of the items marked as an extension to POSIX and
ISO C, for any purpose other than that shown here, may not compile. In such cases, it may be necessary to
alter those applications to use alternative identifiers.
Since this document is aligned with the ISO C standard, and since all functionality enabled by the
_POSIX_C_SOURCE set equal to 2 should be enabled by _XOPEN_SOURCE, there should be no need to
define either _POSIX_SOURCE or _POSIX_C_SOURCE if _XOPEN_SOURCE is defined. Therefore if
_XOPEN_SOURCE is defined and _POSIX_SOURCE is defined, or _POSIX_C_SOURCE is set equal to 1 or
2, the behaviour is the same as if only _XOPEN_SOURCE is defined. However should
_POSIX_C_SOURCE be set to a value greater than 2, the behaviour is undefined.
The c89 and cc utilities recognise the additional l operand for standard libraries:
lcurses This operand makes visible all library functions referenced in this specification,
(except for those labelled ENHANCED CURSES and except for portions marked with
the EC margin legend).
If the implementation defines _XOPEN_CURSES and if the application defines the
_XOPEN_SOURCE_EXTENDED feature test macro, then -l curses also makes
Section 3114 Hewlett-Packard Company 1 HP-UX 11i Version 1: September 2005