rc.subr revision 1.5
1# $NetBSD: rc.subr,v 1.5 1998/02/28 22:56:11 lukem Exp $ 2# functions used by various rc scripts 3 4# 5# checkyesno 6# Test $1 variable, and warn if not set to YES or NO. 7# return 0 if it's "yes" (et al), nonzero otherwise 8# 9checkyesno() { 10 eval value=\$${1} 11 case $value in 12 13 # "yes", "true", "on", or "1" 14 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) 15 return 0 16 ;; 17 18 # "no", "false", "off", or "0" 19 [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) 20 return 1 21 ;; 22 23 *) 24 logger -s "WARNING: \$${1} is not set properly." 25 return 1 26 ;; 27 esac 28} 29