From 32da9c7a7f9cf7c82430b8c81261363423525f5f Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 5 Mar 2010 22:36:09 +0000 Subject: [PATCH] (change version) fixed bug in sse output for flags --- inxi | 56 +++++++++++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/inxi b/inxi index 7ddf94a..9cfc282 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.7 -#### Date: March 4 2010 +#### version: 1.4.8 +#### Date: March 5 2010 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -3943,55 +3943,45 @@ calculate_multicore_data() process_cpu_flags() { eval $LOGFS - local cpu_flags="$1" + # must have a space after last item in list for RS=" " + local cpu_flags_working="$1 " # nx = AMD stack protection extensions # lm = Intel 64bit extensions # sse, sse2, pni = sse1,2,3,4,5 gfx extensions # svm = AMD pacifica virtualization extensions # vmx = Intel IVT (vanderpool) virtualization extensions - cpu_flags=$( echo "$cpu_flags" | gawk ' + cpu_flags=$( + echo "$cpu_flags_working" | gawk ' BEGIN { RS=" " - a_ssel["sse"] = 1 - a_ssel["sse2"] = 2 - a_ssel["pni"] = 3 - a_ssel["sse4a"] = 4 # 4a must precede 4 - a_ssel["sse4"] = 5 - a_ssel["sse5"] = 6 - a_sses[1] = "sse" - a_sses[2] = "sse2" - a_sses[3] = "sse3" - a_sses[4] = "sse4a" - a_sses[5] = "sse4" - a_sses[6] = "sse5" - sseCounter = 0 + count = 0 + i = 1 # start at one because of for increment issue flag_string = "" } - /^(nx|lm|svm|vmx)$/ { - if ( flag_string != "" ) { - flag_string = flag_string " " $0 - } - else { - flag_string = $0 - } - } - /^(sse|sse2|sse4a|sse4|sse5|pni)$/ { - if ( a_ssel[$0] > sseCounter ) { - sseCounter = a_ssel[$0] + /^(lm|nx|pni|svm|vmx|(sss|ss)e([2-9])?([a-z])?(_[0-9])?)$/ { + if ( $0 == "pni" ){ + a_flags[i] = "sse3" } + else { + a_flags[i] = $0 + } + i++ } END { - if ( sseCounter > 0 ) { - if ( flag_string != "" ) { - flag_string = a_sses[sseCounter] " " flag_string + count = asort( a_flags ) + # note: why does gawk increment before the loop and not after? weird. + for ( i=0; i <= count; i++ ){ + if ( flag_string == "" ) { + flag_string = a_flags[i] } else { - flag_string = a_sses[sseCounter] + flag_string = flag_string " " a_flags[i] } } print flag_string - }' ) + }' + ) #grep -oE '\<(nx|lm|sse[0-9]?|pni|svm|vmx)\>' | tr '\n' ' ')) if [[ -z $cpu_flags ]];then