~ubuntu-branches/ubuntu/vivid/mutt/vivid-updates

« back to all changes in this revision

Viewing changes to hcachever.sh.in

Tags: 1.5.18-6
* Grab from upstream:
  + Guard idata->mailbox read in imap_mailbox_state.
    The bug happens when a user has more than a imap mailbox, when
    he/she browses through them mutt will segfault.
    (Closes: #462266, #513230, #514309. Mutt: #3057)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
BASEVERSION=2
 
4
 
 
5
MD5=@MD5@
 
6
if test "$MD5" = "openssl"
 
7
then
 
8
  MD5="openssl md5 -hex"
 
9
elif test "$MD5" = "none"
 
10
then
 
11
  echo "ERROR: no MD5 tool found"
 
12
  exit 1
 
13
fi
 
14
 
 
15
cleanstruct () {
 
16
  echo "$1" | sed -e 's/} *//' -e 's/;$//'
 
17
}
 
18
 
 
19
cleanbody () {
 
20
  echo "$1" | sed -e 's/{ *//'
 
21
}
 
22
 
 
23
getstruct () {
 
24
  STRUCT=""
 
25
  BODY=''
 
26
  inbody=0
 
27
  case "$1" in
 
28
    *'{') inbody=1 ;;
 
29
    *';') return ;;
 
30
  esac
 
31
 
 
32
  while read line
 
33
  do
 
34
    if test $inbody -eq 0
 
35
    then
 
36
      case "$line" in
 
37
        '{'*) inbody=1 ;;
 
38
        *';') return ;;
 
39
      esac
 
40
    fi
 
41
 
 
42
    case "$line" in
 
43
      '} '*)
 
44
        STRUCT=`cleanstruct "$line"`
 
45
        break
 
46
      ;;
 
47
      '}')
 
48
        read line
 
49
        STRUCT=`cleanstruct "$line"`
 
50
        break
 
51
      ;;
 
52
      '#'*) continue ;;
 
53
      *)
 
54
        if test $inbody -ne 0
 
55
        then
 
56
          BODY="$BODY $line"
 
57
        fi
 
58
      ;;
 
59
    esac
 
60
  done
 
61
 
 
62
  case $STRUCT in
 
63
    ADDRESS|LIST|BUFFER|PARAMETER|BODY|ENVELOPE|HEADER)
 
64
      BODY=`cleanbody "$BODY"`
 
65
      echo "$STRUCT: $BODY"
 
66
    ;;
 
67
  esac
 
68
  return
 
69
}
 
70
 
 
71
DEST="$1"
 
72
TMPD="$DEST.tmp"
 
73
 
 
74
TEXT="$BASEVERSION"
 
75
 
 
76
echo "/* base version: $BASEVERSION" > $TMPD
 
77
while read line
 
78
do
 
79
  case "$line" in
 
80
    'typedef struct'*)
 
81
       STRUCT=`getstruct "$line"`
 
82
       if test -n "$STRUCT"
 
83
       then
 
84
         NAME=`echo $STRUCT | cut -d: -f1`
 
85
         BODY=`echo $STRUCT | cut -d' ' -f2-`
 
86
         echo " * $NAME:" $BODY >> $TMPD
 
87
         TEXT="$TEXT $NAME {$BODY}"
 
88
       fi
 
89
    ;;
 
90
  esac
 
91
done
 
92
echo " */" >> $TMPD
 
93
 
 
94
MD5TEXT=`echo "$TEXT" | $MD5`
 
95
echo "#define HCACHEVER 0x"`echo $MD5TEXT | cut -c-8` >> $TMPD
 
96
 
 
97
# TODO: validate we have all structs
 
98
 
 
99
mv $TMPD $DEST