improved extra whitespace handling in cpu model filters, now all > 1 whitespace becomes a single ' '

This commit is contained in:
inxi-svn 2008-11-05 23:15:09 +00:00
parent 90779b6369
commit c21dfba13d

7
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 0.3.22
#### version: 0.3.23
#### Date: November 5 2008
########################################################################
#### inxi is a fork of infobash, the original bash sys info script by locsmif
@ -167,7 +167,7 @@ DISTROS_PRIMARY="gentoo-release mandrake-release redhat-release slackware-versio
# user@host $ ARR=($'\x01'"one two" three four); echo ${ARR[0]} | hd -v
# 00000000 01 01 6f 6e 65 20 74 77 6f 0a |..one two.|
A_NORMAL_BANS=( corporation communications gmbh technologies technology group $'\2'"\<ltd\>" ltd. $'\2'"\<inc\>" inc. $'\2'\<co\> co. "(tm)" "(r)" $'\2'"\(rev ..\)" )
A_CPU_BANS=( cpu deca 'dual core ' 'tri core ' 'quad core ' ennea genuine hepta hexa multi octa penta 'processor ' processor single triple $'\2'"[0-9.]+ *[MmGg][Hh][Zz]" )
A_CPU_BANS=( cpu deca 'dual core' 'tri core' 'quad core' ennea genuine hepta hexa multi octa penta 'processor' processor single triple $'\2'"[0-9.]+ *[MmGg][Hh][Zz]" )
### Source global config overrides
if [ -s /etc/$SCRIPT_NAME.conf ];then
@ -810,9 +810,9 @@ get_cpu_data()
/^model name|^cpu\t+:/ {
gsub(/,/," ",$NF)
gsub(//,"",$NF)
gsub(/'"$A_NORMAL_BANS"'/, "", $NF )
gsub(/'"$A_CPU_BANS"'/, "", $NF )
gsub(/[ \t]+/," ",$NF)
cpu[nr, "model"] = $NF
}
@ -1270,6 +1270,7 @@ calculate_multicore_data()
echo "$string_number$string_data"
}
# prints out shortened list of flags, the main ones of interest
# args: $1 - string of cpu flags to process
process_cpu_flags()
{