Debian Codegraph @

upstream/debian-unstable/man3/define_key.3ncurses

raw
1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 Thomas E. Dickey *
3 .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
4 .\" *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a *
6 .\" copy of this software and associated documentation files (the *
7 .\" "Software"), to deal in the Software without restriction, including *
8 .\" without limitation the rights to use, copy, modify, merge, publish, *
9 .\" distribute, distribute with modifications, sublicense, and/or sell *
10 .\" copies of the Software, and to permit persons to whom the Software is *
11 .\" furnished to do so, subject to the following conditions: *
12 .\" *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
15 .\" *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 .\" *
24 .\" Except as contained in this notice, the name(s) of the above copyright *
25 .\" holders shall not be used in advertising or otherwise to promote the *
26 .\" sale, use or other dealings in this Software without prior written *
27 .\" authorization. *
28 .\"***************************************************************************
29 .\"
30 .\" Author: Thomas E. Dickey 1997
31 .\"
32 .\" $Id: define_key.3x,v 1.52 2024/12/28 21:26:21 tom Exp $
33 .TH define_key 3NCURSES 2024-12-28 "ncurses 6.6" "Library calls"
34 .
35 .de bP
36 .ie n .IP \(bu 4
37 .el .IP \(bu 2
38 ..
39 .
40 .SH NAME
41 \fB\%define_key\fP \-
42 define a \fIcurses\fP function key code
43 .SH SYNOPSIS
44 .nf
45 \fB#include <curses.h>
46 .PP
47 \fBint define_key(const char * \fIdefinition\fP, int \fIkey-code\fP);
48 .fi
49 .SH DESCRIPTION
50 The
51 .B \%define_key
52 .I \%ncurses
53 extension permits a
54 .I curses
55 application to
56 .I bind
57 a string
58 .I definition
59 to the function key
60 .I key-code
61 returned by \fB\%wgetch\fP(3NCURSES)
62 (wide-character API users:
63 \fB\%wget_wch\fP(3NCURSES))
64 when \fB\%keypad\fP(3NCURSES) is enabled in a window and a function key is
65 pressed.
66 .I \%ncurses
67 interprets such a binding as it does those in the
68 .I \%term\%info
69 database entry for the terminal type.
70 .PP
71 A
72 .I definition
73 of
74 .I NULL
75 removes any existing binding from
76 .IR key-code "."
77 Similarly,
78 a non-positive
79 .I key-code
80 removes an existing binding for
81 .IR definition ","
82 if any.
83 .SH RETURN VALUE
84 .B \%define_key
85 returns
86 .B ERR
87 if
88 .bP
89 .I definition
90 is
91 .I NULL
92 and
93 .I key-code
94 is nonpositive,
95 or
96 .bP
97 insufficient memory is available to bind
98 .I definition
99 to
100 .IR key-code "."
101 .PP
102 Otherwise,
103 .B \%define_key
104 returns
105 .BR OK "."
106 .SH EXTENSIONS
107 .B \%define_key
108 is an
109 .I \%ncurses
110 extension.
111 .SH PORTABILITY
112 Applications employing
113 .I \%ncurses
114 extensions should condition their use on the visibility of the
115 .B \%NCURSES_VERSION
116 preprocessor macro.
117 .PP
118 NetBSD
119 .I curses
120 since 2.0 (2004) supports
121 .IR \%define_key "."
122 .SH AUTHORS
123 Thomas Dickey
124 .SH SEE ALSO
125 \fB\%ncurses\fP(3NCURSES),
126 \fB\%keybound\fP(3NCURSES),
127 \fB\%keyok\fP(3NCURSES),
128 \fB\%key_defined\fP(3NCURSES),
129 \fB\%terminfo\fP(5)