This makes a lot of sense to me.

Penned by Vadim Zhukov on 20130403 12:59.08, we have:
| Third iteration, after input from ajacoutot@, todd@ and marc@.
| 
| Now rc_restart becomes unavailable if either start or stop is disabled.
| 
| 
| 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 17:55:00 -0000
| @@ -24,8 +24,18 @@ rc_err() {
|       exit 1
|  }
|  
| +rc_is_supported() {
| +     local _enotsup
| +     eval _enotsup=\${rc_${1}}
| +     [ X"${_enotsup}" != X"NO" ]
| +}
| +
|  rc_usage() {
| -     rc_err "usage: $0 [-df] {start|check|reload|restart|stop}"
| +     local _a _allsup
| +     for _a in start stop restart reload check; do
| +             rc_is_supported ${_a} && _allsup="${_allsup:+$_allsup|}${_a}"
| +     done
| +     rc_err "usage: $0 [-df] (${_allsup})"
|  }
|  
|  rc_write_runfile() {
| @@ -95,14 +105,17 @@ rc_wait() {
|  }
|  
|  rc_cmd() {
| -     local _bg _enotsup _n
| +     local _bg _n
|  
|       [ "$(id -u)" -eq 0 ] || \
|               [ X"${rc_usercheck}" != X"NO" -a X"$1" = "Xcheck" ] || \
|               rc_err "$0: need root privileges"
|  
| -     eval _enotsup=\${rc_${1}}
| -     if [ X"${_enotsup}" = X"NO" ]; then
| +     if ! (rc_is_supported start && rc_is_supported stop); then
| +             rc_restart=NO
| +     fi
| +
| +     if ! rc_is_supported $1; then
|               [ -n "${INRC}" ] && exit 1
|               rc_err "$0: $1 is not supported"
|       fi

-- 
Todd Fries .. [email protected]

 ____________________________________________
|                                            \  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:[email protected]
| "..in support of free software solutions." \  sip:[email protected]
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
                                                 
              37E7 D3EB 74D0 8D66 A68D  B866 0326 204E 3F42 004A
                        http://todd.fries.net/pgp.txt

Reply via email to