line counter test

This commit is contained in:
inxi-svn 2008-12-03 22:05:56 +00:00
parent 2339a67c01
commit ce33ac4884

51
inxi
View file

@ -884,7 +884,7 @@ get_start_client()
# Since Konversation 1.0, the DCOP interface has changed a bit: dcop "$DCPORT" Konversation ..etc # Since Konversation 1.0, the DCOP interface has changed a bit: dcop "$DCPORT" Konversation ..etc
# becomes : dcop "$DCPORT" default ... or dcop "$DCPORT" irc ..etc. So we check for versions smaller # becomes : dcop "$DCPORT" default ... or dcop "$DCPORT" irc ..etc. So we check for versions smaller
# than 1 and change the DCOP parameter/object accordingly. # than 1 and change the DCOP parameter/object accordingly.
if [[ ${T2} < 1 ]];then if [[ ${T2} -lt 1 ]];then
DCOPOBJ="Konversation" DCOPOBJ="Konversation"
fi fi
IRC_CLIENT="Konversation" IRC_CLIENT="Konversation"
@ -1708,7 +1708,7 @@ get_hard_drive_data_advanced()
IFS="," IFS=","
a_temp_working=( ${A_HDD_DATA[$i]} ) a_temp_working=( ${A_HDD_DATA[$i]} )
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
if [[ ${#a_temp_scsi[@]} > 0 ]];then if [[ ${#a_temp_scsi[@]} -gt 0 ]];then
for (( j=0; j < ${#a_temp_scsi[@]}; j++ )) for (( j=0; j < ${#a_temp_scsi[@]}; j++ ))
do do
## ok, ok, it's incomprehensible, search /dev/disk/by-id for a line that contains the ## ok, ok, it's incomprehensible, search /dev/disk/by-id for a line that contains the
@ -2620,7 +2620,7 @@ print_networking_ip_data()
print_partition_data() print_partition_data()
{ {
local a_partition_working='' partition_used='' swap='' partition_data='' partition_data_2='' local a_partition_working='' partition_used='' swap='' partition_data='' partition_data_2=''
local partition_data_3='' partition_data_4='' partition_data_5='' counter=0 local partition_data_3='' partition_data_4='' partition_data_5='' counter=1 line_max=150
# set A_PARTITION_DATA # set A_PARTITION_DATA
get_partition_data get_partition_data
@ -2642,19 +2642,38 @@ print_partition_data()
else else
swap='' swap=''
fi fi
if [[ $counter -lt 3 ]];then # because these lines can vary widely, using dynamic length handling here
partition_data="$partition_data${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " case $counter in
elif [[ $counter -lt 6 ]];then 1)
partition_data_2="$partition_data_2${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " partition_data="$partition_data${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used "
elif [[ $counter -lt 9 ]];then # echo 1 $( wc -c <<< $partition_data )
partition_data_3="$partition_data_3${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " if [[ $( wc -c <<< $partition_data ) -gt $line_max ]];then
elif [[ $counter -lt 12 ]];then counter=2
partition_data_4="$partition_data_4${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " fi
else ;;
partition_data_5="$partition_data_5${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used " 2)
fi partition_data_2="$partition_data_2${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used "
# we can't use the $i counter here because it doesn't always increment # echo 2 $( wc -c <<< $partition_data_2 )
((counter++)) if [[ $( wc -c <<< $partition_data_2 ) -gt $line_max ]];then
counter=3
fi
;;
3)
partition_data_3="$partition_data_3${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used "
if [[ $( wc -c <<< $partition_data_3 ) -gt $line_max ]];then
counter=4
fi
;;
4)
partition_data_4="$partition_data_4${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used "
if [[ $( wc -c <<< $partition_data_4 ) -gt $line_max ]];then
counter=5
fi
;;
*)
partition_data_5="$partition_data_5${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used "
;;
esac
fi fi
done done
partition_data=$( create_print_line "Partition:" "$partition_data" ) partition_data=$( create_print_line "Partition:" "$partition_data" )