aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test-progname.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-11 21:12:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-11 21:12:54 +0000
commitf9e640f1c0dc5d4fbffde207f2a4b0350d1a0019 (patch)
treeab150c9d46fcd3c701e8245e2f3d5ccbab0db7be /test-progname.c
parentede48977046b65029014a425213d622d938c74c4 (diff)
downloadmandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.tar.gz
mandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.tar.zst
mandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.zip
Finally use __progname, err(3) and warn(3).
That's more readable and less error-prone than fumbling around with argv[0], fprintf(3), strerror(3), perror(3), and exit(3). It's a bad idea to boycott good interfaces merely because standards committees ignore them. Instead, let's provide compatibility modules for archaic systems (like commercial Solaris) that still don't have them. The compat module has an UCB Copyright (c) 1993...
Diffstat (limited to 'test-progname.c')
-rw-r--r--test-progname.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test-progname.c b/test-progname.c
new file mode 100644
index 00000000..79add7eb
--- /dev/null
+++ b/test-progname.c
@@ -0,0 +1,9 @@
+#include <string.h>
+
+extern char *__progname;
+
+int
+main(void)
+{
+ return !!strcmp(__progname, "test-progname");
+}