Debian Codegraph @

scripts/postats

raw
1 #!/bin/bash
2 # Copyright (C) 2000-207 Marcin Owsiany <[email protected]>
3
4 if [ "$1" = "-f" ] ; then
5 fuzzy=1
6 shift
7 fi
8
9 if [ $# -gt 0 ]; then
10 files=$*
11 else
12 files=*.po
13 fi
14
15
16 (
17 ntr=0
18 nall=0
19 for a in $files; do
20 [ -f $a ] || continue
21 tr=`potool $a -ft -s 2>/dev/null`
22 [ $? -eq 0 ] || { echo "Error: \"potool $a -ft -s\" failed"; continue ; }
23 all=`potool $a -s 2>/dev/null`
24 [ $? -eq 0 ] || { echo "Error: \"potool $a -s\" failed"; continue ; }
25 fuzzy=`potool $a -ff -s 2>/dev/null`
26 [ $? -eq 0 ] || { echo "Error: \"potool $a -ff -s\" failed"; continue ; }
27 if [ -n "$fuzzy" ] ; then
28 printf '%-24s - %5s/%3s/%-5s (%3s%%) -%s\n' ${a} ${tr} ${fuzzy} ${all} $((${tr}*100/${all})) $(($all-$tr))
29 else
30 printf '%-24s - %5s/%-5s (%3s%%) -%s\n' ${a} ${tr} ${all} $((${tr}*100/${all})) $(($all-$tr))
31 fi
32 ntr=$((${ntr}+${tr}))
33 nfuzzy=$((${nfuzzy}+${fuzzy}))
34 nall=$((${nall}+${all}))
35 done
36 if [ -n "$fuzzy" ] ; then
37 [ $nall -gt 0 ] && printf '%-24s - %5s/%3s/%-5s (%s%%) -%s\n' "x(100%)x" ${ntr} ${nfuzzy} ${nall} $((${ntr}*100/${nall})) $(($nall-$ntr))
38 else
39 [ $nall -gt 0 ] && printf '%-24s - %5s/%-5s (%s%%) -%s\n' "x(100%)x" ${ntr} ${nall} $((${ntr}*100/${nall})) $(($nall-$ntr))
40 fi
41 ) | sort -nt'(' -k 1
42