aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-19 15:33:51 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-19 15:33:51 -0400
commitf6c5c4bab0f361d4b3447b89e203cb6a1b520590 (patch)
tree563002cab8c6ab40b749f0c5731fb9f6dbb7bcfb
parent714c27eb8eebece6a183bf7732a22b61777d0956 (diff)
downloadbw-atari8-tools-f6c5c4bab0f361d4b3447b89e203cb6a1b520590.tar.gz
a8diff: added.
-rw-r--r--Makefile10
-rwxr-xr-xa8diff56
-rw-r--r--a8diff.1115
-rw-r--r--a8diff.rst50
4 files changed, 226 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c202ad6..5a785a5 100644
--- a/Makefile
+++ b/Makefile
@@ -17,8 +17,8 @@ CFLAGS=-Wall $(COPT) -ansi -D_GNU_SOURCE -DVERSION=\"$(VERSION)\"
# BINS and SCRIPTS go in $BINDIR, DOCS go in $DOCDIR
BINS=a8eol atr2xfd atrsize axe blob2c blob2xex cart2xex cxrefbas dumpbas fenders protbas renumbas rom2cart unmac65 unprotbas vxrefbas xex1to2 xexamine xexcat xexsplit xfd2atr listbas a8cat a8xd whichbas
-SCRIPTS=dasm2atasm
-MANS=a8eol.1 xfd2atr.1 atr2xfd.1 blob2c.1 cart2xex.1 fenders.1 xexsplit.1 xexcat.1 atrsize.1 rom2cart.1 unmac65.1 axe.1 dasm2atasm.1 blob2xex.1 xexamine.1 xex1to2.1 unprotbas.1 protbas.1 renumbas.1 dumpbas.1 vxrefbas.1 cxrefbas.1 listbas.1 a8cat.1 a8xd.1 whichbas.1 diffbas.1
+SCRIPTS=dasm2atasm diffbas a8diff
+MANS=a8eol.1 xfd2atr.1 atr2xfd.1 blob2c.1 cart2xex.1 fenders.1 xexsplit.1 xexcat.1 atrsize.1 rom2cart.1 unmac65.1 axe.1 dasm2atasm.1 blob2xex.1 xexamine.1 xex1to2.1 unprotbas.1 protbas.1 renumbas.1 dumpbas.1 vxrefbas.1 cxrefbas.1 listbas.1 a8cat.1 a8xd.1 whichbas.1 diffbas.1 a8diff.1
MAN5S=xex.5
MAN7S=atascii.7
DOCS=README.txt equates.inc *.dasm LICENSE ksiders/atr.txt
@@ -233,9 +233,9 @@ install-subdirs: subdirs
user-symlinks: all
SRC=$$( pwd ) ; \
mkdir -p ~/bin ; \
- cd ~/bin ; \
- for i in $(BINS) \
+ cd ~/bin && \
+ for i in $(BINS) $(SCRIPTS) \
ksiders/atrdir ksiders/atrextr ksiders/makeatr ksiders/sortatr ksiders/unmakatr \
jindroush/chkrom/chkrom jindroush/chkbas/chkbas jindroush/bas2boot/bas2boot \
jindroush/chkexe/chkexe jindroush/adir/adir jindroush/acvt/acvt jindroush/aext/aext \
- ; do rm -f $$i; ln -s $$SRC/$$i . ; done
+ ; do rm -f $$i; ln -sf $$SRC/$$i . ; done
diff --git a/a8diff b/a8diff
new file mode 100755
index 0000000..38d4460
--- /dev/null
+++ b/a8diff
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+usage() {
+ cat <<EOF
+Usage: $( basename $0 ) [diff-opts] [-- a8cat-opts] file1 file2
+
+Diff two Atari ATASCII files, using a8cat(1) and diff(1).
+
+[diff-opts] is passed through as-is to diff.
+[a8cat-opts] is passed through as-is to a8cat.
+EOF
+ exit "$1"
+}
+
+cleanup() {
+ if [ "$dir" != "" ]; then
+ cd
+ rm -rf "$dir"
+ fi
+}
+
+if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "" ]; then
+ usage 0
+fi
+
+for i in "$@"; do
+ if [ -f "$i" ]; then
+ if [ "$file1" = "" ]; then
+ file1="$( realpath $i )"
+ base1="$( basename $i )".txt
+ elif [ "$file2" = "" ]; then
+ file2="$( realpath $i )"
+ base2="$( basename $i )".txt
+ else
+ usage 1
+ fi
+ elif [ "$i" = "--" ]; then
+ opts="a8catopts"
+ elif [ "$opts" = "a8catopts" ]; then
+ a8catopts="$a8catopts $i"
+ else
+ diffopts="$diffopts $i"
+ fi
+done
+
+dir="$( mktemp -d -t diffbas.XXXXXXXXXX )"
+[ -d "$dir" ]
+cd "$dir"
+trap cleanup EXIT
+set -e
+
+a8cat $a8catopts "$file1" > $base1
+a8cat $a8catopts "$file2" > $base2
+diff $diffopts $base1 $base2
+
+exit 0
diff --git a/a8diff.1 b/a8diff.1
new file mode 100644
index 0000000..c10013f
--- /dev/null
+++ b/a8diff.1
@@ -0,0 +1,115 @@
+.\" Man page generated from reStructuredText.
+.
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.TH "A8DIFF" 1 "2024-07-19" "0.2.1" "Urchlay's Atari 8-bit Tools"
+.SH NAME
+a8diff \- Show differences between two Atari 8-bit ATASCII text files
+.SH SYNOPSIS
+.sp
+a8diff [\fIdiff\-options\fP] [\fB\-\-\fP \fIa8cat\-options\fP] \fIfile1\fP \fIfile2\fP
+.SH DESCRIPTION
+.sp
+\fBa8diff\fP shows the differences between two ATASCII text files,
+using \fBa8cat\fP(1) and \fBdiff\fP(1).
+.SH OPTIONS
+.sp
+\fBa8diff\fP takes no options of its own. It will pass options as\-is
+to both \fBa8cat\fP and \fBdiff\fP\&. Use \fB\-\-\fP to separate them: everything
+before \fB\-\-\fP is passed to \fBdiff\fP, and everything between \fB\-\-\fP and
+the first filename is passed to \fBa8cat\fP\&.
+.SH EXAMPLE
+.sp
+A.LST and B.LST were both created by the \fBLIST\fP command in BASIC.
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+$ a8diff \-u A.LST B.LST
+
+\-\-\- A.LST.txt 2024\-07\-12 23:56:46.937965855 \-0400
++++ B.LST.txt 2024\-07\-12 23:56:46.938965854 \-0400
+@@ \-1,3 +1,4 @@
+ 10 ? "THIS LINE IS IN BOTH PROGRAMS."
+ 20 ? "THIS LINE IS ALSO IN BOTH."
++25 ? "THIS LINE ONLY IN B.LST!"
+ 30 END
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+0 for success. On failure, the exit status is that of whichever command
+failed (\fBa8diff\fP or \fBdiff\fP).
+.SH COPYRIGHT
+.sp
+WTFPL. See \fI\%http://www.wtfpl.net/txt/copying/\fP for details.
+.SH AUTHOR
+.INDENT 0.0
+.IP B. 3
+Watson <\fI\%urchlay@slackware.uk\fP>; Urchlay on irc.libera.chat \fI##atari\fP\&.
+.UNINDENT
+.SH SEE ALSO
+.sp
+\fBa8cat\fP(1),
+\fBa8eol\fP(1),
+\fBa8xd\fP(1),
+\fBatr2xfd\fP(1),
+\fBatrsize\fP(1),
+\fBaxe\fP(1),
+\fBblob2c\fP(1),
+\fBblob2xex\fP(1),
+\fBcart2xex\fP(1),
+\fBcxrefbas\fP(1),
+\fBdasm2atasm\fP(1),
+\fBdiffbas\fP(1),
+\fBdumpbas\fP(1),
+\fBf2toxex\fP(1),
+\fBfenders\fP(1),
+\fBlistbas\fP(1),
+\fBprotbas\fP(1),
+\fBrenumbas\fP(1),
+\fBrom2cart\fP(1),
+\fBunmac65\fP(1),
+\fBunprotbas\fP(1),
+\fBvxrefbas\fP(1),
+\fBwhichbas\fP(1),
+\fBxex1to2\fP(1),
+\fBxexamine\fP(1),
+\fBxexcat\fP(1),
+\fBxexsplit\fP(1),
+\fBxfd2atr\fP(1),
+\fBxex\fP(5),
+\fBatascii\fP(7).
+.sp
+Any good Atari 8\-bit book: \fIDe Re Atari\fP, \fIThe Atari BASIC Reference
+Manual\fP, the \fIOS Users\(aq Guide\fP, \fIMapping the Atari\fP, etc.
+.\" Generated by docutils manpage writer.
+.
diff --git a/a8diff.rst b/a8diff.rst
new file mode 100644
index 0000000..4273642
--- /dev/null
+++ b/a8diff.rst
@@ -0,0 +1,50 @@
+======
+a8diff
+======
+
+-----------------------------------------------------------
+Show differences between two Atari 8-bit ATASCII text files
+-----------------------------------------------------------
+
+.. include:: manhdr.rst
+
+SYNOPSIS
+========
+
+a8diff [*diff-options*] [**--** *a8cat-options*] *file1* *file2*
+
+DESCRIPTION
+===========
+**a8diff** shows the differences between two ATASCII text files,
+using **a8cat**\(1) and **diff**\(1).
+
+OPTIONS
+=======
+**a8diff** takes no options of its own. It will pass options as-is
+to both **a8cat** and **diff**. Use **--** to separate them: everything
+before **--** is passed to **diff**, and everything between **--** and
+the first filename is passed to **a8cat**.
+
+EXAMPLE
+=======
+
+A.LST and B.LST were both created by the **LIST** command in BASIC.
+
+::
+
+ $ a8diff -u A.LST B.LST
+
+ --- A.LST.txt 2024-07-12 23:56:46.937965855 -0400
+ +++ B.LST.txt 2024-07-12 23:56:46.938965854 -0400
+ @@ -1,3 +1,4 @@
+ 10 ? "THIS LINE IS IN BOTH PROGRAMS."
+ 20 ? "THIS LINE IS ALSO IN BOTH."
+ +25 ? "THIS LINE ONLY IN B.LST!"
+ 30 END
+
+EXIT STATUS
+===========
+0 for success. On failure, the exit status is that of whichever command
+failed (**a8diff** or **diff**).
+
+.. include:: manftr.rst