File: postats

package info (click to toggle)
potool 0.10-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 184 kB
  • ctags: 93
  • sloc: ansic: 595; yacc: 350; sh: 233; makefile: 82; perl: 50
file content (41 lines) | stat: -rwxr-xr-x 1,196 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

if [ "$1" = "-f" ] ; then
	fuzzy=1
	shift
fi

if [ $# -gt 0 ]; then
	files=$*
else
	files=*.po
fi


(
	ntr=0
	nall=0
	for a in $files; do
		[ -f $a ] || continue
		tr=`potool $a -ft -s 2>/dev/null`
		[ $? -eq 0 ] || { echo "Error: \"potool $a -ft -s\" failed"; continue ; }
		all=`potool $a -s 2>/dev/null`
		[ $? -eq 0 ] || { echo "Error: \"potool $a -s\" failed"; continue ; }
		fuzzy=`potool $a -ff -s 2>/dev/null`
		[ $? -eq 0 ] || { echo "Error: \"potool $a -ff -s\" failed"; continue ; }
		if [ -n "$fuzzy" ] ; then
		printf '%-24s - %5s/%3s/%-5s (%3s%%)  -%s\n' ${a} ${tr} ${fuzzy} ${all} $((${tr}*100/${all})) $(($all-$tr))
		else
		printf '%-24s - %5s/%-5s (%3s%%)  -%s\n'     ${a} ${tr}          ${all} $((${tr}*100/${all})) $(($all-$tr))
		fi
		ntr=$((${ntr}+${tr}))
		nfuzzy=$((${nfuzzy}+${fuzzy}))
		nall=$((${nall}+${all}))
	done
	if [ -n "$fuzzy" ] ; then
	[ $nall -gt 0 ] && printf '%-24s - %5s/%3s/%-5s (%s%%)  -%s\n' "x(100%)x" ${ntr} ${nfuzzy} ${nall} $((${ntr}*100/${nall})) $(($nall-$ntr))
	else
	[ $nall -gt 0 ] && printf '%-24s - %5s/%-5s (%s%%)  -%s\n' "x(100%)x"     ${ntr}           ${nall} $((${ntr}*100/${nall})) $(($nall-$ntr))
	fi
) | sort -nt'(' -k 1