Merge pull request #8 from CasperVector/master

Fix bug in yesno(), plus minor improvements.
This commit is contained in:
Ghost1227 2012-08-24 10:55:05 -07:00
commit 4327bd6cf2
3 changed files with 10 additions and 7 deletions

11
src/cdm
View File

@ -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
;;

View File

@ -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"

View File

@ -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