#!/bin/sh # This is what I use to make kernel patches and things like that. # It's very similar to the `gendiff' script distributed with # Red Hat's RPM, but you don't have to specify a directory (the # current one will do as default), and it's much faster. # # -- Jamie Lokier, April 1999 case "$#" in 2) ext="$2" dir="$1" ;; 1) ext="$1" dir="`pwd | sed -e 's:.*/::'`"; cd .. ;; *) echo "usage: $0 [] " 1>&2 exit 1 ;; esac # Quote $ext for use in regular expression. ext=`echo "x$ext"|sed -e 's/^x//; s/[\[\.\*\\\^\$]/\\\\&/g'` treescan -- "$dir" | sed -e "s/$ext//;t;d" | sort | while read f; do if ! test -e "$f"; then echo "diff -u $f$ext $f" diff -u "$f$ext" /dev/null elif ! cmp -s "$f$ext" "$f"; then echo "diff -u $f$ext $f" diff -u "$f$ext" "$f" fi done