utiliser les fonctions strlower() et strupper() pour compatibilité

This commit is contained in:
Jephté Clain 2014-09-17 11:15:25 +04:00
parent d9266be21b
commit 9025d42e61
4 changed files with 10 additions and 8 deletions

View File

@ -59,7 +59,7 @@ function check_overwrite() {
}
function __update_title() {
titlehl="${titlehl,,}"
titlehl="$(strlower "$titlehl")"
[ -n "$titlehl" ] || titlehl=h1
[ "${titlehl:0:1}" == "h" ] || titlehl="h$titlehl"

View File

@ -1 +1 @@
003000000
003000001

View File

@ -2853,7 +2853,7 @@ function genparse() {
# @ args -- "$@" && set -- "${args[@]}" || die "$args"
local -a names descs vars options
local i desc var option name value shortopt
local i desc var option name uname value shortopt
# analyser les arguments
for var in "$@"; do
@ -2889,10 +2889,11 @@ function genparse() {
i=0
while [ $i -lt ${#descs[*]} ]; do
name="${names[$i]}"
uname="$(strupper "$name")"
desc="${descs[$i]}"
echo -n "
\${HELP_${name^^}_OPTION:- $desc\${HELP_${name^^}_DESC:+
\${HELP_${name^^}_DESC//
\${HELP_${uname}_OPTION:- $desc\${HELP_${uname}_DESC:+
\${HELP_${uname}_DESC//
/
}}}"
i=$(($i + 1))

View File

@ -124,9 +124,10 @@ function network_format_confip() {
}
function network_format_ipsuffix() {
# network_format_ipsuffix "$ip" "$suffix" --> "ip:suffix"
if [ "${1,,}" == "dhcp" ]; then
echo "${1,,}"
# network_format_ipsuffix "$ip" "$suffix" --> "ip/suffix"
local ip="$(strlower "$1")"
if [ "$ip" == "dhcp" ]; then
echo "$ip"
else
echo "$1${2:+/$2}"
fi