diff options
| author | B. Watson <urchlay@slackware.uk> | 2025-11-27 16:24:22 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2025-11-27 16:24:22 -0500 |
| commit | b0892ba48c5eae7e8e0cca5f269d7b81e19b71ac (patch) | |
| tree | bf5b1047bc6fc1b9804a219a2159db77ab2418bd | |
| parent | a5e791a9a6c36dab74e10c648403b0538f7e6fb5 (diff) | |
| download | unalf-b0892ba48c5eae7e8e0cca5f269d7b81e19b71ac.tar.gz | |
Generate alf usage from rst.
| -rw-r--r-- | src/Makefile | 7 | ||||
| -rw-r--r-- | src/alf.1 | 8 | ||||
| -rw-r--r-- | src/alf.c | 9 | ||||
| -rw-r--r-- | src/alf.rst | 4 | ||||
| -rw-r--r-- | src/alfusage.c | 5 | ||||
| -rw-r--r-- | src/mkusage.pl | 1 | ||||
| -rw-r--r-- | src/unalf.1 | 4 | ||||
| -rw-r--r-- | src/unalf.rst | 2 |
8 files changed, 35 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile index 161376b..ed5f4d0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -41,7 +41,7 @@ CFLAGS=-DVERSION='"$(VERSION)"' -Wall -I../f65 $(COPT) UNALF_OBJS=unalf.o io.o listalf.o extract.o f65.o glob.o opts.o usage.o self.o asmcode.o ALFSUM_OBJS=alfsum.o self.o -ALF_OBJS=alf.o self.o +ALF_OBJS=alf.o self.o alfusage.o .PHONY: all clean install crosswin windows windows-upload realclean @@ -61,12 +61,17 @@ alf: $(ALF_OBJS) usage.o: usage.c +alfusage.o: usage.c + f65.o: ../f65/f65.c ../f65/f65.h $(CC) $(CFLAGS) -c -o f65.o ../f65/f65.c usage.c: mkusage.pl unalf.rst perl mkusage.pl unalf.rst > usage.c +alfusage.c: mkusage.pl unalf.rst + perl mkusage.pl alf.rst > alfusage.c + unalf.o: unalf.c unalf.h ../f65/f65.h glob.o: glob.c unalf.h @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "ALF" 1 "2025-11-26" "0.2.0" "Urchlay's Atari 8-bit Tools" +.TH "ALF" 1 "2025-11-27" "0.2.0" "Urchlay's Atari 8-bit Tools" .SH NAME alf \- create Atari 8-bit ALF archives .\" RST source for alf(1) man page. Convert with: @@ -64,10 +64,16 @@ Append to \fIalf\-file\fP\&. The files are added to the end of the archive. Be careful not to add a file with the same name as as existing member of the archive. If \fIalf\-file\fP doesn\(aqt exist, it will be created. No backup is made with \fB\-a\fP\&. +.UNINDENT +.\" append to alf file. +. +.INDENT 0.0 .TP .B \-o Overwrite \fIalf\-file\fP if it exists; do not make a \fB~\fP backup. .UNINDENT +.\" overwrite alf file if exists (do not create file~ backup). +. .SH EXIT STATUS .INDENT 0.0 .TP @@ -335,11 +335,16 @@ void crunch_file(const char *filename) { } void usage(void) { + extern char *usage_msg[]; + char **line; + puts("alf (ALF compressor) v" VERSION " by B. Watson, WTFPL."); printf("Usage: %s [-a|-o] archive.alf file [file ...]\n", self); puts("Options:"); - puts(" -a: append to archive"); - puts(" -o: overwrite archive (don't make backup with ~)"); + + for(line = usage_msg; *line; line++) + puts(*line); + exit(0); } diff --git a/src/alf.rst b/src/alf.rst index 08af9c2..898efb3 100644 --- a/src/alf.rst +++ b/src/alf.rst @@ -53,9 +53,13 @@ OPTIONS the archive. If *alf-file* doesn't exist, it will be created. No backup is made with **-a**. +.. append to alf file. + -o Overwrite *alf-file* if it exists; do not make a **~** backup. +.. overwrite alf file if exists (do not create file~ backup). + EXIT STATUS =========== diff --git a/src/alfusage.c b/src/alfusage.c new file mode 100644 index 0000000..c8f973d --- /dev/null +++ b/src/alfusage.c @@ -0,0 +1,5 @@ +const char *usage_msg[] = { + " -a: append to alf file.", + " -o: overwrite alf file if exists (do not create file~ backup).", + (const char*)0 +}; diff --git a/src/mkusage.pl b/src/mkusage.pl index d8a5c77..e2274c2 100644 --- a/src/mkusage.pl +++ b/src/mkusage.pl @@ -5,6 +5,7 @@ print "const char *usage_msg[] = {\n"; while(<>) { chomp; next if /^---/; + last if /^\.\. ENFOPTS/; if(/^-[-a-zA-Z\d]/) { $opt = $_; next; diff --git a/src/unalf.1 b/src/unalf.1 index 1708a4b..396a5f6 100644 --- a/src/unalf.1 +++ b/src/unalf.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "UNALF" 1 "2025-11-26" "0.2.0" "Urchlay's Atari 8-bit Tools" +.TH "UNALF" 1 "2025-11-27" "0.2.0" "Urchlay's Atari 8-bit Tools" .SH NAME unalf \- extract Atari 8-bit ALF archives .\" RST source for unalf(1) man page. Convert with: @@ -208,6 +208,8 @@ to exclude multiple patterns. .UNINDENT .\" exclude <wildcard>. may be given multiple times. . +.\" ENDOPTS +. .SH WILDCARDS .sp Wildcard (aka glob) matching works like it does on the Atari: \fI*.*\fP diff --git a/src/unalf.rst b/src/unalf.rst index bee3046..24774e6 100644 --- a/src/unalf.rst +++ b/src/unalf.rst @@ -168,6 +168,8 @@ OPTIONS .. exclude <wildcard>. may be given multiple times. +.. ENDOPTS + WILDCARDS ========= |
