summaryrefslogtreecommitdiff
path: root/usr.sbin/rcctl
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2016-06-19 15:00:38 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2016-06-19 15:00:38 +0000
commit6af65dfd64203d8df1a88df379cb02aa4b9c4a03 (patch)
tree031831bd5b861add21fb5d1804443cdb2fe4a6ec /usr.sbin/rcctl
parent9c1294ee34bff437d6df6461c8d45f091897e804 (diff)
Replace some expensive evals.
Diffstat (limited to 'usr.sbin/rcctl')
-rw-r--r--usr.sbin/rcctl/rcctl.sh29
1 files changed, 19 insertions, 10 deletions
diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh
index b66a26dea90..48d250bdeed 100644
--- a/usr.sbin/rcctl/rcctl.sh
+++ b/usr.sbin/rcctl/rcctl.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: rcctl.sh,v 1.101 2016/06/19 11:32:25 ajacoutot Exp $
+# $OpenBSD: rcctl.sh,v 1.102 2016/06/19 15:00:37 ajacoutot Exp $
#
# Copyright (c) 2014, 2015 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -150,13 +150,16 @@ svc_is_base()
local _svc=$1
[ -n "${_svc}" ] || return
- local _cached=$(eval echo \${cached_svc_is_base_${_svc}})
+ local _cached _ret
+
+ _cached=$(eval echo \${cached_svc_is_base_${_svc}})
[ "${_cached}" ] && return "${_cached}"
grep -qw "^${_svc}_flags" /etc/rc.conf
+ _ret=$?
- eval cached_svc_is_base_${_svc}=$?
- eval return \${cached_svc_is_base_${_svc}}
+ set -A cached_svc_is_base_${_svc} -- ${_ret}
+ return ${_ret}
}
svc_is_meta()
@@ -164,13 +167,16 @@ svc_is_meta()
local _svc=$1
[ -n "${_svc}" ] || return
- local _cached=$(eval echo \${cached_svc_is_meta_${_svc}})
+ local _cached _ret
+
+ _cached=$(eval echo \${cached_svc_is_meta_${_svc}})
[ "${_cached}" ] && return "${_cached}"
[ -r "/etc/rc.d/${_svc}" ] && ! grep -qw "^rc_cmd" /etc/rc.d/${_svc}
+ _ret=$?
- eval cached_svc_is_meta_${_svc}=$?
- eval return \${cached_svc_is_meta_${_svc}}
+ set -A cached_svc_is_meta_${_svc} -- ${_ret}
+ return ${_ret}
}
svc_is_special()
@@ -178,13 +184,16 @@ svc_is_special()
local _svc=$1
[ -n "${_svc}" ] || return
- local _cached=$(eval echo \${cached_svc_is_special_${_svc}})
+ local _cached _ret
+
+ _cached=$(eval echo \${cached_svc_is_special_${_svc}})
[ "${_cached}" ] && return "${_cached}"
echo ${_special_svcs} | grep -qw -- ${_svc}
+ _ret=$?
- eval cached_svc_is_special_${_svc}=$?
- eval return \${cached_svc_is_special_${_svc}}
+ set -A cached_svc_is_special_${_svc} -- ${_ret}
+ return ${_ret}
}
svc_ls()