blob: a66a368dd0c9c3e51884332fa14cb404938af23d [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2018-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2010,2015 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: menu_pattern.3x,v 1.38 2024/03/16 15:35:01 tom Exp $
31.TH menu_pattern 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053032.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040033\fBset_menu_pattern\fP,
34\fBmenu_pattern\fP \-
35set and get a menu's pattern buffer
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053036.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040037.nf
38\fB#include <menu.h>
39.PP
40\fBint set_menu_pattern(MENU *\fImenu\fP, const char *\fIpattern\fP);
41\fBchar *menu_pattern(const MENU *\fImenu\fP);
42.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053043.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040044Every menu has an associated pattern match buffer.
45As input events that are
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053046printable characters come in, they are appended to this match buffer
micky3879b9f5e72025-07-08 18:04:53 -040047and tested for a match, as described in \fBmenu_driver\fP(3X).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053048.PP
micky3879b9f5e72025-07-08 18:04:53 -040049The function \fBset_menu_pattern\fP sets the pattern buffer for the given menu
50and tries to find the first matching item.
51If it succeeds, that item becomes
52current; if not, the current item does not change.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053053.PP
micky3879b9f5e72025-07-08 18:04:53 -040054The function \fBmenu_pattern\fP returns the pattern buffer of the given
55\fImenu\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053056.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -040057The function \fBmenu_pattern\fP returns a pointer,
58which is \fBNULL\fP if the \fImenu\fP parameter is \fBNULL\fP.
59Otherwise, it is a pointer to a string which is empty
60if no pattern has been set.
61It does not set \fBerrno\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053062.PP
micky3879b9f5e72025-07-08 18:04:53 -040063The function \fBset_menu_pattern\fP may return the following error codes:
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053064.TP 5
65.B E_OK
66The routine succeeded.
67.TP 5
68.B E_BAD_ARGUMENT
69Routine detected an incorrect or out-of-range argument.
70.TP 5
71.B E_BAD_STATE
72Routine was called from an initialization or termination function.
73.TP 5
74.B E_NOT_CONNECTED
75No items are connected to menu.
76.TP 5
77.B E_NO_MATCH
78Character failed to match.
79.TP 5
80.B E_SYSTEM_ERROR
micky3879b9f5e72025-07-08 18:04:53 -040081System error occurred (see \fBerrno\fP(3)).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053082.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -040083These routines emulate the System V menu library.
84They were not supported on
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053085Version 7 or BSD versions.
86.SH AUTHORS
micky3879b9f5e72025-07-08 18:04:53 -040087Juergen Pfeifer.
88Manual pages and adaptation for new curses by Eric S. Raymond.
89.SH SEE ALSO
90\fB\%curses\fP(3X),
91\fB\%menu\fP(3X)