summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2025-11-13 21:31:50 +0100
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2025-11-13 21:31:50 +0100
commit085080b32ed4aecd3b3a4ce08ac0c016a4b03879 (patch)
treef0eaae3f695e386fa7b21040b344803fa738e52d /src
parent938e0bfac75302b5056223ffee919d650fdb56be (diff)
Small tweaksHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/bin/main.c30
1 files changed, 28 insertions, 2 deletions
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 <config.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <aplwc.h>
#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);