2017-11-29 18:49:05 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2018-06-07 13:07:14 +00:00
|
|
|
top="$(git rev-parse --show-toplevel)"
|
2018-04-20 13:07:42 +00:00
|
|
|
files="$(git ls-files ':/*.[ch]')"
|
2018-04-20 13:21:06 +00:00
|
|
|
args=
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
-i)
|
|
|
|
args="$args --in-place"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
2018-04-20 13:07:42 +00:00
|
|
|
|
2018-06-07 13:07:14 +00:00
|
|
|
for SCRIPT in ${@-$top/coccinelle/*.cocci} ; do
|
2018-03-23 14:44:10 +00:00
|
|
|
echo "--x-- Processing $SCRIPT --x--"
|
2017-11-29 18:49:05 +00:00
|
|
|
TMPFILE=`mktemp`
|
2018-04-20 13:21:06 +00:00
|
|
|
echo "+ spatch --sp-file $SCRIPT $args ..."
|
|
|
|
spatch --sp-file $SCRIPT $args $files 2>"$TMPFILE" || cat "$TMPFILE"
|
2017-11-29 18:49:05 +00:00
|
|
|
rm "$TMPFILE"
|
2018-03-23 14:44:10 +00:00
|
|
|
echo -e "--x-- Processed $SCRIPT --x--\n"
|
2017-11-29 18:49:05 +00:00
|
|
|
done
|