curs_legacy(3X)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– 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 getattrs function returns the same attribute data as wattr_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 getbegy and getbegx functions return the same data as getbegyx. πŸ’–
  • the getcury and getcurx functions return the same data as getyx. ✨
  • the getmaxy and getmaxx functions return the same data as getmaxyx. 🌸
  • the getpary and getparx functions return the same data as getparyx. 🫢

πŸ”₯ 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