summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Engels <lme@FreeBSD.org>2016-04-23 16:19:34 +0000
committerLars Engels <lme@FreeBSD.org>2016-04-23 16:19:34 +0000
commit1980d11b5f6115f3fc1b8fd8ea7f2a52ef36f3e1 (patch)
tree5695515d0de6848ff9f1807c4854111fe019b9d7
parent6c1a5e837d2d886042767bcc7b7255b81acc0965 (diff)
downloadsrc-test2-1980d11b5f6115f3fc1b8fd8ea7f2a52ef36f3e1.tar.gz
src-test2-1980d11b5f6115f3fc1b8fd8ea7f2a52ef36f3e1.zip
Notes
-rw-r--r--etc/rc.subr21
-rw-r--r--share/examples/csh/dot.cshrc2
-rw-r--r--share/man/man8/rc.84
3 files changed, 23 insertions, 4 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index cdec9a245481..d04e25371c16 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -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
diff --git a/share/examples/csh/dot.cshrc b/share/examples/csh/dot.cshrc
index e9f0b38e1769..62d7e5d5a290 100644
--- a/share/examples/csh/dot.cshrc
+++ b/share/examples/csh/dot.cshrc
@@ -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 \
diff --git a/share/man/man8/rc.8 b/share/man/man8/rc.8
index 5d296cd1096e..6215bf8600aa 100644
--- a/share/man/man8/rc.8
+++ b/share/man/man8/rc.8
@@ -323,6 +323,10 @@ If the script starts a process (rather than performing a one-off
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.