diff options
| author | B. Watson <urchlay@slackware.uk> | 2024-07-19 15:33:51 -0400 | 
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2024-07-19 15:33:51 -0400 | 
| commit | f6c5c4bab0f361d4b3447b89e203cb6a1b520590 (patch) | |
| tree | 563002cab8c6ab40b749f0c5731fb9f6dbb7bcfb /a8diff | |
| parent | 714c27eb8eebece6a183bf7732a22b61777d0956 (diff) | |
| download | bw-atari8-tools-f6c5c4bab0f361d4b3447b89e203cb6a1b520590.tar.gz | |
a8diff: added.
Diffstat (limited to 'a8diff')
| -rwxr-xr-x | a8diff | 56 | 
1 files changed, 56 insertions, 0 deletions
| @@ -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 | 
