curs_legacy(3X)
π NAME π
okay bestie, so this page is about the legacy squad of curses getters: getattrs, getbegx, getbegy, getcurx, getcury, getmaxx, getmaxy, getparx, and getpary β they pull cursor coords, window coords, or attributes out of a window. And yes, it's legacy, iykyk. This is from the curs_legacy(3X) library calls manual, no cap. π¦
β¨ SYNOPSIS β¨
#include <curses.h>
int getattrs(const WINDOW *win);
int getbegx(const WINDOW *win);
int getbegy(const WINDOW *win);
int getcurx(const WINDOW *win);
int getcury(const WINDOW *win);
int getmaxx(const WINDOW *win);
int getmaxy(const WINDOW *win);
int getparx(const WINDOW *win);
int getpary(const WINDOW *win);
π DESCRIPTION π
so these legacy functions are literally just simpler to use than the X/Open curses functions. it's giving "the easy button." π
- the
getattrsfunction returns the same attribute data aswattr_get.
but here's the tea: getattrs returns an integer (actually a chtype), while wattr_get returns the current color pair in a separate parameter. in the wide-character library configuration, color pairs may not fit into a chtype, so wattr_get is the only way to obtain the color information. like, it's the only one that can hold it, fr fr.
and because getattrs returns the attributes in a single parameter, it would not be possible for an application to distinguish that from ERR (a -1). π so if the window parameter is null, getattrs returns A_NORMAL (zero).
- the
getbegyandgetbegxfunctions return the same data asgetbegyx. π - the
getcuryandgetcurxfunctions return the same data asgetyx. β¨ - the
getmaxyandgetmaxxfunctions return the same data asgetmaxyx. πΈ - the
getparyandgetparxfunctions return the same data asgetparyx. π«Ά
π₯ RETURN VALUE π₯
except as noted up there β¬οΈ, these functions return an integer, or ERR if the window parameter is null. that's it, that's the whole vibe check.
π PORTABILITY π
these functions were supported on Version 7, BSD or System V implementations. iconic behavior honestly π
but none of those implementations checked the window parameter. like, not even a little. bestie, they were NOT doing the safety checks. π
the getattrs function and macro are defined to return a (signed) integer for compatibility with those implementations, although an unsigned type would have been more appropriate. ngl, an unsigned type would've been the main character here, but we keep it signed for the old-school compatibility. periodt.
π SEE ALSO π
curses(3X)curs_getyx(3X)curs_opaque(3X)
and that's the whole page, bestie!! π§ this was ncurses 6.6, dated 2025-02-15 β so when you see that footer, you know it's me. mwah π go check on your WINDOW * before you call any of these, ok? π
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- arch rolling: ncurses 6.6-2 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- Copyright 2019-2024,2025 Thomas E. Dickey
- Copyright 2007-2015,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms