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

View File

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