Re: rcctl ls: give an argument to needs_root()

2015-08-01 Thread Antoine Jacoutot
On Sat, Aug 01, 2015 at 11:23:56AM +0200, Theo Buehler wrote:
> If the `rcctl ls' command is given an argument that requires root,
> the error message has a awkward space in front of the colon since
> no argument is passed to the needs_root() function:
> 
> $ rcctl ls started
> rcctl : need root privileges
> 
> Since this is the only place where `needs_root()' is called without an
> argument, the following seems to be more consistent with the rest of
> the script:

Right, thanks.
I will fix this and tweak the output a bit.

> Index: usr.sbin/rcctl/rcctl.sh
> ===
> RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
> retrieving revision 1.76
> diff -u -p -r1.76 rcctl.sh
> --- usr.sbin/rcctl/rcctl.sh   25 Jul 2015 04:12:43 -  1.76
> +++ usr.sbin/rcctl/rcctl.sh   1 Aug 2015 09:16:49 -
> @@ -485,7 +485,7 @@ case ${action} in
>   ;;
>   ls)
>   # some rc.d(8) scripts need root for rc_check()
> - [[ ${lsarg} == @(started|stopped|faulty) ]] && needs_root
> + [[ ${lsarg} == @(started|stopped|faulty) ]] && needs_root 
> "${action} ${lsarg}"
>   svc_ls ${lsarg}
>   ;;
>   order)
> 

-- 
Antoine



rcctl ls: give an argument to needs_root()

2015-08-01 Thread Theo Buehler
If the `rcctl ls' command is given an argument that requires root,
the error message has a awkward space in front of the colon since
no argument is passed to the needs_root() function:

$ rcctl ls started
rcctl : need root privileges

Since this is the only place where `needs_root()' is called without an
argument, the following seems to be more consistent with the rest of
the script:

Index: usr.sbin/rcctl/rcctl.sh
===
RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
retrieving revision 1.76
diff -u -p -r1.76 rcctl.sh
--- usr.sbin/rcctl/rcctl.sh 25 Jul 2015 04:12:43 -  1.76
+++ usr.sbin/rcctl/rcctl.sh 1 Aug 2015 09:16:49 -
@@ -485,7 +485,7 @@ case ${action} in
;;
ls)
# some rc.d(8) scripts need root for rc_check()
-   [[ ${lsarg} == @(started|stopped|faulty) ]] && needs_root
+   [[ ${lsarg} == @(started|stopped|faulty) ]] && needs_root 
"${action} ${lsarg}"
svc_ls ${lsarg}
;;
order)