(change version)

found and fixed bug in awk, the test ! i in array is not supported, you have to use only: i in array

annoying, but that's life.
This commit is contained in:
inxi-svn 2010-01-08 00:51:34 +00:00
parent 8eb4d3d470
commit aa746b3221

27
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.2.9 #### version: 1.2.10
#### Date: January 7 2010 #### Date: January 7 2010
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -3315,20 +3315,26 @@ get_sensors_data()
# note that the counters are dynamically set for fan numbers here # note that the counters are dynamically set for fan numbers here
# otherwise you could overwrite eg aux fan2 with case fan2 in theory # otherwise you could overwrite eg aux fan2 with case fan2 in theory
# note: cpu/mobo/ps are 1/2/3 # note: cpu/mobo/ps are 1/2/3
# NOTE: test: ! i in array does NOT work, this appears to be an awk/gawk bug
/^(AUX(1)? |CASE(1)? |CHASSIS(1)? )(.*)[ \t]*([0-9]+)[ \t]RPM/ { /^(AUX(1)? |CASE(1)? |CHASSIS(1)? )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
for ( i = 4; i < 7; i++ ){ for ( i = 4; i < 7; i++ ){
if ( ! i in aFanMain ){ if ( i in aFanMain ){
sysFanNu = i ##
aFanMain[sysFanNu]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 ) }
else {
aFanMain[i]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
break break
} }
} }
} }
/^(AUX([2-9]) |CASE([2-9]) |CHASSIS([2-9]) )(.*)[ \t]*([0-9]+)[ \t]RPM/ { /^(AUX([2-9]) |CASE([2-9]) |CHASSIS([2-9]) )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
for ( i = 5; i < 30; i++ ){ for ( i = 5; i < 30; i++ ){
if ( ! i in aFanMain ){ if ( i in aFanMain ) {
##
}
else {
sysFanNu = i sysFanNu = i
aFanMain[sysFanNu]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 ) aFanMain[i]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
break break
} }
} }
@ -3342,7 +3348,12 @@ get_sensors_data()
sysFanNu=gensub( /fan([0-9]+)/, "\\1", 1, $1 ) sysFanNu=gensub( /fan([0-9]+)/, "\\1", 1, $1 )
if ( sysFanNu ~ /^([0-9]+)$/ ) { if ( sysFanNu ~ /^([0-9]+)$/ ) {
# add to array if array index does not exist OR if number is > existing number # add to array if array index does not exist OR if number is > existing number
if ( ! sysFanNu in aFanDefault || fanWorking >= aFanDefault[sysFanNu] ) { if ( sysFanNu in aFanDefault ) {
if ( fanWorking >= aFanDefault[sysFanNu] ) {
aFanDefault[sysFanNu]=fanWorking
}
}
else {
aFanDefault[sysFanNu]=fanWorking aFanDefault[sysFanNu]=fanWorking
} }
} }
@ -3431,7 +3442,7 @@ get_sensors_data()
} }
# then we need to get the actual numeric max array count for both fan arrays # then we need to get the actual numeric max array count for both fan arrays
for (i = 0; i <= 14; i++) { for (i = 0; i <= 29; i++) {
if ( i in aFanMain && i > indexCountaFanMain ) { if ( i in aFanMain && i > indexCountaFanMain ) {
indexCountaFanMain=i indexCountaFanMain=i
} }