2018-04-19 10:13:23 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: LGPL-2.1+
|
|
|
|
|
2018-06-07 13:07:14 +00:00
|
|
|
TOP=`git rev-parse --show-toplevel`
|
|
|
|
|
2018-04-19 10:13:23 +00:00
|
|
|
case "$1" in
|
|
|
|
|
|
|
|
recdiff)
|
|
|
|
if [ "$2" = "" ] ; then
|
2018-06-07 13:07:14 +00:00
|
|
|
DIR="$TOP"
|
2018-04-19 10:13:23 +00:00
|
|
|
else
|
|
|
|
DIR="$2"
|
|
|
|
fi
|
|
|
|
|
2018-05-22 14:07:18 +00:00
|
|
|
find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \;
|
2018-04-19 10:13:23 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
recpatch)
|
|
|
|
if [ "$2" = "" ] ; then
|
2018-06-07 13:07:14 +00:00
|
|
|
DIR="$TOP"
|
2018-04-19 10:13:23 +00:00
|
|
|
else
|
|
|
|
DIR="$2"
|
|
|
|
fi
|
|
|
|
|
2018-05-22 14:07:18 +00:00
|
|
|
find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \;
|
2018-04-19 10:13:23 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
diff)
|
|
|
|
T=`mktemp`
|
|
|
|
sed '/^$/N;/^\n$/D' < "$2" > "$T"
|
|
|
|
diff -u "$2" "$T"
|
|
|
|
rm -f "$T"
|
|
|
|
;;
|
|
|
|
|
|
|
|
patch)
|
|
|
|
sed -i '/^$/N;/^\n$/D' "$2"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Expected recdiff|recpatch|diff|patch as verb." >&2
|
|
|
|
;;
|
|
|
|
esac
|