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?
--
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"
+ done
+ _allsup="`echo $_allsup | sed -e 's/ /|/g'`"
+ rc_err "usage: $0 [-df] {${_allsup}}"
}
rc_write_runfile() {