Fixed cpu flag line print as well, uses arrays now, so no need to use numbered line outputs etc.

This commit is contained in:
inxi-svn 2008-12-05 05:54:07 +00:00
parent 688e10e858
commit 3bb0d7d087

36
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.8.4 #### version: 0.8.5
#### Date: December 4 2008 #### Date: December 4 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
@ -2337,32 +2337,30 @@ print_cpu_data()
# args: $1 - cpu flag string # args: $1 - cpu flag string
print_cpu_flags_full() print_cpu_flags_full()
{ {
local cpu_flags_full="$1" cpu_flags_1='' cpu_flags_2='' cpu_flags_3='' flag_data='' local cpu_flags_full="$1" a_cpu_flags='' line_starter=''
local i=0 flag='' local i=0 counter=0 max_length=18 max_length_add=18 flag='' flag_data=''
# build the flag line array
for flag in $cpu_flags_full for flag in $cpu_flags_full
do do
if [[ $i -ge 36 ]];then a_cpu_flags[$counter]="${a_cpu_flags[$counter]}$flag "
cpu_flags_3="$cpu_flags_3$flag " if [[ $i -ge $max_length ]];then
elif [[ $i -ge 18 ]];then (( counter++ ))
cpu_flags_2="$cpu_flags_2$flag " max_length=$(( $max_length + $max_length_add ))
elif [[ $i -ge 0 ]];then
cpu_flags_1="$cpu_flags_1$flag "
fi fi
((i++)) ((i++))
done done
if [[ -n $cpu_flags_1 ]];then # then print it out
flag_data=$( create_print_line " " "${C1}CPU Flags${C2} $cpu_flags_1" ) for (( i=0; i < ${#a_cpu_flags[@]};i++ ))
print_screen_output "$flag_data" do
if [[ $i -eq 0 ]];then
line_starter="${C1}CPU Flags${C2} "
else
line_starter=''
fi fi
if [[ -n $cpu_flags_2 ]];then flag_data=$( create_print_line " " "$line_starter${a_cpu_flags[$i]}" )
flag_data=$( create_print_line " " "$cpu_flags_2" )
print_screen_output "$flag_data" print_screen_output "$flag_data"
fi done
if [[ -n $cpu_flags_3 ]];then
flag_data=$( create_print_line " " "$cpu_flags_3" )
print_screen_output "$flag_data"
fi
} }
print_gfx_data() print_gfx_data()