]> git.ipfire.org Git - thirdparty/systemd.git/blob - coccinelle/run-coccinelle.sh
coccinelle: add option to make changes in place
[thirdparty/systemd.git] / coccinelle / run-coccinelle.sh
1 #!/bin/bash -e
2
3 files="$(git ls-files ':/*.[ch]')"
4 args=
5
6 case "$1" in
7 -i)
8 args="$args --in-place"
9 shift
10 ;;
11 esac
12
13 for SCRIPT in ${@-coccinelle/*.cocci} ; do
14 echo "--x-- Processing $SCRIPT --x--"
15 TMPFILE=`mktemp`
16 echo "+ spatch --sp-file $SCRIPT $args ..."
17 spatch --sp-file $SCRIPT $args $files 2>"$TMPFILE" || cat "$TMPFILE"
18 rm "$TMPFILE"
19 echo -e "--x-- Processed $SCRIPT --x--\n"
20 done