Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Sep 1997 00:21:59 -0700 (PDT)
From:      Curt Sampson <cjs@portal.ca>
To:        Brian Somers <brian@awfulhak.org>
Cc:        Greg Lehey <grog@lemis.com>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: rc & rc.conf
Message-ID:  <Pine.NEB.3.93.970915001929.28817U-100000@gnostic.cynic.net>
In-Reply-To: <199709141135.MAA15300@awfulhak.demon.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 14 Sep 1997, Brian Somers wrote:

> The problem is that with the "= YES" bit, if you accidently leave the 
> variable out of rc.conf (like I did), NO is assumed.  With the "!= NO" 
> bit, you get the program run by default and have to specifically 
> disable it.

I got around (to some degree) this sort of thing with the following
function:

    #       $NetBSD: rc.subr,v 1.2 1997/08/30 03:34:29 cjs Exp $
    # functions used by various rc scripts

    # Test $1 variable, and warn if not set to YES or NO.
    checkyesno() {
	    eval value=\$${1};
	    if [ "$value" = YES ]; then
		    return 0;
	    else
		    if [ "$value" != NO ]; then
			    logger -s "WARNING: \$${1} is not set properly."
		    fi
		    return 1;
	    fi
    }

cjs

Curt Sampson    cjs@portal.ca		Info at http://www.portal.ca/
Internet Portal Services, Inc.		`And malt does more than Milton can
Vancouver, BC   (604) 257-9400		 To justify God's ways to man.' 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.93.970915001929.28817U-100000>