mc/maint/ldiff

23 lines
773 B
Plaintext
Raw Normal View History

#! /bin/sh
2002-09-07 05:00:52 +04:00
# This script makes pretty looking patches provided that the old files
# are kept around with the .v0 suffix.
: ${backup_suffix=${1:-"\.v0"}}
backup_files=`find . -path "*$backup_suffix" -type f | sort -u`
2002-09-07 05:00:52 +04:00
for oldfile in $backup_files; do
2002-09-17 19:24:06 +04:00
newfile=`echo $oldfile | sed 's,^\./,,;s/'$backup_suffix'$//'`
2002-09-07 05:00:52 +04:00
oldlabel="$oldprefix$newfile"
newlabel="$newprefix$newfile"
find "$oldfile" ! -size 0 | grep . >/dev/null || \
{ oldfile="/dev/null"; oldlabel="/dev/null"; }
find "$newfile" ! -size 0 | grep . >/dev/null || \
{ newfile="/dev/null"; newlabel="/dev/null"; }
case $newfile in
*.c) dflags="-u -p" ;;
*.po) dflags='-U 1 -I^#[:,.~]';;
2002-09-07 05:00:52 +04:00
*) dflags="-u" ;;
esac
diff $dflags -L "$oldlabel" -L "$newlabel" "$oldfile" "$newfile"
done