unibi_from_mem(3)
β¨ unibi_from_mem β the unibilium page, bestie edition β¨
okay so hi!! you're reading the manual for unibi_from_mem, which lives in unibilium (section 3, library calls, iykyk). it's a little function with a big job and honestly? she ate. let's get into it π«Ά
πΈ NAME πΈ
unibi_from_mem β construct a terminal object from a compiled terminfo entry π
like, you hand her some bytes in memory and she hands you back a whole terminal. main character energy fr.
π SYNOPSIS π
#include <unibilium.h>
unibi_term *unibi_from_mem(const char *p, size_t n);
that's it. that's the whole vibe. two args, one pointer back. periodt β¨
π¦ DESCRIPTION π¦
okay so here's the tea β
This function parses a compiled terminfo entry that starts at p and is n bytes long, and constructs a "unibi_term" object from it. When you're done with this object, you should call "unibi_destroy" to free it.
β οΈ bestie listen β that unibi_destroy call is not optional. she's not gonna clean up after herself, you gotta do it. no cap. π
"unibi_from_mem" parses both the traditional ncurses terminfo format (starting with the bytes "1A 01") and the newer "wide integer" format (starting with the bytes "1E 02").
so she sniffs those first two bytes and goes "oh I know her" and handles both formats. iconic. two formats, one function, zero drama. π
π RETURN VALUE π
A pointer to a new "unibi_term". In case of failure, "NULL" is returned and "errno" is set.
so like β happy path gives you a shiny unibi_term *, sad path gives you NULL and whispers the reason into errno. always check, babes. always check. π
π ERRORS π
EINVALβ The bytesppoints at don't look like a valid terminfo entry. (she looked at it and said "girl what is this" π)EFAULTβnis too small for a valid terminfo entry. (not enough bytes to even begin, like showing up with half a snack π)
π₯ SEE ALSO π₯
unibilium.h(3)unibi_dump(3)unibi_destroy(3)unibi_from_fp(3)unibi_from_fd(3)unibi_from_file(3)unibi_from_term(3)unibi_from_env(3)
the whole friend group honestly. go read them too, they're all slay π§
and that's the page!! this was unibilium-2.1.4, dated 2026-09-07, and it's giving unibi_from_mem(3) in the best possible way. go forth and parse responsibly, bestie πβ¨π
π¦ where this page comes from
- fedora 44: unibilium-devel 2.1.4-1.fc44 Β· LGPL-3.0-or-later
- fedora 44: unibilium-devel 2.1.4-1.fc44 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms