rename the case array to wcase, as gawk can be compiled with support for

switch/case, in which event case is a reserved word, and causes errors.
Closes gh-2.
This commit is contained in:
rupa committed 2009-10-13 19:42:10 -04:00
1 parent 151872282f
commit 0904fc4c04
1 file changed
+5 -5
+5 -5
View File
@@ -105,14 +105,14 @@ z() {
} else if( typ == "recent" ) {
f = t-$3
} else f = frecent($2, $3)
case[$1] = nocase[$1] = f
wcase[$1] = nocase[$1] = f
for( i in a ) {
if( $1 !~ a[i] ) delete case[$1]
if( $1 !~ a[i] ) delete wcase[$1]
if( tolower($1) !~ tolower(a[i]) ) delete nocase[$1]
}
if( case[$1] > oldf ) {
if( wcase[$1] > oldf ) {
cx = $1
oldf = case[$1]
oldf = wcase[$1]
} else if( nocase[$1] > noldf ) {
ncx = $1
noldf = nocase[$1]
@@ -120,7 +120,7 @@ z() {
}
END {
if( cx ) {
output(case, cx, common(case, a, 0))
output(wcase, cx, common(wcase, a, 0))
} else if( ncx ) output(nocase, ncx, common(nocase, a, 1))
}
' $datafile)"