Penned by Antoine Jacoutot on 20130403 10:24.19, we have: | 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. | | No need to check for 'check' => this is a mandatory action. | No need to check for 'restart' => it is 'start'+'stop'
amd does not support stop. | > > 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 -- Todd Fries .. t...@fries.net ____________________________________________ | \ 1.636.410.0632 (voice) | Free Daemon Consulting, LLC \ 1.405.227.9094 (voice) | http://FreeDaemonConsulting.com \ 1.866.792.3418 (FAX) | PO Box 16169, Oklahoma City, OK 73113 \ sip:freedae...@ekiga.net | "..in support of free software solutions." \ sip:4052279...@ekiga.net \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 37E7 D3EB 74D0 8D66 A68D B866 0326 204E 3F42 004A http://todd.fries.net/pgp.txt