From: ajacoutot Date: Thu, 21 Aug 2014 12:47:22 +0000 (+0000) Subject: Make "rcctl status" output match rc.conf(8) format. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c18897cf0c601c1fa9862913d4e730271f53339c;p=openbsd Make "rcctl status" output match rc.conf(8) format. ok jasper@ --- 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 .\" @@ -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 100644 --- 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 }