menu_pattern(3X)
β¨ menu_pattern(3X) β set & get a menu's pattern buffer β¨
okay bestie so this one is from the menu_pattern(3X) corner of the library calls universe, and it's genuinely so much less scary than it sounds, i promise π«Ά
πΈ NAME πΈ
set_menu_pattern, menu_pattern β literally just setting and getting a menu's pattern buffer, that's the whole vibe π
π¦ SYNOPSIS π¦
#include <menu.h>
int set_menu_pattern(MENU *menu, const char *pattern);
char *menu_pattern(const MENU *menu);
π DESCRIPTION π
okay so first things first: every single menu has its own little pattern match buffer. it's like the menu's personal search bar, no cap. and the way it works is β as input events that are printable characters come in, they get appended to this match buffer and tested for a match, exactly as described in menu_driver(3X). so it's doing the searching for you in real time, iconic behavior honestly β¨
The function set_menu_pattern sets the pattern buffer for the given menu and then tries to find the first matching item. If it succeeds, that item becomes current β slay, main character energy π. If it does not succeed, the current item just... doesn't change. no drama, no moving, periodt.
The function menu_pattern returns the pattern buffer of the given menu. that's it, that's the whole job π
π§ RETURN VALUE π§
The function menu_pattern returns a pointer. It's NULL if the menu parameter is NULL. Otherwise it's a pointer to a string, and that string is empty if no pattern has been set. Also important: it does not set errno. noted π
The function set_menu_pattern may return the following error codes:
E_OKβ the routine succeeded, we love a win πE_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument πE_BAD_STATEβ routine was called from an initialization or termination function, like bestie read the room πE_NOT_CONNECTEDβ no items are connected to menuE_NO_MATCHβ character failed to match πE_SYSTEM_ERRORβ system error occurred (seeerrno(3))
β PORTABILITY β
These routines emulate the System V menu library. They were not supported on Version 7 or BSD versions β so if you're on those, this is not the vibe, it's giving old-school β¨
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. legends, honestly π«Ά
π SEE ALSO π
curses(3X), menu(3X)
and that's the page, bestie!! π¦ this was ncurses version 6.5, dated 2024-12-28 β so go forth and pattern-match your menus, you absolute icon, i'm obsessed ππΈπ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright 2018-2023,2024 Thomas E. Dickey
- Copyright 1998-2010,2015 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms