bug fixes, tweaks, code cleanups for hdd printout

This commit is contained in:
inxi-svn 2009-08-07 00:22:17 +00:00
parent 8768c2b0dd
commit ddcfc1f85c

12
inxi
View file

@ -3932,7 +3932,7 @@ print_hard_disk_data()
{ {
eval $LOGFS eval $LOGFS
local hdd_data='' hdd_data_2='' a_hdd_working='' hdd_temp_data='' hdd_string='' local hdd_data='' hdd_data_2='' a_hdd_working='' hdd_temp_data='' hdd_string=''
local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name='' local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name='' divisor=5
# load A_HDD_DATA # load A_HDD_DATA
get_hdd_data_basic get_hdd_data_basic
@ -3962,8 +3962,6 @@ print_hard_disk_data()
fi fi
dev_data="/dev/${a_hdd_working[0]} " dev_data="/dev/${a_hdd_working[0]} "
size_data=" ${a_hdd_working[1]}" size_data=" ${a_hdd_working[1]}"
hdd_name="${a_hdd_working[2]}"
if [[ $B_EXTRA_DATA == 'true' && -n $dev_data ]];then if [[ $B_EXTRA_DATA == 'true' && -n $dev_data ]];then
hdd_temp_data=$( get_hdd_temp_data "$dev_data" ) hdd_temp_data=$( get_hdd_temp_data "$dev_data" )
# error handling is done in get data function # error handling is done in get data function
@ -3973,7 +3971,11 @@ print_hard_disk_data()
hdd_temp_data='' hdd_temp_data=''
fi fi
fi fi
divisor=2 # for modulus line print out, either 2 items for full, or default for short
fi
hdd_name="${a_hdd_working[2]}"
if [[ $B_SHOW_DISK == 'true' || $VERBOSITY_LEVEL -ge 3 ]];then
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_temp_data" hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_temp_data"
hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string " hdd_model="${hdd_model}${C1}$(($i+1)):${C2} $hdd_string "
# printing line one, then every other line, and after, if leftovers, print that line. # printing line one, then every other line, and after, if leftovers, print that line.
@ -3985,7 +3987,7 @@ print_hard_disk_data()
;; ;;
*) *)
# using modulus here, if divisible by 2, print line, otherwise skip # using modulus here, if divisible by 2, print line, otherwise skip
if [[ $(( $i % 2 )) -eq 0 ]];then if [[ $(( $i % $divisor )) -eq 0 ]];then
hdd_data=$( create_print_line " " "${hdd_model}${CN}" ) hdd_data=$( create_print_line " " "${hdd_model}${CN}" )
print_screen_output "$hdd_data" print_screen_output "$hdd_data"
hdd_model='' hdd_model=''