aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-12-23 19:52:23 +1300
committerTom Ryder <tom@sanctum.geek.nz>2021-09-20 16:05:31 +1200
commite12dc008646e3991a6ceeecd8f5e0f61179b9925 (patch)
tree0362965b2bf0b417c5e92b8b1c927fc335ccfb9a
parentRefactor for legibility (diff)
downloadwtf8-e12dc008646e3991a6ceeecd8f5e0f61179b9925.tar.gz
wtf8-e12dc008646e3991a6ceeecd8f5e0f61179b9925.zip
Add help message for improper usage
-rw-r--r--wtf8.c4
-rw-r--r--wtf8.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/wtf8.c b/wtf8.c
index ea8950a..1b99d63 100644
--- a/wtf8.c
+++ b/wtf8.c
@@ -92,8 +92,10 @@ int main(int argc, char **argv) {
/*
* Check we have one and only one argument
*/
- if (argc != 2)
+ if (argc != 2) {
+ fprintf(stderr, "%s: Need one argument\n", PROGRAM_NAME);
exit(EXIT_FAILURE);
+ }
/*
* Print the sole argument first as hex octets, then as characters, spaced
diff --git a/wtf8.h b/wtf8.h
index e8a40f4..f02e31b 100644
--- a/wtf8.h
+++ b/wtf8.h
@@ -2,6 +2,8 @@
#include <stdio.h>
#include <stdlib.h>
+#define PROGRAM_NAME "wtf8"
+
#define BYTE_SEP '-'
#define CHAR_SEP ' '