aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-14 19:31:03 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-14 19:31:03 -0500
commit269ce9c533b146b68371505a2c651043074e1c6b (patch)
treebd33f1538cf2d1b00f7f14a470ed75b361d1c886
parentc90c5405e83ab7e6ee8c5a264977052c3fa72840 (diff)
downloadunalf-269ce9c533b146b68371505a2c651043074e1c6b.tar.gz
Add -h/--help option.
-rw-r--r--src/unalf.19
-rw-r--r--src/unalf.c2
-rw-r--r--src/unalf.rst7
-rw-r--r--src/usage.c1
4 files changed, 16 insertions, 3 deletions
diff --git a/src/unalf.1 b/src/unalf.1
index d3ca220..c9e0d1c 100644
--- a/src/unalf.1
+++ b/src/unalf.1
@@ -36,7 +36,7 @@ unalf \- extract Atari 8-bit ALF archives
.
.SH SYNOPSIS
.sp
-unalf [\fB\-aetklLopqtv\fP] [\fB\-d\fP \fIdir\fP] [\fB\-x\fP \fIwildcard\fP] \fIalf\-file\fP [\fIwildcard\fP ...]
+unalf [\fB\-\-help\fP] [\fB\-aehtklLopqtv\fP] [\fB\-d\fP \fIdir\fP] [\fB\-x\fP \fIwildcard\fP] \fIalf\-file\fP [\fIwildcard\fP ...]
.SH DESCRIPTION
.sp
\fBunalf\fP lists or extracts the contents of an \fIALF\fP archive.
@@ -91,6 +91,13 @@ default action.
.
.INDENT 0.0
.TP
+.B \-h\fP,\fB \-\-help
+Show built\-in help message.
+.UNINDENT
+.\" show this help message.
+.
+.INDENT 0.0
+.TP
.B \-k
Keep trailing periods. In most (all?) ALF files, filenames that have no
extension are stored with a trailing period, e.g. \(aq\fBFOO\fP\(aq would
diff --git a/src/unalf.c b/src/unalf.c
index af21aa9..af74af0 100644
--- a/src/unalf.c
+++ b/src/unalf.c
@@ -65,7 +65,7 @@ void usage(void) {
int main(int argc, char **argv) {
set_self(argv[0]);
- if(argc < 2) usage();
+ if(argc < 2 || !strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) usage();
parse_opts(argc, argv);
diff --git a/src/unalf.rst b/src/unalf.rst
index e5d8dc7..c3d175f 100644
--- a/src/unalf.rst
+++ b/src/unalf.rst
@@ -21,7 +21,7 @@ extract Atari 8-bit ALF archives
SYNOPSIS
========
-unalf [**-aetklLopqtv**] [**-d** *dir*] [**-x** *wildcard*] *alf-file* [*wildcard* ...]
+unalf [**--help**] [**-aehtklLopqtv**] [**-d** *dir*] [**-x** *wildcard*] *alf-file* [*wildcard* ...]
DESCRIPTION
===========
@@ -71,6 +71,11 @@ OPTIONS
.. extract files (redundant; this is the default action).
+-h, --help
+ Show built-in help message.
+
+.. show this help message.
+
-k
Keep trailing periods. In most (all?) ALF files, filenames that have no
extension are stored with a trailing period, e.g. '**FOO**' would
diff --git a/src/usage.c b/src/usage.c
index d3d1e25..6d0e617 100644
--- a/src/usage.c
+++ b/src/usage.c
@@ -3,6 +3,7 @@ const char *usage_msg[] = {
" -aa: convert EOLs in ALL files.",
" -d output-dir: set output directory (created if needed).",
" -e: extract files (redundant; this is the default action).",
+ " -h, --help: show this help message.",
" -k: keep trailing periods (dots) in filenames.",
" -l: list files in archive (filenames only).",
" -L: use lowercase filenames.",