Refactoring of edit_replace_cmd__conv_to_display() and edit_replace_cmd__conv_to_inpu...
[midnight-commander.git] / maint / ldiff
blob2b8d1a7090c2851b63d6f78c9e84ec7849aa633a
1 #! /bin/sh
3 # This script makes pretty looking patches provided that the old files
4 # are kept around with the .v0 suffix.
6 : ${backup_suffix=${1:-"\.v0"}}
7 backup_files=`find . -path "*$backup_suffix" -type f | sort -u`
8 for oldfile in $backup_files; do
9 newfile=`echo $oldfile | sed 's,^\./,,;s/'$backup_suffix'$//'`
10 oldlabel="$oldprefix$newfile"
11 newlabel="$newprefix$newfile"
12 find "$oldfile" ! -size 0 | grep . >/dev/null || \
13 { oldfile="/dev/null"; oldlabel="/dev/null"; }
14 find "$newfile" ! -size 0 | grep . >/dev/null || \
15 { newfile="/dev/null"; newlabel="/dev/null"; }
16 case $newfile in
17 *.c) dflags="-u -p" ;;
18 *.po) dflags='-U 1 -I^#[:,.~]';;
19 *) dflags="-u" ;;
20 esac
21 diff $dflags -L "$oldlabel" -L "$newlabel" "$oldfile" "$newfile"
22 done