diff options
| -rw-r--r-- | src/Makefile | 4 | ||||
| -rw-r--r-- | src/opts.c | 3 | ||||
| -rw-r--r-- | src/unalf.1 | 11 | ||||
| -rw-r--r-- | src/unalf.c | 9 | ||||
| -rw-r--r-- | src/unalf.h | 5 | ||||
| -rw-r--r-- | src/unalf.rst | 9 | ||||
| -rw-r--r-- | src/usage.c | 1 |
7 files changed, 32 insertions, 10 deletions
diff --git a/src/Makefile b/src/Makefile index ebe884b..8499a49 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ # Makefile for unalf, by B. Watson. WTFPL. -# Tested with GNY make. +# Tested with GNU make. Does not work with BSD make, sorry. ### Override these variables as needed. Don't override CFLAGS; use # COPT instead. @@ -28,6 +28,8 @@ VERSION=0.1.0 CFLAGS=-DVERSION='"$(VERSION)"' -Wall -Wno-unused-label -I../f65 $(COPT) +.PHONY: all clean install + all: unalf unalf.1 alfsum alfsum.1 unalf: unalf.o io.o listalf.o extract.o ../f65/f65.o glob.o opts.o usage.o @@ -3,7 +3,7 @@ #include <stdlib.h> #include "unalf.h" -#define OPTIONS "aeklLopqtvd:x:" +#define OPTIONS "aeklLopqtvVd:x:" /* uncomment to test exclude/include glob lists */ // #define DEBUG_GLOBS @@ -43,6 +43,7 @@ void parse_opts(int argc, char * const *argv) { case 'q': opts.quiet++; break; case 't': opts.testonly++; opts.listonly = 0; break; case 'v': opts.listonly = 1; opts.testonly = 0; opts.verbose_list++; break; + case 'V': puts(VERSION); exit(0); break; case 'd': opts.outdir = optarg; break; case 'x': add_exclude(optarg); break; default: diff --git a/src/unalf.1 b/src/unalf.1 index c9e0d1c..9303f0b 100644 --- a/src/unalf.1 +++ b/src/unalf.1 @@ -101,8 +101,8 @@ Show built\-in help message. .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 -be stored as \(aq\fBFOO.\fP\(aq. By default, \fBunalf\fP removes the trailing -period; use \fB\-k\fP to keep it. +be stored as \(aq\fBFOO.\fP\(aq. On the Atari, the extracted file would be +named \fBFOO\fP, so \fBunalf\fP does the same by default. .UNINDENT .\" keep trailing periods (dots) in filenames. . @@ -176,6 +176,13 @@ default values of "8 Jan 82 12:24a". . .INDENT 0.0 .TP +.B \-V\fP,\fB \-\-version +Show \fBunalf\fP version number and exit. +.UNINDENT +.\" show version number. +. +.INDENT 0.0 +.TP .BI \-x \ wildcard Exclude (do not list or extract) files matching \fIwildcard\fP\&. See \fBWILDCARDS\fP below. This option can be given multiple times diff --git a/src/unalf.c b/src/unalf.c index af74af0..39685e7 100644 --- a/src/unalf.c +++ b/src/unalf.c @@ -7,10 +7,6 @@ #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; @@ -67,6 +63,11 @@ int main(int argc, char **argv) { if(argc < 2 || !strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) usage(); + if(!strcmp(argv[1], "--version")) { + puts(VERSION); + exit(0); + } + parse_opts(argc, argv); if(!(in_file = fopen(in_filename, "rb"))) { diff --git a/src/unalf.h b/src/unalf.h index 40a23d1..422183a 100644 --- a/src/unalf.h +++ b/src/unalf.h @@ -1,3 +1,8 @@ +#ifndef VERSION +#define VERSION "???" +#warning "VERSION not defined, defaulting to \"???\"" +#endif + #ifndef u8 #define u8 unsigned char #define u16 unsigned short diff --git a/src/unalf.rst b/src/unalf.rst index c3d175f..b829bf9 100644 --- a/src/unalf.rst +++ b/src/unalf.rst @@ -79,8 +79,8 @@ OPTIONS -k Keep trailing periods. In most (all?) ALF files, filenames that have no extension are stored with a trailing period, e.g. '**FOO**' would - be stored as '**FOO.**'. By default, **unalf** removes the trailing - period; use **-k** to keep it. + be stored as '**FOO.**'. On the Atari, the extracted file would be + named **FOO**, so **unalf** does the same by default. .. keep trailing periods (dots) in filenames. @@ -138,6 +138,11 @@ OPTIONS .. verbose listing of archive contents. +-V, --version + Show **unalf** version number and exit. + +.. show version number. + -x wildcard Exclude (do not list or extract) files matching *wildcard*. See **WILDCARDS** below. This option can be given multiple times diff --git a/src/usage.c b/src/usage.c index 6d0e617..554aa01 100644 --- a/src/usage.c +++ b/src/usage.c @@ -12,6 +12,7 @@ const char *usage_msg[] = { " -q: quiet: don't print filenames during extraction.", " -t: test archive.", " -v: verbose listing of archive contents.", + " -V, --version: show version number.", " -x wildcard: exclude <wildcard>. may be given multiple times.", (const char*)0 }; |
