tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rc.subr: Passing extra arguments to run_rc_command

On Fri, Mar 12, 2010 at 6:29 PM, Alan Barrett <> wrote:
> On Fri, 12 Mar 2010, Julio Merino wrote:
>> Therefore, I'd like to modify run_rc_command to take a set of optional
>> extra arguments that will later be fed to the _precmd, _cmd and
>> _postcmd functions.  See the attached patch.
>> Any objections or comments?
> Is it worth annotating the commands to say whether or not they take
> extra args, and giving an error when args are passed to a command that
> does not take them?  I am thinking along these lines:

I think that's too much trouble.  It's just easier to let every
command decide what to do with its arguments and error out if
something is invalid, rather than trying to deal with all the
possibilities from rc.subr.  (Allowing arguments is just one possible
case of invalid syntax.)

That said, it might be worth to change the implementation of the
standard commands to ensure that no arguments are present.  However,
if we do this, we cannot pass the arguments to the pre/post hooks as
otherwise things may not make sense -- which actually may be a
reasonable thing to do (not passing the arguments to pre/post).

Julio Merino

Home | Main Index | Thread Index | Old Index