unibi_run(3)

πŸ’– unibi_run β€” bestie edition πŸ’–

okay so this is unibi_run(3) from the unibilium manual, and we're gonna interpret a terminfo format string together, no cap. two functions, one page, let's go ✨


🌸 NAME 🌸

unibi_format, unibi_run β€” interpret a terminfo format string πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <unibilium.h>

void unibi_format(
    unibi_var_t var_dyn[26],
    unibi_var_t var_static[26],
    const char *fmt,
    unibi_var_t param[9],
    void (*out)(void *, const char *, size_t),
    void *ctx1,
    void (*pad)(void *, size_t, int, int),
    void *ctx2
);

size_t unibi_run(const char *fmt, unibi_var_t param[9], char *p, size_t n);

✨ DESCRIPTION ✨

so unibi_format takes a format string fmt and, like, executes it. it's giving main character energy fr. all of the output happens through (possibly repeated) calls to out. and in those calls to out, the first argument is always ctx1, the second argument is a pointer to a chunk of data, and the third argument is a count that says how big that chunk is, in bytes. 🫢

pad is what gets used when the format string has "$<...>" padding instructions in it. in the calls to pad, the first argument is always ctx2, the second argument is the delay in tenths of milliseconds, the third argument is a boolean flag saying whether "*" (that's the proportional delay) was specified in the format string, and the fourth argument is a boolean flag saying whether "/" (forced padding) was specified in the format string. so, like, a format string of "$<5/>" would translate into "pad(ctx2, 50, 0, 1)". iconic honestly. you may pass a null pointer for pad β€” and if you do, padding instructions get silently skipped. 🧚

the values of param are used for the format codes %p1 .. %p9; and the values of var_dyn and var_static are used for the so-called dynamic/static variables %Pa .. %Pz and %PA .. %PZ, respectively. πŸ’œ

unibi_run is a wrapper around unibi_format. it passes two arrays (each initialized to 26 zeroes) as var_dyn and var_static. fmt and param get passed on unchanged. it ignores padding, and it places all normal output in the buffer pointed to by p. n is the size of the buffer; at most n bytes will be written to p. ⭐


πŸ”₯ RETURN VALUE πŸ”₯

unibi_run returns the number of bytes that would have been written if the buffer was big enough. so the number of valid bytes in p after a call to unibi_run is the minimum of n and the return value of unibi_run. periodt. πŸ’…


πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole vibe, bestie πŸ’– this was unibilium-2.1.4, dated 2026-09-07, and yes she ate, no crumbs. go forth and interpret those format strings, you absolute legend πŸ‘‘πŸŒˆ

πŸ“¦ where this page comes from