pattern(3MENU)
β¨ pattern β bestie, it's the menu pattern buffer era β¨
soooo this is pattern(3MENU), a lil' library-calls moment from your fave ncurses family. Two functions, one shared brain cell (the pattern buffer), and a whole lot of will it match or will it not energy. Let's get into it π
πΈ SYNOPSIS πΈ
#include <menu.h>
int set_menu_pattern(MENU *menu, const char *pattern);
char *menu_pattern(const MENU *menu);
okay so that's the whole vibe up top β one setter, one getter, both hanging out in <menu.h> like the iconic duo they are π«Ά
π DESCRIPTION π
Every single menu out here has an associated pattern match buffer, no exceptions. Think of it like the menu's little notes app π. As input events that are printable characters roll in, they get appended to this match buffer and then tested for a match β and the whole matching situation is described over in driver(3MENU) if you wanna go read the lore, bestie, it's giving lore.
set_menu_pattern sets the pattern buffer for the given menu and tries to find the first matching item. Two-for-one, we love efficiency β¨. So here's the tea:
- if it succeeds, that matched item becomes the current item β slay, the menu moved π
- if it fails, the current item does not change. Nothing happens. It simply sits there. Periodt.
menu_pattern is the chill one β it just returns the pattern buffer of the given menu. That's it. That's the function. π
β RETURN VALUE β
So menu_pattern returns a pointer, and here's the breakdown bestie, stay with me:
- it's
NULLif the menu parameter isNULLβ no menu, no pointer, tragic - otherwise it's a pointer to a string, and that string is empty if no pattern has been set yet
- and ngl, it does not set
errno. It's just not that kind of function π
Meanwhile set_menu_pattern is the one that can actually fail on you, and it may return these error codes:
E_OKβ the routine succeeded π₯³ slayE_BAD_ARGUMENTβ the routine detected an incorrect or out-of-range argument. Girl, what did you pass it πE_BAD_STATEβ the routine was called from an initialization or termination function. Wrong place, wrong time, read the room πE_NOT_CONNECTEDβ no items are connected to menu. An empty menu is not beating the lonely allegations πE_NO_MATCHβ the character failed to match. Close but no cigar, it's giving flop πE_SYSTEM_ERRORβ a system error occurred (seeerrno(3)). Not our fault, blame the system fr fr
π¦ PORTABILITY π¦
These routines emulate the System V menu library, so they're out here doing an impression of the classics π. They were not supported on Version 7 or BSD versions β so if you're on ancient BSD energy, this is not your moment, bestie, sorry not sorry.
π AUTHORS π
Juergen Pfeifer.</purl> Manual pages and adaptation for new curses by Eric S. Raymond. Legends, honestly, we stan π
π SEE ALSO π
ncurses(3NCURSES)menu(3MENU)
and that's the whole page, bestie β go forth and pattern-match, you've got this πβ¨
this lil' manual moment comes to you from ncurses 6.6, dated 2024-12-28 β xoxo, pattern(3MENU), signing off π
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2023,2024 Thomas E. Dickey
- Copyright 1998-2010,2015 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms