summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2014-08-21 12:47:23 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2014-08-21 12:47:23 +0000
commitca085c6139a644968809f97505ada5bc375ff2c9 (patch)
tree1f6ff6514f0b2bd68a3834fe44025a45188c62ae
parent93a39c4337d6a84042fa2e3e3ce59bb72840431f (diff)
Make "rcctl status" output match rc.conf(8) format.
ok jasper@
-rw-r--r--usr.sbin/rcctl/rcctl.88
-rwxr-xr-xusr.sbin/rcctl/rcctl.sh7
2 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/rcctl/rcctl.8 b/usr.sbin/rcctl/rcctl.8
index de103767956..c8997b49ff0 100644
--- a/usr.sbin/rcctl/rcctl.8
+++ b/usr.sbin/rcctl/rcctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rcctl.8,v 1.4 2014/08/21 10:15:11 schwarze Exp $
+.\" $OpenBSD: rcctl.8,v 1.5 2014/08/21 12:47:22 ajacoutot Exp $
.\"
.\" Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org>
.\"
@@ -64,8 +64,10 @@ Display the value of
.Ar service
or
.Ar daemon Ns _flags .
-Without an argument, list all services and daemons
-with their current status and flags.
+Without an argument, display all services and
+.Ar daemon Ns _flags
+with their values in a format compatible with
+.Xr rc.conf 8 .
.It Ar action daemon
Run the
.Xr rc.d 8
diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh
index b70f3f4523c..2e351fc4ddb 100755
--- a/usr.sbin/rcctl/rcctl.sh
+++ b/usr.sbin/rcctl/rcctl.sh
@@ -103,16 +103,15 @@ svc_get_flags()
svc_get_status()
{
- local _svc=$1
+ local _affix _svc=$1
if [ -n "${_svc}" ]; then
svc_get_flags ${_svc} | sed '/^$/d'
svc_is_enabled ${_svc}
else
for _i in $(svc_get_all); do
- printf "%18s" ${_i}
- echo -n "\tflags="
- svc_get_flags ${_i}
+ svc_is_special ${_i} && unset _affix || _affix="_flags"
+ echo "${_i}${_affix}=$(svc_get_flags ${_i})"
done
fi
}