Fixed a few last bugs, shortoutput fine tuned, fixed variable names for spacer elements in short output, added one new class of variable

naming, Some_Variable, for when the variable will be inherited by child functions, that way you know that the variable is going to be 
passed down, or has been inherited.

And with those fine tuning changes, time for inxi to go to version 1.0.0
This commit is contained in:
inxi-svn 2009-02-11 17:28:25 +00:00
parent 4305cd22d1
commit 96efd50410

33
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 0.10.4
#### Date: 6 February 2009
#### version: 1.0.0
#### Date: 11 February 2009
########################################################################
#### SPECIAL THANKS
########################################################################
@ -78,6 +78,7 @@
#### All variables MUST be initialized / declared explicitly
####, globals UPPER CASE, at top of script, SOME_VARIABLE='' (words separated by _ ).
#### Locals always with: local some_variable= (lower case, words separated by _ )
#### Locals that will be inherited by child functions: Some_Variable (so you know they are inherited)
#### and at the top of the function.
####
#### Booleans should start with b_ or B_ and state clearly what is being tested
@ -236,8 +237,8 @@ shopt -u nullglob
# Backup the current Internal Field Separator
ORIGINAL_IFS="$IFS"
# These two determine separators in single line output, to force irc clients not to break off sections
FL1='-'
FL2=''
SEP1='-'
SEP2='~'
### Script names/paths
SCRIPT_NAME="inxi"
@ -1267,7 +1268,7 @@ get_audio_data()
IFS=$'\n'
# this first step handles the drivers for cases where the second step fails to find one
device_count=$( echo "$lspci_data" | egrep -ic '(multimedia audio controller|audio device)' )
device_count=$( echo "$Lspci_Data" | egrep -ic '(multimedia audio controller|audio device)' )
if [[ $device_count -eq 1 ]] && [[ $B_ASOUND_CARDS == 'true' ]];then
alsa_driver=$( gawk -F ']: ' '
BEGIN {
@ -1289,7 +1290,7 @@ get_audio_data()
alsa_driver=$( echo $alsa_driver )
# now we'll build the main audio data, card name, driver, and port. If no driver is found,
# and if the first method above is not null, and one card is found, it will use that instead.
A_AUDIO_DATA=( $( echo "$lspci_data" | gawk -F ': ' -v alsaDriver="$alsa_driver" '
A_AUDIO_DATA=( $( echo "$Lspci_Data" | gawk -F ': ' -v alsaDriver="$alsa_driver" '
BEGIN {
IGNORECASE=1
}
@ -1769,7 +1770,7 @@ get_graphics_card_data()
local i=''
IFS=$'\n'
A_GFX_CARD_DATA=( $( echo "$lspci_data" | gawk -F': ' '
A_GFX_CARD_DATA=( $( echo "$Lspci_Data" | gawk -F': ' '
BEGIN {
IGNORECASE=1
}
@ -1791,7 +1792,7 @@ get_graphics_card_data()
fi
# GFXMEM is UNUSED at the moment, because it shows AGP aperture size, which is not necessarily equal to GFX memory..
# GFXMEM="size=[$(echo "$lspci_data" | gawk '/VGA/{while (!/^$/) {getline;if (/size=[0-9][0-9]*M/) {size2=gensub(/.*\[size=([0-9]+)M\].*/,"\\1","g",$0);if (size<size2){size=size2}}}}END{print size2}')M]"
# GFXMEM="size=[$(echo "$Lspci_Data" | gawk '/VGA/{while (!/^$/) {getline;if (/size=[0-9][0-9]*M/) {size2=gensub(/.*\[size=([0-9]+)M\].*/,"\\1","g",$0);if (size<size2){size=size2}}}}END{print size2}')M]"
}
## create array of glx data
@ -2182,7 +2183,7 @@ get_module_version_number()
get_networking_data()
{
IFS=$'\n'
A_NETWORK_DATA=( $( echo "$lspci_data" | gawk '
A_NETWORK_DATA=( $( echo "$Lspci_Data" | gawk '
BEGIN {
IGNORECASE=1
}
@ -2577,16 +2578,16 @@ process_cpu_flags()
#### MASTER PRINT FUNCTION - triggers all line item print functions
## main function to print out, master for all sub print functions.
## note that it passes local variable values on to its children,
## and in some cases, their children, with lspci_data
print_it_out()
{
local lspci_data='' # only for verbose
# note that print_it_out passes local variable values on to its children,
# and in some cases, their children, with Lspci_Data
local Lspci_Data='' # only for verbose
if [[ $B_SHOW_SHORT_OUTPUT == 'true' ]];then
print_short_data
else
lspci_data="$( get_lspci_data )"
Lspci_Data="$( get_lspci_data )"
if [[ $VERBOSITY_LEVEL -ge 1 || $B_SHOW_SYSTEM == 'true' ]];then
print_system_data
fi
@ -2689,12 +2690,12 @@ print_short_data()
#C1="${C1},1"; C2="${C2},1"; CN="${CN},1"
fi
fi
short_data="${C1}CPU$cpc_plural${CN}[${C2} ${cpu_data_string} ${cpu_model}$model_plural (${cpu_type}) ${C1}clocked at${C2} ${min_max_clock}${CN}] ${C1}Kernel${CN}[${C2} ${current_kernel}${CN}] ${C1}Up${CN}[${C2}${FL2}${FL1}${up_time}${FL1}${CN}] ${C1}Mem${CN}[${C2}${FL2}${FL1}${memory}${FL1}${CN}] ${C1}HDD${CN}[${C2}${FL2}${FL1}${hdd_capacity}($hdd_used)${FL1}${CN}] ${C1}Procs${CN}[${C2}${FL2}${FL1}${processes}${FL1}${CN}]"
short_data="${C1}CPU$cpc_plural${CN}[${C2}${SEP1}${cpu_data_string} ${cpu_model}$model_plural (${cpu_type}) clocked at ${min_max_clock}${SEP1}${CN}] ${C1}Kernel${CN}[${C2}${SEP1}${current_kernel}${SEP1}${CN}] ${C1}Up${CN}[${C2}${SEP1}${up_time}${SEP1}${CN}] ${C1}Mem${CN}[${C2}${SEP1}${memory}${SEP1}${CN}] ${C1}HDD${CN}[${C2}${SEP1}${hdd_capacity}($hdd_used)${SEP1}${CN}] ${C1}Procs${CN}[${C2}${SEP1}${processes}${SEP1}${CN}]"
if [[ $SHOW_IRC -gt 0 ]];then
short_data="${short_data} ${C1}Client${CN}[${C2}${IRC_CLIENT}${IRC_CLIENT_VERSION}${CN}]"
short_data="${short_data} ${C1}Client${CN}[${C2}${SEP1}${IRC_CLIENT}${IRC_CLIENT_VERSION}${SEP1}${CN}]"
fi
short_data="${short_data} ${CN}:: ${C1}$SCRIPT_NAME${C2} $SCRIPT_VERSION_NUMBER${CN}"
short_data="${short_data} ${C1}$SCRIPT_NAME${C2}${CN}[${C2}${SEP1}$SCRIPT_VERSION_NUMBER${SEP1}${CN}]"
if [[ $SCHEME -gt 0 ]];then
short_data="${short_data} $NORMAL"
fi