bit_shift: add test_bit() function
[smatch.git] / smatch_scripts / show_errs.sh
blob18fc7937668abf6eeb3bcca5cd6c62d12b375dd5
1 #!/bin/bash
3 context=6
4 while true ; do
5 if [ "$1" = "-C" ] ; then
6 shift
7 context=$1
8 shift
9 continue
11 break
12 done
15 file=$1
16 [ "$file" = "" ] && [ -e err-list ] && file=err-list
17 if [[ "$file" = "" ]] ; then
18 echo "Usage: $0 [-C <lines>] [-b] [-k] <file with smatch messages>"
19 echo " -C <lines>: Print <lines> of context"
20 exit 1
23 cat $file | while read line ; do
24 code_file=$(echo $line | cut -d ':' -f 1)
25 lineno=$(echo $line | cut -d ' ' -f 1 | cut -d ':' -f 2)
26 echo "========================================================="
27 echo $line
28 echo "---"
29 tail -n +$(($lineno - ($context - 1))) $code_file | head -n $(($context - 1))
30 echo "---------------------------------------------------------"
31 tail -n +${lineno} $code_file | head -n $context
32 done