macro_table.c: replacement for in_macro()
[smatch.git] / smatch_scripts / show_ifs.sh
blob242c353dea9b6bc8c10f3f133ea0cff10f42435d
1 #!/bin/bash
3 context=1
4 if [ "$1" = "-C" ] ; then
5 shift
6 context=$1
7 shift
8 fi
10 file=$1
11 if [[ "$file" = "" ]] ; then
12 echo "Usage: $0 [-C <lines of context>] <file with smatch messages>"
13 exit 1
16 grep 'if();' $file | cut -d ' ' -f1,2 | while read code_file line ; do
17 echo "========================================================="
18 echo $code_file $line
19 tail -n +$(($line - ($context - 1))) $code_file | head -n $(($context - 1))
20 if [[ $context -gt 1 ]] ; then
21 echo "---------------------------------------------------------"
23 tail -n $line $code_file | head -n $context
24 done