Date: Thu, 22 Aug 2002 08:49:55 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: developers@FreeBSD.ORG Cc: Luigi Rizzo <rizzo@icir.org>, <arch@FreeBSD.ORG> Subject: Re: ugliness in rc.* scripts Message-ID: <20020822084643.V764-100000@gamplex.bde.org> In-Reply-To: <20020821074851.GA82634@dragon.nuxi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 21 Aug 2002, David O'Brien wrote: > This is an interesting idea. For boolean knobs, I'd really like to see > us use the NetBSD way: > > # checkyesno var > # Test $1 variable, and warn if not set to YES or NO. > # Return 0 if it's "yes" (et al), nonzero otherwise. > # > checkyesno() > { > eval _value=\$${1} > debug "checkyesno: $1 is set to $_value." > case $_value in > > # "yes", "true", "on", or "1" > [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) > return 0 > ;; > > # "no", "false", "off", or "0" > [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) > return 1 > ;; > *) > warn "\$${1} is not set properly." > return 1 > ;; > esac > } This would be better if the code implemented what the comment says it does and warned about misspellings of YES and NO. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020822084643.V764-100000>