Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108000409
D18481.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
805 B
Referenced Files
None
Subscribers
None
D18481.diff
View Options
Index: head/libexec/rc/rc.subr
===================================================================
--- head/libexec/rc/rc.subr
+++ head/libexec/rc/rc.subr
@@ -58,17 +58,29 @@
# ---------
# list_vars pattern
-# List vars matching pattern.
+# List variables matching glob pattern.
#
list_vars()
{
- set | { while read LINE; do
- var="${LINE%%=*}"
- case "$var" in
- "$LINE"|*[!a-zA-Z0-9_]*) continue ;;
- $1) echo $var
+ # Localize 'set' option below.
+ local -
+ local IFS=$'\n' line varname
+
+ # 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
- done; }
+ done
}
# set_rcvar [var] [defval] [desc]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 21, 9:30 AM (21 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16006472
Default Alt Text
D18481.diff (805 B)
Attached To
Mode
D18481: rc.subr: Implement list_vars without using 'read'
Attached
Detach File
Event Timeline
Log In to Comment