Print this page
11972 resync smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/smatch_scripts/summarize_errs.sh
+++ new/usr/src/tools/smatch/src/smatch_scripts/summarize_errs.sh
1 1 #!/bin/bash
2 2
3 3 print_help()
4 4 {
5 5 echo "usage: $0 <warning file>"
6 6 exit 1;
7 7 }
8 8
9 9 set_title()
10 10 {
11 11 echo -ne "\033]0;$*\007"
12 12 echo ========================================
13 13 echo $*
14 14 echo ----------------------------------------
15 15 }
16 16
17 17 cmd_help()
18 18 {
19 19 echo "n - skips to next message"
20 20 echo "f - skips to next file"
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
21 21 echo "? - print this message again"
22 22 }
23 23
24 24 save_thoughts()
25 25 {
26 26 echo "************"
27 27 echo $sm_err
28 28 echo -n "What do you think?: "
29 29 read ans
30 30 if echo $ans | grep ^$ > /dev/null ; then
31 - continue
31 + return
32 32 fi
33 33
34 34 #store the result
35 35 echo $sm_err >> summary
36 36 echo $ans >> summary
37 37 echo ========== >> summary
38 38 }
39 39
40 40 if [ "$1" = "--new" ] ; then
41 41 shift
42 42 NEW=Y
43 43 fi
44 44
45 45 file=$1
46 46 if [ "$file" = "" ] ; then
47 47 if [ -e err-list ] ; then
48 48 file="err-list"
49 49 else
50 50 print_help
51 51 fi
52 52 fi
53 53
54 54 TXT=$(cat $file | uniq -f 2)
55 55
56 56 IFS='
57 57 '
58 58 for sm_err in $TXT ; do
59 59 file=$(echo $sm_err | cut -d ':' -f 1)
60 60 line=$(echo $sm_err | cut -d ' ' -f 1 | cut -d ':' -f 2)
61 61
62 62 if [ "$file" = "$skip_file" ] ; then
63 63 continue
64 64 fi
65 65 skip_file=""
66 66
67 67 last=$(echo $sm_err | cut -d ' ' -f 2-)
68 68 last=$(echo $last | sed -e 's/line .*//')
69 69
70 70 if [ "$NEW" = "Y" ] ; then
71 71 if grep -F "$last" *summary* > /dev/null ; then
72 72 echo "skipping $sm_err"
73 73 continue
74 74 fi
75 75 fi
76 76
77 77 set_title $sm_err
78 78
79 79 #grep -A1 "$file $line" *summary* 2> /dev/null
80 80 grep -A1 -F "$last" *summary* 2> /dev/null
81 81
82 82 ans="?"
83 83 while echo $ans | grep '?' > /dev/null ; do
84 84 echo -n "[? for help]: "
85 85 read ans
86 86 if echo $ans | grep n > /dev/null ; then
87 87 continue 2
88 88 fi
89 89 if echo $ans | grep f > /dev/null ; then
90 90 skip_file=$file
91 91 continue 2
92 92 fi
93 93 if echo $ans | grep '?' > /dev/null ; then
94 94 cmd_help
95 95 fi
96 96 done
97 97
98 98 # I have this in my .vimrc
99 99 # map <C-j> :! echo $sm_err<CR>
100 100 export sm_err
101 101
102 102 vim $file +${line}
103 103
104 104 save_thoughts
105 105 done
106 106 IFS=
↓ open down ↓ |
65 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX