| 1 | #! /bin/sh |
| 2 | |
| 3 | #================================================================ |
| 4 | # diffcheck |
| 5 | # List files different from ones of another version |
| 6 | #================================================================ |
| 7 | |
| 8 | |
| 9 | # set variables |
| 10 | progexts='\.in|\.h|\.c|\.cc|\.cpp|\.cxx|\.java|\.pl|\.pm|\.pod|\.rb|\.rd' |
| 11 | docexts='\.[1-9]|spex\.html|\spex-ja\.html|\.txt' |
| 12 | regex="($progexts|$docexts)\$" |
| 13 | |
| 14 | |
| 15 | # check arguments |
| 16 | if [ $# != 1 ] |
| 17 | then |
| 18 | printf 'diffcheck: usage: diffcheck directory_of_oldversion\n' 1>&2 |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | |
| 23 | # diff files |
| 24 | find . -type f | egrep $regex | |
| 25 | while read file |
| 26 | do |
| 27 | old=`printf '%s\n' "$file" | sed 's/^\.\///'` |
| 28 | printf 'Checking %s and %s ... ' "$file" "$1/$old" |
| 29 | res=`diff -q "$file" "$1/$old"` |
| 30 | if [ -z "$res" ] |
| 31 | then |
| 32 | printf 'same\n' |
| 33 | else |
| 34 | printf '### !!! DIFFERENT !!! ###\n' |
| 35 | fi |
| 36 | done |
| 37 | |
| 38 | |
| 39 | # exit normally |
| 40 | exit 0 |
| 41 | |
| 42 | |
| 43 | |
| 44 | # END OF FILE |