From owner-svn-src-all@freebsd.org Sat Apr 23 16:19:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04ECEB1A6A4; Sat, 23 Apr 2016 16:19:36 +0000 (UTC) (envelope-from lme@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D479D182E; Sat, 23 Apr 2016 16:19:35 +0000 (UTC) (envelope-from lme@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3NGJZQH030660; Sat, 23 Apr 2016 16:19:35 GMT (envelope-from lme@FreeBSD.org) Received: (from lme@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3NGJYKD030657; Sat, 23 Apr 2016 16:19:34 GMT (envelope-from lme@FreeBSD.org) Message-Id: <201604231619.u3NGJYKD030657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lme set sender to lme@FreeBSD.org using -f From: Lars Engels Date: Sat, 23 Apr 2016 16:19:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298515 - in head: etc share/examples/csh share/man/man8 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Apr 2016 16:19:36 -0000 Author: lme (ports committer) Date: Sat Apr 23 16:19:34 2016 New Revision: 298515 URL: https://svnweb.freebsd.org/changeset/base/298515 Log: - Add two new subcommands to rc.subr: "describe" shows an rc script's description "extracommands" shows an rc script's non-standard commands like "reload", "configtest", "keygen", etc - Update the rc(8) manpage and the tcsh(1) completion examples to reflect these changes Approved by: bapt Sponsored by: Essen Linuxhotel Hackathon 2016 Differential Revision: D452 Modified: head/etc/rc.subr head/share/examples/csh/dot.cshrc head/share/man/man8/rc.8 Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Apr 23 16:10:54 2016 (r298514) +++ head/etc/rc.subr Sat Apr 23 16:19:34 2016 (r298515) @@ -844,6 +844,10 @@ check_startmsgs() # # enabled Return true if the service is enabled. # +# describe Show the service's description +# +# extracommands Show the service's extra commands +# # Variables available to methods, and after run_rc_command() has # completed: # @@ -912,7 +916,7 @@ run_rc_command() eval _override_command=\$${name}_program command=${_override_command:-$command} - _keywords="start stop restart rcvar enabled $extra_commands" + _keywords="start stop restart rcvar enabled describe extracommands $extra_commands" rc_pid= _pidcmd= _procname=${procname:-${command}} @@ -962,12 +966,13 @@ run_rc_command() if [ "$_elem" != "$rc_arg" ]; then continue fi - # if ${rcvar} is set, $1 is not "rcvar" + # if ${rcvar} is set, $1 is not "rcvar" and not "describe" # and ${rc_pid} is not set, then run # checkyesno ${rcvar} # and return if that failed # - if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a "$rc_arg" != "stop" ] || + if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a "$rc_arg" != "stop" \ + -a "$rc_arg" != "describe" ] || [ -n "${rcvar}" -a "$rc_arg" = "stop" -a -z "${rc_pid}" ]; then if ! checkyesno ${rcvar}; then if [ -n "${rc_quiet}" ]; then @@ -1004,6 +1009,16 @@ run_rc_command() case "$rc_arg" in # default operations... + describe) + if [ -n "$desc" ]; then + echo "$desc" + fi + ;; + + extracommands) + echo "$extra_commands" + ;; + status) _run_rc_precmd || return 1 if [ -n "$rc_pid" ]; then Modified: head/share/examples/csh/dot.cshrc ============================================================================== --- head/share/examples/csh/dot.cshrc Sat Apr 23 16:10:54 2016 (r298514) +++ head/share/examples/csh/dot.cshrc Sat Apr 23 16:19:34 2016 (r298515) @@ -98,7 +98,7 @@ complete rsync "c,*:/,F:/," \ complete scp "c,*:/,F:/," \ "c,*:,F:$HOME," \ 'c/*@/$hosts/:/' -complete service 'c/-/(e l r v)/' 'p/1/`service -l`/' 'n/*/(start stop reload restart status rcvar onestart onestop)/' +complete service 'c/-/(e l r v)/' 'p/1/`service -l`/' 'n/*/(start stop reload restart status rcvar describe extracommands onestart onestop oneextracommands)/' complete svn 'C@file:///@`'"${HOME}/etc/tcsh/complete.d/svn"'`@@' \ 'n@ls@(file:/// svn+ssh:// svn://)@@' \ 'n@help@(add blame cat checkout cleanup commit copy delete export help import info list ls lock log merge mkdir move propdel \ Modified: head/share/man/man8/rc.8 ============================================================================== --- head/share/man/man8/rc.8 Sat Apr 23 16:10:54 2016 (r298514) +++ head/share/man/man8/rc.8 Sat Apr 23 16:19:34 2016 (r298515) @@ -323,6 +323,10 @@ If the script starts a process (rather t operation), show the status of the process. Otherwise it is not necessary to support this argument. Defaults to displaying the process ID of the program (if running). +.It Cm describe +Print a short description of what the script does. +.It Cm extracommands +Print the script's non-standard commands. .It Cm poll If the script starts a process (rather than performing a one-off operation), wait for the command to exit.