From 085080b32ed4aecd3b3a4ce08ac0c016a4b03879 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Thu, 13 Nov 2025 21:31:50 +0100 Subject: Small tweaks --- src/bin/main.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/bin/main.c b/src/bin/main.c index 5d5ea97..f411862 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -1,5 +1,7 @@ #include #include +#include +#include #include #if ENABLE_NLS @@ -9,6 +11,20 @@ #define _(S) S #endif +static void +version(void) +{ + printf(_(PACKAGE " version %s\n"), PACKAGE_VERSION); + exit(EXIT_SUCCESS); +} + +static void +usage(void) +{ + puts(_("There is no usage text yet.")); + exit(EXIT_SUCCESS); +} + int main(int argc, char *argv[]) { @@ -17,8 +33,18 @@ main(int argc, char *argv[]) aplwc_boot(); - if(argc != 1) - puts(_("No command line arguments expected")); + for(int i = 1; i < argc; i++){ + if(strcmp(argv[i], "--version") == 0) + version(); + else if(strcmp(argv[i], "--help") == 0) + usage(); + else + break; + } + if(argc > 1){ + printf(_("Unknown command-line argument: '%s'\n"), argv[1]); + exit(EXIT_FAILURE); + } aplwc_init_fns(&fns); aplwc = aplwc_init(&fns, NULL); -- cgit v1.2.3