db: everyone must have libsqlite3 installed (not optional)
[smatch.git] / smatch_scripts / summarize_errs.sh
blob5b9a66eb5b5efdde33e4420013c4e927d29a4ff8
1 #!/bin/bash
3 print_help()
5 echo "usage: $0 <warning file>"
6 exit 1;
9 set_title()
11 echo -ne "\033]0;$*\007"
12 echo ========================================
13 echo $*
14 echo ----------------------------------------
17 cmd_help()
19 echo "n - skips to next message"
20 echo "f - skips to next file"
21 echo "? - print this message again"
24 save_thoughts()
26 echo "************"
27 echo $sm_err
28 echo -n "What do you think?: "
29 read ans
30 if echo $ans | grep ^$ > /dev/null ; then
31 continue
32 fi
34 #store the result
35 echo $sm_err >> summary
36 echo $ans >> summary
37 echo ========== >> summary
40 if [ "$1" = "--new" ] ; then
41 shift
42 NEW=Y
45 file=$1
46 if [ "$file" = "" ] ; then
47 if [ -e err-list ] ; then
48 file="err-list"
49 else
50 print_help
54 TXT=$(cat $file | uniq -f 2)
56 IFS='
58 for sm_err in $TXT ; do
59 file=$(echo $sm_err | cut -d ':' -f 1)
60 line=$(echo $sm_err | cut -d ' ' -f 1 | cut -d ':' -f 2)
62 if [ "$file" = "$skip_file" ] ; then
63 continue
65 skip_file=""
67 last=$(echo $sm_err | cut -d ' ' -f 2-)
68 last=$(echo $last | sed -e 's/line .*//')
70 if [ "$NEW" = "Y" ] ; then
71 if grep -F "$last" *summary* > /dev/null ; then
72 echo "skipping $sm_err"
73 continue
77 set_title $sm_err
79 #grep -A1 "$file $line" *summary* 2> /dev/null
80 grep -A1 -F "$last" *summary* 2> /dev/null
82 ans="?"
83 while echo $ans | grep '?' > /dev/null ; do
84 echo -n "[? for help]: "
85 read ans
86 if echo $ans | grep n > /dev/null ; then
87 continue 2
89 if echo $ans | grep f > /dev/null ; then
90 skip_file=$file
91 continue 2
93 if echo $ans | grep '?' > /dev/null ; then
94 cmd_help
96 done
98 # I have this in my .vimrc
99 # map <C-j> :! echo $sm_err<CR>
100 export sm_err
102 vim $file +${line}
104 save_thoughts
105 done
106 IFS=