explain_realpath_or_die(3)
π explain_realpath_or_die β the libexplain glow-up π
okay bestie, so you know explain_realpath_or_die(3)? that's the manual page we're living in right now, section 3, from the Library Functions Manual. it's giving "canonical pathname, but make it loud when things go wrong." let's get into it β¨
πΈ NAME πΈ
explain_realpath_or_die β return canonical pathname and report errors
like. that's it. that's the whole vibe. you get your canonical pathname, and if anything goes sideways, it tells you about it. no silent suffering. we don't do that here π
β¨ SYNOPSIS β¨
#include <libexplain/realpath.h>
char *explain_realpath_or_die(const char *pathname, char
*resolved_pathname);
char *explain_realpath_on_error(const char *pathname, char
*resolved_pathname);
two functions, both icons, both included via <libexplain/realpath.h>. π«Ά
π¦ DESCRIPTION π¦
so explain_realpath_or_die is the function you call when you want to call the realpath(3) system call, but you want drama on failure. if it fails, an explanation gets printed to stderr β and that explanation comes from the explain_realpath(3) function β and then the whole process terminates by calling exit(EXIT_FAILURE). like, it does not come back. it's gone. it said what it said and it left the chat π
meanwhile explain_realpath_on_error is the chiller sibling. it also calls the realpath(3) system call, and on failure it also prints an explanation to stderr obtained from the explain_realpath(3) function β but then it still returns to the caller. so you get the tea, and you get to keep going. best of both worlds fr fr.
now the arguments, because we respect the parameters in this house:
pathnameβ the pathname, exactly as to be passed to therealpath(3)system call. no edits, no seasoning, exactly as-is. πresolved_pathnameβ the resolved_pathname, exactly as to be passed to therealpath(3)system call. same energy, same rule. π
π RETURN VALUE π
explain_realpath_or_dieonly returns on success β checkrealpath(3)for more info on what success even means here. on failure? it prints an explanation and exits. it does not return. periodt. πexplain_realpath_on_erroralways returns the value returned by the wrappedrealpath(3)system call. every time. no surprises. π
π EXAMPLE π
the explain_realpath_or_die function is intended to be used in a fashion similar to the following example:
char *result = explain_realpath_or_die(pathname, resolved_pathname);
that's the whole thing. short, sweet, canonically correct. ate. π₯
π§ SEE ALSO π§
realpath(3)β return the canonicalized absolute pathnameexplain_realpath(3)β explainrealpath(3)errorsexit(2)β terminate the calling process
iykyk, go read those next, they're all connected bestie πΈ
π COPYRIGHT π
this whole thing is libexplain version 1.4, and the copyright belongs to Copyright (C) 2011 Peter Miller. respect the author, always π
and that's the page!! tysm for reading, mwah π«Ά β signed, sealed, delivered, explain_realpath_or_die(3), Library Functions Manual, libexplain 1.4, 2011, Peter Miller's copyright, and this footer section is officially closed. slay π
β¨
π¦ 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) 2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms