Date: Wed, 21 Aug 2002 00:48:51 -0700 From: "David O'Brien" <dev-null@NUXI.com> To: Luigi Rizzo <rizzo@icir.org> Cc: arch@freebsd.org Subject: Re: ugliness in rc.* scripts Message-ID: <20020821074851.GA82634@dragon.nuxi.com> In-Reply-To: <20020820232538.A53816@iguana.icir.org> References: <20020820232538.A53816@iguana.icir.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 20, 2002 at 11:25:38PM -0700, Luigi Rizzo wrote:
> which is not the most desirable thing in terms of readability.
Agreed.
> This would be easily fixed by moving /usr/bin/tr to /bin/tr (statically
> linked) and doing
>
> tolower() {
> echo `tr A-Z a-z <<_EOF
> $*`
> }
>
> case `tolower ${some_config_variable}` in
> mixed_case_string)
> ...
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
}
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?20020821074851.GA82634>
