(change version)

fixed very obscure gensub/gawk bug that makes integers into strings if 501-1000 when number is generated by gensub. This bug makes the 
number typed as string, which makes > tests always true.

Also fixed output bug where there is nothing in main fan data, but there is something in default fan data array.
This commit is contained in:
inxi-svn 2009-08-05 00:56:27 +00:00
parent 2201b388c9
commit 242dc4e829

8
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.1.10 #### version: 1.1.11
#### Date: August 4 2009 #### Date: August 4 2009
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -3324,8 +3324,10 @@ get_sensors_data()
# note: 500 > aFanDefault[j] < 1000 is the exact trigger, and if you manually # note: 500 > aFanDefault[j] < 1000 is the exact trigger, and if you manually
# assign that value below, the > 5000 test works again, and a print of the value # assign that value below, the > 5000 test works again, and a print of the value
# shows the proper value, so the corruption might be internal in awk. # shows the proper value, so the corruption might be internal in awk.
# Note: gensub is the culprit I think, assigning type string for range 501-1000 but
# type integer for all others, this triggers true for >
for (j = 1; j <= indexCountaFanDefault; j++) { for (j = 1; j <= indexCountaFanDefault; j++) {
if ( j in aFanDefault && aFanDefault[j] > 5000 && aFanMain[2] == "" ) { if ( j in aFanDefault && int( aFanDefault[j] ) > 5000 && aFanMain[2] == "" ) {
aFanMain[2] = aFanDefault[j] aFanMain[2] = aFanDefault[j]
aFanDefault[j] = "" aFanDefault[j] = ""
# then add one if required for output # then add one if required for output
@ -3364,7 +3366,7 @@ get_sensors_data()
# then build array arrays: # then build array arrays:
print cpuTempReal "," moboTempReal "," psuTemp print cpuTempReal "," moboTempReal "," psuTemp
# this is for output, a null print line does NOT create a new array index in bash # this is for output, a null print line does NOT create a new array index in bash
if ( fanMainString == "" && fanDefaultString == "" ) { if ( fanMainString == "" ) {
fanMainString="," fanMainString=","
} }
print fanMainString print fanMainString