Useful script for spatching
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 14 Jan 2015 22:33:07 +0000 (14:33 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 3 Feb 2015 15:12:27 +0000 (10:12 -0500)
Spatch gets cranky if you give it multiple files at a time.

scripts/spatch/spatch-me.sh [new file with mode: 0755]

diff --git a/scripts/spatch/spatch-me.sh b/scripts/spatch/spatch-me.sh
new file mode 100755 (executable)
index 0000000..48d22cd
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+# Helper to run spatch on multiple files
+
+if [ $# -lt 3 ]
+then
+       echo Usage: $0 cocci_file yes/no dir
+       exit -1
+fi
+
+COCCI=$1
+
+INPLACE=""
+
+if [ $2 = "yes" ]
+then
+       INPLACE="-in-place"
+fi
+
+DIR=$3
+
+
+FILES=`find $DIR -name '*.[ch]'`
+
+for i in $FILES
+do
+       spatch -sp-file $COCCI $i $INPLACE
+done