5 char *program_invocation_name = NULL;
6 char *program_invocation_short_name = NULL;
9 #include "musl_missing.h"
11 static void elogind_free_program_name(void) {
13 if (program_invocation_name)
14 program_invocation_name = mfree(program_invocation_name);
15 if (program_invocation_short_name)
16 program_invocation_short_name = mfree(program_invocation_short_name);
20 void elogind_set_program_name(const char* pcall) {
21 assert(pcall && pcall[0]);
22 elogind_free_program_name();
24 program_invocation_name = strdup(pcall);
25 program_invocation_short_name = strdup(basename(pcall));
26 atexit(elogind_free_program_name);