| 1 |
.\"*************************************************************************** |
| 2 |
.\" Copyright 2018-2023,2024 Thomas E. Dickey * |
| 3 |
.\" Copyright 1999-2008,2010 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 1999 |
| 31 |
.\" |
| 32 |
.\" $Id: keybound.3x,v 1.42 2024/12/28 21:26:21 tom Exp $ |
| 33 |
.TH keybound 3NCURSES 2024-12-28 "ncurses 6.6" "Library calls" |
| 34 |
.SH NAME |
| 35 |
\fB\%keybound\fP \- |
| 36 |
get definition of a \fIcurses\fP function key code |
| 37 |
.SH SYNOPSIS |
| 38 |
.nf |
| 39 |
\fB#include <curses.h> |
| 40 |
.PP |
| 41 |
\fBchar * keybound(int \fIkey-code\fP, int \fIcount\fP); |
| 42 |
.fi |
| 43 |
.SH DESCRIPTION |
| 44 |
The |
| 45 |
.B \%keybound |
| 46 |
.I \%ncurses |
| 47 |
extension permits a |
| 48 |
.I curses |
| 49 |
application to obtain the value of the string |
| 50 |
.I bound |
| 51 |
to the function key |
| 52 |
.IR key-code ";" |
| 53 |
see \fB\%wgetch\fP(3NCURSES) |
| 54 |
(wide-character API users: \fB\%wget_wch\fP(3NCURSES)). |
| 55 |
By default, |
| 56 |
such bindings are string capabilities from the |
| 57 |
.I \%term\%info |
| 58 |
database entry corresponding to the terminal type. |
| 59 |
The application can non-destructively and repeatedly |
| 60 |
override such definitions with |
| 61 |
\fB\%define_key\fP(3NCURSES), |
| 62 |
as if by pushing new definitions onto a stack. |
| 63 |
The |
| 64 |
.I count |
| 65 |
parameter accesses the |
| 66 |
.IR n th |
| 67 |
most recently defined binding; |
| 68 |
.B 0 |
| 69 |
selects the binding that is used on input. |
| 70 |
.SH RETURN VALUE |
| 71 |
If |
| 72 |
.I key-code |
| 73 |
corresponds to a function key defined |
| 74 |
by the application |
| 75 |
or the terminal type in use, |
| 76 |
.B \%keybound |
| 77 |
allocates and returns a string |
| 78 |
that must be freed by the application. |
| 79 |
.B \%keybound |
| 80 |
returns |
| 81 |
.I NULL |
| 82 |
if |
| 83 |
.I key-code |
| 84 |
is not positive |
| 85 |
or if it does not correspond to a key code definition. |
| 86 |
.SH EXTENSIONS |
| 87 |
.B \%keybound |
| 88 |
is an |
| 89 |
.I \%ncurses |
| 90 |
extension. |
| 91 |
.SH PORTABILITY |
| 92 |
Applications employing |
| 93 |
.I \%ncurses |
| 94 |
extensions should condition their use on the visibility of the |
| 95 |
.B \%NCURSES_VERSION |
| 96 |
preprocessor macro. |
| 97 |
.SH AUTHORS |
| 98 |
Thomas Dickey |
| 99 |
.SH SEE ALSO |
| 100 |
\fB\%ncurses\fP(3NCURSES), |
| 101 |
\fB\%define_key\fP(3NCURSES), |
| 102 |
\fB\%keyok\fP(3NCURSES), |
| 103 |
\fB\%key_defined\fP(3NCURSES), |
| 104 |
\fB\%terminfo\fP(5) |