explain_program_name(3)

πŸ“¦
version 1.4.D001 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– explain_program_name(3) β€” Library Functions Manual πŸ’–

okay bestie, sit down, hydrate, and let me tell you about explain_program_name β€” it's the little trio of functions that mess with libexplain's whole idea of what your program is even called, and whether that name shows up in your error messages. lowkey iconic, highkey useful. ✨


πŸŽ€ NAME πŸŽ€

explain_program_name β€” manipulate the program name πŸ’…


🌸 SYNOPSIS 🌸

#include <libexplain/libexplain.h>
const char *explain_program_name_get(void);
void explain_program_name_set(const char *name);
void explain_program_name_assemble(int yesno);

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, these functions let you poke at libexplain's internal vibe check on the command name of the current process β€” and also decide whether that name gets included in error messages or not. three little functions, one big glow-up. πŸ’–

⭐ explain_program_name_get

const char *explain_program_name_get(void);

explain_program_name_get is your girl for grabbing the command name of the calling process. ngl, whether this actually gives you something sensible depends on how capable /proc is on your system β€” or, if that's not happening, how capable lsof(1) is on your system. on Linux? it works well. slay. ✨

Returns:

  • pointer to string containing the command name (no slashes) of the calling process.

πŸ’œ explain_program_name_set

void explain_program_name_set(const char *name);

explain_program_name_set lets you tell the libexplain libraries what you think the command name of the calling process is β€” it sets the string that explain_program_name_get(3) will hand back. this overrides the automatic behavior, which is genuinely super desirable for commands that can get invoked under more than one name, e.g. if they're a hard link synonym. main character energy: you decide who you are. πŸ‘‘

this also sets the option to include the program name in all of the error messages issued by the explain_*_or_die(3) functions.

  • name β€” the name of the calling process. only the basename will be used if a path containing slashes is given.

🌈 explain_program_name_assemble

void explain_program_name_assemble(int yesno);

explain_program_name_assemble is the control freak of the group β€” it decides whether or not the name of the calling process gets included in error messages issued by the explain_*_or_die(3) functions. if you don't set it explicitly, it's controlled by the EXPLAIN_OPTIONS environment variable, and if it's not set there either, it defaults to true.

  • yesno β€” non‐zero (true) to have program name included, zero (false) to have program name excluded.

libexplain version 1.4 Copyright (C) 2008 Peter Miller


🫢 AUTHOR 🫢

Written by Peter Miller <pmiller@opensource.org.au> πŸ’–


and that's the whole page, bestie β€” explain_program_name(3) from libexplain version 1.4, with that 2008 Peter Miller copyright, straight out of the Library Functions Manual. periodt. πŸ’…πŸŽ€βœ¨

πŸ“¦ where this page comes from