aboutsummaryrefslogtreecommitdiff
path: root/lib/errors/mlib_setprogname.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/errors/mlib_setprogname.c')
-rw-r--r--lib/errors/mlib_setprogname.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/errors/mlib_setprogname.c b/lib/errors/mlib_setprogname.c
new file mode 100644
index 0000000..bfc77b0
--- /dev/null
+++ b/lib/errors/mlib_setprogname.c
@@ -0,0 +1,12 @@
+#include <string.h>
+
+#include "errors.h"
+
+const char *__mlib_errors_progname;
+
+void
+mlib_setprogname(const char *s)
+{
+ const char *p = strrchr(s, '/');
+ __mlib_errors_progname = p ? p + 1 : s;
+}