From owner-freebsd-arch Wed Aug 21 15:43:37 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C366637B405; Wed, 21 Aug 2002 15:43:32 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 48F7243E8A; Wed, 21 Aug 2002 15:43:31 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id WAA09141; Wed, 21 Aug 2002 22:43:29 GMT Date: Thu, 22 Aug 2002 08:49:55 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: developers@FreeBSD.ORG Cc: Luigi Rizzo , Subject: Re: ugliness in rc.* scripts In-Reply-To: <20020821074851.GA82634@dragon.nuxi.com> Message-ID: <20020822084643.V764-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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