more code cleanup

This commit is contained in:
inxi-svn 2008-10-28 02:07:37 +00:00
parent 28be7483ec
commit fa66c967b5

35
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.1.2 #### version: 0.1.3
#### Date: October 27 2008 #### Date: October 27 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash, the original bash sys info script by locsmif #### inxi is a fork of infobash, the original bash sys info script by locsmif
@ -243,6 +243,7 @@ mkbans()
cscheme() cscheme()
{ {
local I SCOLORS CLCODES local I SCOLORS CLCODES
if [[ $1 -ge ${#SCHEMES[@]} ]] if [[ $1 -ge ${#SCHEMES[@]} ]]
then then
set -- 1 set -- 1
@ -366,7 +367,8 @@ roots()
*perl*) *perl*)
unset IRCV # KSirc is one of the possibilities now. KSirc is a wrapper around dsirc, a perl client unset IRCV # KSirc is one of the possibilities now. KSirc is a wrapper around dsirc, a perl client
getcmdline $PPID getcmdline $PPID
for ((I=0; I<=$CMDLMAX; I++)); do for ((I=0; I<=$CMDLMAX; I++))
do
case ${CMDL[I]} in case ${CMDL[I]} in
*dsirc*) *dsirc*)
IRC="KSirc" IRC="KSirc"
@ -383,7 +385,10 @@ roots()
;; ;;
esac esac
done done
[[ -z $IRCV ]] && IRC="Unknown Perl client" if [[ -z $IRCV ]]
then
IRC="Unknown Perl client"
fi
;; ;;
*bash*|*sh*) *bash*|*sh*)
unset IRCV unset IRCV
@ -405,7 +410,7 @@ roots()
} }
# Get the parameters # Get the parameters
getparams() get_parameters()
{ {
if [[ -z $1 ]] if [[ -z $1 ]]
then then
@ -456,7 +461,10 @@ getparams()
;; ;;
*) *)
echo "$1" | grep -q '^[0-9][0-9]\?$' || error 3 "$1" echo "$1" | grep -q '^[0-9][0-9]\?$' || error 3 "$1"
((CSCHEME)) || cscheme "$1" if ! ((CSCHEME))
then
cscheme "$1"
fi
;; ;;
esac esac
shift shift
@ -541,7 +549,7 @@ then
fi fi
# "$@" passes every parameter seperately quoted, "$*" passes all parameters as one quoted parameter. # "$@" passes every parameter seperately quoted, "$*" passes all parameters as one quoted parameter.
getparams "$@" get_parameters "$@"
# If no colorscheme was set in the parameter handling routine, then set the default scheme # If no colorscheme was set in the parameter handling routine, then set the default scheme
if ! ((CSCHEME)) if ! ((CSCHEME))
@ -715,7 +723,10 @@ END {
') ')
#grep -oE '\<(nx|lm|sse[0-9]?|pni|svm|vmx)\>' | tr '\n' ' ')) #grep -oE '\<(nx|lm|sse[0-9]?|pni|svm|vmx)\>' | tr '\n' ' '))
[[ -z $CPUFLAGS ]] && CPUFLAGS="-" if [[ -z $CPUFLAGS ]]
then
CPUFLAGS="-"
fi
for I in /proc/ide/ide*/hd* for I in /proc/ide/ide*/hd*
do do
@ -754,9 +765,11 @@ then
} }
} }
} }
' /proc/scsi/scsi)); IFS="$OIFS" ' /proc/scsi/scsi))
IFS="$OIFS"
for ((I=0;I<${#THDD[@]};I++)); do for (( I=0; I < ${#THDD[@]}; I++ ))
do
HDDMOD="${HDDMOD}${HDDMOD+,}${THDD[I]}" HDDMOD="${HDDMOD}${HDDMOD+,}${THDD[I]}"
done done
fi fi
@ -954,7 +967,9 @@ then
for ((I=1;I<${#CPU[@]}-1;I++)) for ((I=1;I<${#CPU[@]}-1;I++))
do do
IFS=","; CPUTMP=(${CPU[I]}); IFS="$OIFS" IFS=","
CPUTMP=(${CPU[I]})
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 [[ $VBL -ge 3 ]] if [[ $VBL -ge 3 ]]
then then