1998-03-01 01:56:11 +03:00
|
|
|
# $NetBSD: rc.subr,v 1.5 1998/02/28 22:56:11 lukem Exp $
|
1997-08-29 06:24:04 +04:00
|
|
|
# functions used by various rc scripts
|
|
|
|
|
1998-03-01 01:56:11 +03:00
|
|
|
#
|
|
|
|
# checkyesno
|
|
|
|
# Test $1 variable, and warn if not set to YES or NO.
|
|
|
|
# return 0 if it's "yes" (et al), nonzero otherwise
|
|
|
|
#
|
1997-08-29 06:24:04 +04:00
|
|
|
checkyesno() {
|
1998-03-01 01:54:02 +03:00
|
|
|
eval value=\$${1}
|
1998-01-26 07:36:26 +03:00
|
|
|
case $value in
|
1998-03-01 01:54:02 +03:00
|
|
|
|
|
|
|
# "yes", "true", "on", or "1"
|
|
|
|
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
|
|
|
|
return 0
|
1998-01-26 07:36:26 +03:00
|
|
|
;;
|
1998-03-01 01:54:02 +03:00
|
|
|
|
|
|
|
# "no", "false", "off", or "0"
|
|
|
|
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
|
|
|
|
return 1
|
1998-01-26 07:36:26 +03:00
|
|
|
;;
|
1998-03-01 01:54:02 +03:00
|
|
|
|
1998-01-26 07:36:26 +03:00
|
|
|
*)
|
|
|
|
logger -s "WARNING: \$${1} is not set properly."
|
1998-03-01 01:54:02 +03:00
|
|
|
return 1
|
1998-01-26 07:36:26 +03:00
|
|
|
;;
|
|
|
|
esac
|
1997-08-29 06:24:04 +04:00
|
|
|
}
|