summaryrefslogtreecommitdiffstats
path: root/third_party/heimdal/tools/fixgcov-source-paths.sh
blob: eaa9c9c62adad064bd7fe44311df44d31c43ccc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

find ${1:-.} -name '*.gcov' -print | while read f; do
    case "$f" in
    */.libs/*) continue;;
    *) true;;
    esac
    echo FIX $f
    f_basename=${f%%.gcno\#\#*}.c
    f_basename=${f_basename##*/}
    head -1 "$f" | grep 'Source:/' > /dev/null && continue
    #bname=$(head -1 "$f" | grep 'Source:/' | cut -d: -f4)
    dname=$(echo "$f"|cut -d'#' -f1|sed -e 's,/[^/]*$,/,')
    ex "$f" <<EOF
1,1 s,:Source:.*$,:Source:${dname}${f_basename},
wq!
EOF
done