more refactoring

This commit is contained in:
inxi-svn 2008-10-29 05:05:01 +00:00
parent 186f1ced0b
commit 887c559ca8

36
inxi
View file

@ -1107,12 +1107,12 @@ print_networking_data()
print_it_out() print_it_out()
{ {
local hostName=$( hostname ) local hostName=$( hostname ) i=''
# (IF VERBOSITY_LEVEL > 1) # (IF VERBOSITY_LEVEL > 1)
if ((VERBOSITY_LEVEL)) if [ "$VERBOSITY_LEVEL" -gt 0 ]
then then
if ((SHOW_HOST)) if [ "$SHOW_HOST" -gt 0 ]
then then
LNINTRO=$( printf "${C1}%-${INDENT}s${C2} \"%s\"${C1} %s " "Host/Kernel/OS" "$hostName" "running" ) LNINTRO=$( printf "${C1}%-${INDENT}s${C2} \"%s\"${C1} %s " "Host/Kernel/OS" "$hostName" "running" )
else else
@ -1148,26 +1148,26 @@ print_it_out()
unset CPUNUM unset CPUNUM
fi fi
LNCPU=$( printf "${C1}%-${INDENT}s${C2} %s" "CPU Info" "${CPUNUM}${CPUNUM+ }${CPUTMP[0]}" ) LNCPU=$( printf "${C1}%-${INDENT}s${C2} %s" "CPU Info" "${CPUNUM}${CPUNUM+ }${CPUTMP[0]}" )
if [[ $VERBOSITY_LEVEL -ge 3 ]] if [ "$VERBOSITY_LEVEL" -ge 3 ]
then then
LNCPU=$( printf "%s${C2} %s %s ${C1}%s${CN}%s${C2} %s ${CN}%s" "$LNCPU" "${CPUTMP[2]}" "cache" "flags" "(" "$CPUFLAGS" ")" ) LNCPU=$( printf "%s${C2} %s %s ${C1}%s${CN}%s${C2} %s ${CN}%s" "$LNCPU" "${CPUTMP[2]}" "cache" "flags" "(" "$CPUFLAGS" ")" )
fi fi
LNCPU=$( printf "%s ${C1}%s${C2} ${CN}%s${C2} %s ${CN}%s" "$LNCPU" "clocked at" "[" "${CPUTMP[1]} MHz" "]" ) LNCPU=$( printf "%s ${C1}%s${C2} ${CN}%s${C2} %s ${CN}%s" "$LNCPU" "clocked at" "[" "${CPUTMP[1]} MHz" "]" )
print_screen_output "$LNCPU" print_screen_output "$LNCPU"
for (( I=1; I < ${#CPU[@]}-1; I++)) for (( i=1; i < ${#CPU[@]}-1; i++ ))
do do
IFS="," IFS=","
CPUTMP=(${CPU[I]}) CPUTMP=(${CPU[i]})
IFS="$OIFS" IFS="$OIFS"
LNCPU=$( printf "${C1}%-${INDENT}s${C2} %s" " " "($((I+1))) ${CPUTMP[0]}" ) LNCPU=$( printf "${C1}%-${INDENT}s${C2} %s" " " "($((i+1))) ${CPUTMP[0]}" )
if [[ $VERBOSITY_LEVEL -ge 3 ]] if [[ $VERBOSITY_LEVEL -ge 3 ]]
then then
LNCPU=$( printf "%s${C2} %s %s ${C1}%s${CN}%s${C2} %s ${CN}%s" "$LNCPU" "${CPUTMP[2]}" "cache" "flags" "(" "$CPUFLAGS" ")" ) LNCPU=$( printf "%s${C2} %s %s ${C1}%s${CN}%s${C2} %s ${CN}%s" "$LNCPU" "${CPUTMP[2]}" "cache" "flags" "(" "$CPUFLAGS" ")" )
fi fi
LNCPU=$( printf "%s ${C1}%s${C2} ${CN}%s${C2} %s ${CN}%s" "$LNCPU" "clocked at" "[" "${CPUTMP[1]} MHz" "]" ) LNCPU=$( printf "%s ${C1}%s${C2} ${CN}%s${C2} %s ${CN}%s" "$LNCPU" "clocked at" "[" "${CPUTMP[1]} MHz" "]" )
print_screen_output "$LNCPU" print_screen_output "$LNCPU"
if [[ $I -gt 10 ]] if [[ $i -gt 10 ]]
then then
break break
fi fi
@ -1182,12 +1182,12 @@ print_it_out()
fi fi
print_screen_output "$LNGFX" print_screen_output "$LNGFX"
I=1 i=1
while [[ -n ${GFX[I]} && $I -le 3 ]] while [[ -n ${GFX[i]} && $i -le 3 ]]
do do
LNGFX=$( printf "${C1}%-${INDENT}s${C2} %s" " " "${GFX[I]}" ) LNGFX=$( printf "${C1}%-${INDENT}s${C2} %s" " " "${GFX[i]}" )
print_screen_output "$LNGFX" print_screen_output "$LNGFX"
(( I++ )) (( i++ ))
done done
if [[ $VERBOSITY_LEVEL -ge 2 ]] if [[ $VERBOSITY_LEVEL -ge 2 ]]
@ -1232,22 +1232,22 @@ print_it_out()
#set_color_scheme 12 #set_color_scheme 12
if ! ((IBSHELL)) if ! ((IBSHELL))
then then
for I in $C1 $C2 $CN for i in $C1 $C2 $CN
do do
case "$I" in case "$i" in
"$GREEN"|"$WHITE"|"$YELLOW"|"$CYAN") BGBLACK=1 "$GREEN"|"$WHITE"|"$YELLOW"|"$CYAN") BGBLACK=1
;; ;;
esac esac
done done
if ((BGBLACK)) if ((BGBLACK))
then then
for I in C1 C2 CN for i in C1 C2 CN
do do
if [[ "${!I}" = "$NORMAL" ]] if [[ "${!i}" = "$NORMAL" ]]
then then
declare $I="${!I}15,1" declare $i="${!i}15,1"
else else
declare $I="${!I},1" declare $i="${!i},1"
fi fi
done done
#C1="${C1},1"; C2="${C2},1"; CN="${CN},1" #C1="${C1},1"; C2="${C2},1"; CN="${CN},1"