#!/bin/bash scanner="Which-Asm" workdir="$1" src="$2" WHICHASM=whichasm count=0 if [ -d "$src" ] then find "$src" \( -name '*\.[cCsShH]' \ -o -name '*\.cc' \ -o -name '*\.cxx' \ -o -name '*\.cpp' \ \) -print > /tmp/$$ if [ -s /tmp/$$ ] then count=$(cat /tmp/$$ | ( count=0 read line while [ ! -z $line ] do res=$(${WHICHASM} $line) if [ "$(echo $res | grep ^error:)" ] || \ [ "$(echo $res | grep '.*: unknown')" ] then true else count+=1 fi read line done echo $count )) fi rm -f /tmp/$$ else count="-1" fi echo "${scanner}: $count"