Merge pull request #8 from CasperVector/master
Fix bug in yesno(), plus minor improvements.
This commit is contained in:
commit
4327bd6cf2
11
src/cdm
11
src/cdm
@ -36,18 +36,19 @@ trap '' SIGINT SIGTSTP
|
||||
|
||||
# Helper functions.
|
||||
|
||||
warn() { printf ' \033[01;33m*\033[00m '; echo "$name: $*" > /dev/stderr; }
|
||||
error() { printf ' \033[01;31m*\033[00m '; echo "$name: $*" > /dev/stderr; }
|
||||
warn() { (printf ' \033[01;33m*\033[00m '; echo "$name: $*") > /dev/stderr; }
|
||||
error() { (printf ' \033[01;31m*\033[00m '; echo "$name: $*") > /dev/stderr; }
|
||||
exitnormal() { exit 0; }
|
||||
exiterror() { sleep 1; exit 1; }
|
||||
yesno()
|
||||
{
|
||||
[ -z "$1" ] && return 1
|
||||
eval value=\$${1}
|
||||
|
||||
case "$1" in
|
||||
case "$value" in
|
||||
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;;
|
||||
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;
|
||||
*) warn "\`$1' is not a valid argument for \`yesno'; using \`no' for now."
|
||||
*) warn "Invalid value for \`$1'; falling back to \`no' for now.";;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -161,6 +162,8 @@ case ${flaglist[$binindex]} in
|
||||
if ! eval cdm-xlaunch $launchflags -- $bin -- $serverargs; then
|
||||
warn "\`cdm-xlaunch' exited unsuccessfully."
|
||||
exiterror
|
||||
else
|
||||
exitnormal
|
||||
fi
|
||||
;;
|
||||
|
||||
|
@ -33,7 +33,7 @@ consolekit=false
|
||||
cktimeout=30
|
||||
|
||||
info() { printf ' \033[01;32m*\033[00m '; echo "$name: $*"; }
|
||||
error() { printf ' \033[01;31m*\033[00m '; echo "$name: $*" > /dev/stderr; }
|
||||
error() { (printf ' \033[01;31m*\033[00m '; echo "$name: $*") > /dev/stderr; }
|
||||
|
||||
args=$(getopt -n "$name" -o ct: -l consolekit,timeout: -- "$@") || exit 1
|
||||
eval set -- "$args"
|
||||
|
@ -48,9 +48,9 @@ locktty=no
|
||||
# /usr/bin/X :$display $serverargs vt$((xtty+display))
|
||||
serverargs='-nolisten tcp'
|
||||
|
||||
# Use consolekit for X session?
|
||||
# Use ConsoleKit for X session?
|
||||
consolekit=yes
|
||||
|
||||
# Timeout for waiting for X session to register with consolekit.
|
||||
# Timeout for waiting for X session to register with ConsoleKit.
|
||||
cktimeout=30
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user