03.04.2013 19:24 пользователь "Antoine Jacoutot" <[email protected]>
написал:
>
> On Wed, Apr 03, 2013 at 05:14:10PM +0200, Alexander Hall wrote:
> > On 04/03/13 13:42, Vadim Zhukov wrote:
> > > This patch makes rc.subr show only supported operations in usage.
> > > This avoids some sort of confusion when, e.g., /etc/rc.d/smtpd
> > > shows that "reload" command is allowed, but when you try it,
> > > you get "reload not supported" error.
> > >
> > > okay?
> >
> > I approve of the idea. Nits inline.
I'll send a new diff ASAP.
> No need to check for 'check' => this is a mandatory action.
> No need to check for 'restart' => it is 'start'+'stop'
I've took logic from the rc_cmd(), it doesn't go smart either. Should it be
fixed, too? Should we add general explicit check (to rc_cmd()?) that
"check" and "restart" are not disabled?
> > > WBR,
> > > Vadim Zhukov
> > >
> > >
> > > Index: rc.subr
> > > ===================================================================
> > > RCS file: /cvs/src/etc/rc.d/rc.subr,v
> > > retrieving revision 1.68
> > > diff -u -p -r1.68 rc.subr
> > > --- rc.subr 19 Nov 2012 07:10:59 -0000 1.68
> > > +++ rc.subr 3 Apr 2013 11:35:58 -0000
> > > @@ -25,7 +25,13 @@ rc_err() {
> > > }
> > >
> > > rc_usage() {
> > > - rc_err "usage: $0 [-df] {start|check|reload|restart|stop}"
> > > + local _a _allsup _enotsup
> > > + for _a in start check reload restart stop; do
> > > + eval _enotsup=\${rc_${_a}}
> > > + [ X"${_enotsup}" != X"NO" ] && _allsup="$_allsup $_a"
> >
> > maybe
> > [ X"${_enotsup}" != X"NO" ] &&
_allsup="${_allsup+$_allsup|}$_a"
> >
> > > + done
> >
> > > + _allsup="`echo $_allsup | sed -e 's/ /|/g'`"
> >
> > and skip the line above
> >
> > > + rc_err "usage: $0 [-df] {${_allsup}}"
> > > }
> > >
> > > rc_write_runfile() {
> > >
> >
> > Also, you mix $var and ${var} notation. While I prefer the former
> > unless ${...} is needed for clarity or functionality, we should at
> > least be consequent where possible.
> >
> > /Alexander
>
> --
> Antoine