mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
new version, fixed a long standing weakness, now the long -f full cpu flag output
sorts, that's much easier to read. I also made the line lengths on that much more accurate to avoid a bunch of long flags creating a longer line, and made the first line shorter to handle the line starter text. New tarball as well, no man page changes. Not sure why this was left undone for so long, but here it is, nice and neat.
This commit is contained in:
parent
3f071d5849
commit
352cd1920d
28
inxi
28
inxi
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.8.27
|
||||
#### Date: January 9 2013
|
||||
#### version: 1.8.28
|
||||
#### Date: January 18 2013
|
||||
#### Patch Number: 00
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -145,6 +145,7 @@
|
|||
#### Because webpages come and go, the above information needs to be moved to inxi's wiki
|
||||
########################################################################
|
||||
#### Valuable Resources
|
||||
#### CPU flags: http://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean
|
||||
#### gawk arrays: http://www.math.utah.edu/docs/info/gawk_12.html
|
||||
#### raid mdstat: http://www-01.ibm.com/support/docview.wss?uid=isg3T1011259
|
||||
#### http://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array
|
||||
|
@ -6773,7 +6774,7 @@ process_cpu_flags()
|
|||
i = 1 # start at one because of for increment issue
|
||||
flag_string = ""
|
||||
}
|
||||
/^(lm|nx|pni|svm|vmx|(sss|ss)e([2-9])?([a-z])?(_[0-9])?)$/ {
|
||||
/^(lm|nx|pae|pni|svm|vmx|(sss|ss)e([2-9])?([a-z])?(_[0-9])?)$/ {
|
||||
if ( $0 == "pni" ){
|
||||
a_flags[i] = "sse3"
|
||||
}
|
||||
|
@ -7155,6 +7156,7 @@ print_cpu_data()
|
|||
fi
|
||||
# only print shortened list
|
||||
if [[ $B_CPU_FLAGS_FULL != 'true' ]];then
|
||||
# gawk has already sorted this output
|
||||
cpu_flags=$( process_cpu_flags "${a_cpu_working[3]}" )
|
||||
cpu_flags=" ${C1}flags$SEP3${C2} ($cpu_flags)"
|
||||
fi
|
||||
|
@ -7201,18 +7203,26 @@ print_cpu_data()
|
|||
print_cpu_flags_full()
|
||||
{
|
||||
eval $LOGFS
|
||||
local cpu_flags_full="$1" a_cpu_flags='' line_starter=''
|
||||
local i=0 counter=0 max_length=18 max_length_add=18 flag='' flag_data=''
|
||||
# note: sort only sorts lines, not words in a string, so convert to lines
|
||||
local cpu_flags_full="$( echo $1 | tr " " "\n" | sort )"
|
||||
local a_cpu_flags='' line_starter=''
|
||||
local i=0 counter=0 max_length=85 max_length_minus=15 flag='' flag_data=''
|
||||
local line_length=''
|
||||
|
||||
|
||||
# build the flag line array
|
||||
for flag in $cpu_flags_full
|
||||
do
|
||||
a_cpu_flags[$counter]="${a_cpu_flags[$counter]}$flag "
|
||||
if [[ $i -ge $max_length ]];then
|
||||
(( counter++ ))
|
||||
max_length=$(( $max_length + $max_length_add ))
|
||||
if [[ $counter -eq 0 ]];then
|
||||
line_length_max=$(( $max_length - $max_length_minus ))
|
||||
else
|
||||
line_length_max=$max_length
|
||||
fi
|
||||
|
||||
if [[ $( wc -c <<< ${a_cpu_flags[$counter]} ) -gt $line_length_max ]];then
|
||||
(( counter++ ))
|
||||
fi
|
||||
((i++))
|
||||
done
|
||||
# then print it out
|
||||
for (( i=0; i < ${#a_cpu_flags[@]};i++ ))
|
||||
|
|
Loading…
Reference in a new issue