EXPLAIN_VASPRINTF_OR_DIE(3)
π explain_vasprintf_or_die(3) π
okay bestie, so this one lives in the Library Functions Manual and it's literally called explain_vasprintf_or_die β yes the name is dramatic, no we are not changing it π«Ά
β¨ NAME β¨
explain_vasprintf_or_die β print to allocated string and report errors π
πΈ SYNOPSIS πΈ
#include <libexplain/vasprintf.h>
int explain_vasprintf_or_die(char **data, const char *format, va_list
ap);
int explain_vasprintf_on_error(char **data, const char *format, va_list
ap);
π¦ DESCRIPTION π¦
so there's two of them and they're siblings, not twins, okay? let's get into it π
The explain_vasprintf_or_die function is used to call the vasprintf(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_vasprintf(3) function, and then the process terminates by calling exit(EXIT_FAILURE). so like. it dies. on brand, honestly π
The explain_vasprintf_on_error function is used to call the vasprintf(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_vasprintf(3) function, but still returns to the caller. it's giving "I'll tell you what went wrong but I'm not gonna end you over it" β¨
dataβ the data, exactly as to be passed to thevasprintf(3)system call. yes, exactly. don't get cute with it πformatβ the format, exactly as to be passed to thevasprintf(3)system call. same energy, same rule πapβ the ap, exactly as to be passed to thevasprintf(3)system call. all three of them? passed through untouched. iconic behavior, no notes π
π RETURN VALUE π
The explain_vasprintf_or_die function only returns on success, see vasprintf(3) for more information. On failure, prints an explanation and exits, it does not return. like. it's not coming back. periodt π
The explain_vasprintf_on_error function always returns the value return by the wrapped vasprintf(3) system call. always. every time. no cap π«Ά
π EXAMPLE π
The explain_vasprintf_or_die function is intended to be used in a fashion similar to the following example:
int result = explain_vasprintf_or_die(data, format, ap);
that's it. that's the whole vibe. copy it, love it, ship it π
π SEE ALSO π
vasprintf(3)β print to allocated stringexplain_vasprintf(3)β explainvasprintf(3)errorsexit(2)β terminate the calling process
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2013 Peter Miller
and that's the whole page bestie!! π¦β¨ this was libexplain version 1.4, copyright vibes belonging to Peter Miller in 2013, and we are obsessed. go forth and vasprintf responsibly, mwah ππ
πΈ
π¦ where this page comes from
- debian bookworm: libexplain-dev 1.4.D001-12+b1 Β· LGPL-3.0-or-later
- debian trixie: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- ubuntu jammy: libexplain-dev 1.4.D001-12 Β· LGPL-3.0-or-later
- ubuntu noble: libexplain-dev 1.4.D001-13 Β· LGPL-3.0-or-later
- ubuntu resolute: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- Copyright (C) 2013 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms