Changeset View
Changeset View
Standalone View
Standalone View
head/libexec/rc/rc.subr
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
PS="/bin/ps -ww" | PS="/bin/ps -ww" | ||||
JID=0 | JID=0 | ||||
# | # | ||||
# functions | # functions | ||||
# --------- | # --------- | ||||
# list_vars pattern | # list_vars pattern | ||||
# List vars matching pattern. | # List variables matching glob pattern. | ||||
# | # | ||||
list_vars() | list_vars() | ||||
{ | { | ||||
set | { while read LINE; do | # Localize 'set' option below. | ||||
var="${LINE%%=*}" | local - | ||||
case "$var" in | local IFS=$'\n' line varname | ||||
"$LINE"|*[!a-zA-Z0-9_]*) continue ;; | |||||
$1) echo $var | # Disable path expansion in unquoted 'for' parameters below. | ||||
set -o noglob | |||||
for line in $(set); do | |||||
varname="${line%%=*}" | |||||
case "$varname" in | |||||
"$line"|*[!a-zA-Z0-9_]*) | |||||
continue | |||||
;; | |||||
$1) | |||||
echo $varname | |||||
;; | |||||
esac | esac | ||||
done; } | done | ||||
} | } | ||||
# set_rcvar [var] [defval] [desc] | # set_rcvar [var] [defval] [desc] | ||||
# | # | ||||
# Echo or define a rc.conf(5) variable name. Global variable | # Echo or define a rc.conf(5) variable name. Global variable | ||||
# $rcvars is used. | # $rcvars is used. | ||||
# | # | ||||
# If no argument is specified, echo "${name}_enable". | # If no argument is specified, echo "${name}_enable". | ||||
▲ Show 20 Lines • Show All 2,086 Lines • Show Last 20 Lines |