bug fix, since it's basically not possible to control charset of output consoles, removing the degree circle from sensors output. It

failed on 8859-14, for example, but works on utf-8 and 8859-1, but rather than fight endless charset locales stuff it's easier to just 
dump it.
This commit is contained in:
inxi-svn 2009-08-03 04:48:29 +00:00
parent fcc98e7c11
commit 0fb63a489f

16
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.1.5 #### version: 1.1.6
#### Date: August 2 2009 #### Date: August 2 2009
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -3076,25 +3076,27 @@ get_sensors_data()
# we have to be sure we are working with the actual real string before assiging # we have to be sure we are working with the actual real string before assiging
# data to real variables and arrays. Extracting C/F degree unit as well to use # data to real variables and arrays. Extracting C/F degree unit as well to use
# when constructing temp items for array. # when constructing temp items for array.
# note that because of charset issues, no tempUnit="°" tempWorkingUnit degree sign
# used, but it is required in testing regex to avoid error.
/^(M\/B|MB|SYS)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ { /^(M\/B|MB|SYS)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
moboTemp=gensub( /[ \t]+\+([0-9\.]*)(.*)/, "\\1", 1, $2 ) moboTemp=gensub( /[ \t]+\+([0-9\.]*)(.*)/, "\\1", 1, $2 )
tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 ) tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
tempUnit="°" tempWorkingUnit tempUnit=tempWorkingUnit
} }
} }
/^CPU(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ { /^CPU(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
cpuTemp=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 ) cpuTemp=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 )
tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 ) tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
tempUnit="°" tempWorkingUnit tempUnit=tempWorkingUnit
} }
} }
/^(P\/S|Power)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ { /^(P\/S|Power)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
psuTemp=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 ) psuTemp=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 )
tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 ) tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
tempUnit="°" tempWorkingUnit tempUnit=tempWorkingUnit
} }
} }
$1 ~ /^temp1$/ && $2 ~ /^[ \t]*\+([0-9]+)/ { $1 ~ /^temp1$/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
@ -3104,7 +3106,7 @@ get_sensors_data()
} }
tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 ) tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
tempUnit="°" tempWorkingUnit tempUnit=tempWorkingUnit
} }
} }
$1 ~ /^temp2$/ && $2 ~ /^[ \t]*\+([0-9]+)/ { $1 ~ /^temp2$/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
@ -3114,7 +3116,7 @@ get_sensors_data()
} }
tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 ) tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
tempUnit="°" tempWorkingUnit tempUnit=tempWorkingUnit
} }
} }
@ -3127,7 +3129,7 @@ get_sensors_data()
} }
tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 ) tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
tempUnit="°" tempWorkingUnit tempUnit=tempWorkingUnit
} }
} }