#!/bin/sh suffix=".borig" oldsuffix="" suffix_changed=yes seen_dash_dash=no rejectmode=no while test "$#" -ge 1; do path="$1" if test $seen_dash_dash = no; then case "$1" in -j) shift oldsuffix="$suffix" rejectmode=yes suffix=".rej" suffix_changed=yes continue ;; -z) shift suffix="$1" shift suffix_changed=yes continue ;; --) shift seen_dash_dash=yes; continue ;; -*) echo "Warning: $1 is an evil name and will appear as ./$1" >&2 path="./$path" ;; esac fi if test "$suffix_changed" = yes; then suffix_shell=`echo "x$suffix" |sed 's/^x//;s,\([][<>()|&;'\\\`' ]\),\\\1,g;s/'\''/'\''\\'\'\''/g'` oldsuffix_shell=`echo "x$oldsuffix" |sed 's/^x//;s,\([][<>()|&;'\\\`' ]\),\\\1,g;s/'\''/'\''\\'\'\''/g'` suffix_find=`echo "x$suffix" |sed 's/^x//;s,\([?*'\"']\),\\1,g;'` suffix_sed=`echo "x$suffix" |sed 's/^x//;s,\([|.*'\"']\),\\1,g;'` suffix_changed=no fi find "$1" -name "*$suffix" |sed "s|$suffix_sed\$||" |while read f; do if test -f "$f"; then nf="$f" else nf="/dev/null" fi if test "$rejectmode" = yes; then echo "Index: $f" echo "diff -u -p -- $f$oldsuffix_shell $f" cat "$f$suffix" else if cmp -s -- "$f$suffix" "$nf"; then continue fi echo "Index: $f" echo "diff -u -p -- $f$suffix_shell $f" if test -r "$f$suffix"; then orig="$f$suffix" else orig="/dev/null" fi diff -u -p --label "$f" -- "$orig" "$nf" fi done if test "$rejectmode" = yes; then rejectmode=no suffix="$oldsuffix" fi shift done