summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);