Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Apr 2013 23:30:12 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        freebsd-current@FreeBSD.org, freebsd-rc@FreeBSD.org
Subject:   Re: rc.subr: disabling globbing while processing devfs rules
Message-ID:  <5159EE54.8070906@FreeBSD.org>
In-Reply-To: <201304011616.15191.jhb@freebsd.org>
References:  <514D6AC5.8010409@FreeBSD.org> <201304011406.50417.jhb@freebsd.org> <20130401195601.GA47384@stack.nl> <201304011616.15191.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
on 01/04/2013 23:16 John Baldwin said the following:
> On Monday, April 01, 2013 3:56:01 pm Jilles Tjoelker wrote:
>> On Mon, Apr 01, 2013 at 02:06:50PM -0400, John Baldwin wrote:
>>> Why not use 'local -' instead of the $- magic?  That is:
>>
>>> devfs_rulesets_from_file()
>>> {
>>>    local file _err _me -
>>>
>>>    ...
>>>    set -f
>>>    ...
>>> }
>>
>>> That would seem to be simpler.
>>
>> I had mentioned this possibility on IRC, but this feature is specific to
>> Almquist-derived shells (ash) and so something more portable was
>> selected. (It's still not standard because POSIX does not specify
>> "local" but it works on most shells in use.)
> 
> rc.subr isn't meant to be portable, it's a script that is part of the FreeBSD 
> base system.  I find the 'local -' syntax more readable (and used the feature 
> quite a bit in etcupdate).
> 

You have to set an example in etc/ :-)
I used a script in etc/rc.d as a starting point, Jilles guided me from there.

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5159EE54.8070906>