# Common functions shared by LTSP scripts

boolean_is_true(){
    case $1 in
       # match all cases of t|true|y|yes|on|1
       [Tt]|[Tt][Rr][Uu][Ee]|[Yy]|[Yy][Ee][Ss]|[Oo][Nn]|1) return 0 ;;
       *) return 1 ;;
    esac
}

boolean_is_false(){
    case $1 in
       # match all cases of f|false|n|no|off|0
       [Ff]|[Ff][Aa][Ll][Ss][Ee]|[Nn]|[Nn][Oo|[Oo][Ff][Ff]|0) return 0 ;;
       *) return 1 ;;
    esac
}

is_yes(){
    boolean_is_true $1
}

is_no(){
    boolean_is_false $1
}

MemInfo()
{
    sed -n '/^'$1':/ s/^'$1': *\([[:digit:]]*\).*$/\1/p' /proc/meminfo
}
