aboutsummaryrefslogtreecommitdiff
path: root/src/unalf.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-14 06:27:22 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-14 06:27:22 -0500
commit0f4d0a93434aa7586c9f66c6a48707b561ebf00a (patch)
treeb27276f9b2534a7c4026968e36f21fbdacad7eec /src/unalf.c
parent3e2561662e065f9797f66f3c3663c8e271d1f272 (diff)
downloadunalf-0f4d0a93434aa7586c9f66c6a48707b561ebf00a.tar.gz
Generate usage message from comments in the .rst.
Diffstat (limited to 'src/unalf.c')
-rw-r--r--src/unalf.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/unalf.c b/src/unalf.c
index 9a722f8..d4b5aa0 100644
--- a/src/unalf.c
+++ b/src/unalf.c
@@ -7,6 +7,10 @@
#include <f65.h>
#include "unalf.h"
+#ifndef VERSION
+#define VERSION "0.0.0"
+#endif
+
FILE *in_file, *out_file;
char *in_filename, *self;
opts_t opts;
@@ -15,11 +19,6 @@ int exclude_count;
char * const *include_globs;
static void create_outdir(void);
-static void usage(void) {
- printf("usage: %s [-l] file.alf\n", self);
- exit(1);
-}
-
static void set_self(char *argv0) {
char *p;
@@ -48,6 +47,21 @@ static void create_outdir(void) {
}
}
+void usage(void) {
+ extern char *usage_msg[];
+ char **line;
+
+ puts("unalf (ALF extractor) v" VERSION " by B. Watson. WTFPL.");
+ printf("Usage: %s -[options] <file> [wildcard ...]\n", self);
+ puts("Options:");
+ puts(" wildcards: extract only matching files.");
+
+ for(line = usage_msg; *line; line++)
+ puts(*line);
+
+ exit(0);
+}
+
int main(int argc, char **argv) {
set_self(argv[0]);