petite modification pour éviter d'appeler un processus externe dans les cas les plus courants

This commit is contained in:
Jephté Clain 2014-08-28 10:31:05 +04:00
parent f200c7ec66
commit ce39f910f5
2 changed files with 12 additions and 3 deletions

View File

@ -1 +1 @@
001003000
001004000

View File

@ -20,17 +20,26 @@ if check_sysinfos -s macosx; then
function tolower() { tr A-Z a-z <<<"$*"; }
function toupper() { tr a-z A-Z <<<"$*"; }
function is_yes() {
case "$1" in
o|oui|y|yes|v|vrai|t|true|on) return 0;;
O|OUI|Y|YES|V|VRAI|T|TRUE|ON) return 0;;
esac
isnum "$1" && [ "$1" -ne 0 ] && return 0
# pour les perfs, n'utiliser tolower que ici
case "$(tolower "$1")" in
o|oui|y|yes|v|vrai|t|true|on) return 0;;
esac
isnum "$1" && [ "$1" -ne 0 ] && return 0
return 1
}
function is_no() {
case "$1" in
n|non|no|f|faux|false|off) return 0;;
N|NON|NO|F|FAUX|FALSE|OFF) return 0;;
esac
isnum "$1" && [ "$1" -eq 0 ] && return 0
case "$(tolower "$1")" in
n|non|no|f|faux|false|off) return 0;;
esac
isnum "$1" && [ "$1" -eq 0 ] && return 0
return 1
}