summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysrc
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-11-07 23:04:40 +0000
committerdteske <dteske@FreeBSD.org>2013-11-07 23:04:40 +0000
commit2d50ef358e2f1e55522f33b8d5aaacab4f646706 (patch)
treea333d298816772501e03e68acf821f384c3a5db0 /usr.sbin/sysrc
parent986812ee8b9fad21d0d6907bd5ad8575b7e986bf (diff)
downloadFreeBSD-src-2d50ef358e2f1e55522f33b8d5aaacab4f646706.zip
FreeBSD-src-2d50ef358e2f1e55522f33b8d5aaacab4f646706.tar.gz
Fix a bug with `-e' that broke sometime around when I added `-F'. Also,
revamp the `-e' output to truly be sh(1) compatible syntax (even if passed in `-v' for verbose output).
Diffstat (limited to 'usr.sbin/sysrc')
-rw-r--r--usr.sbin/sysrc/sysrc27
-rw-r--r--usr.sbin/sysrc/sysrc.811
2 files changed, 25 insertions, 13 deletions
diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc
index 5255f9d..bc603b1 100644
--- a/usr.sbin/sysrc/sysrc
+++ b/usr.sbin/sysrc/sysrc
@@ -300,13 +300,14 @@ fi
# Process `-e', `-n', and `-N' command-line options
#
SEP=': '
-[ "$SHOW_EQUALS" ] && SEP='="'
+[ "$SHOW_FILE" ] && SHOW_EQUALS=
[ "$SHOW_NAME" ] || SHOW_EQUALS=
[ "$SYSRC_VERBOSE" = "0" ] && SYSRC_VERBOSE=
if [ ! "$SHOW_VALUE" ]; then
SHOW_NAME=1
SHOW_EQUALS=
fi
+[ "$SHOW_EQUALS" ] && SEP='="'
#
# Process `-j jail' and `-R dir' command-line options
@@ -545,7 +546,11 @@ while [ $# -gt 0 ]; do
file=$( f_sysrc_find "$NAME" )
[ "$file" = "$RC_DEFAULTS" -o ! "$file" ] && \
file=$( f_sysrc_get 'rc_conf_files%%[$IFS]*' )
- echo -n "$file: "
+ if [ "$SHOW_EQUALS" ]; then
+ echo -n ": $file; "
+ else
+ echo -n "$file: "
+ fi
fi
#
@@ -587,14 +592,13 @@ while [ $# -gt 0 ]; do
if f_sysrc_set "$NAME" "${1#*=}"; then
if [ "$SHOW_FILE" ]; then
after=$( f_sysrc_find "$NAME" )
- echo -n "${SHOW_NAME:+$NAME$SEP}"
- echo -n "$before${SHOW_EQUALS:+\"}"
- echo " -> $after"
else
after=$( f_sysrc_get "$NAME" )
- echo -n "${SHOW_NAME:+$NAME$SEP}"
- echo "$before -> $after"
fi
+ echo -n "${SHOW_NAME:+$NAME$SEP}"
+ echo -n "$before${SHOW_EQUALS:+\" #}"
+ echo -n " -> ${SHOW_EQUALS:+\"}$after"
+ echo "${SHOW_EQUALS:+\"}"
fi
fi
;;
@@ -642,8 +646,13 @@ while [ $# -gt 0 ]; do
continue
fi
- [ "$SYSRC_VERBOSE" ] && \
- echo -n "$( f_sysrc_find "$NAME" ): "
+ if [ "$SYSRC_VERBOSE" ]; then
+ if [ "$SHOW_EQUALS" ]; then
+ echo -n ": $( f_sysrc_find "$NAME" ); "
+ else
+ echo -n "$( f_sysrc_find "$NAME" ): "
+ fi
+ fi
#
# If `-N' is passed, simplify the output
diff --git a/usr.sbin/sysrc/sysrc.8 b/usr.sbin/sysrc/sysrc.8
index 6d53e19..67caef4 100644
--- a/usr.sbin/sysrc/sysrc.8
+++ b/usr.sbin/sysrc/sysrc.8
@@ -70,10 +70,13 @@ Show default value(s) only (this is the same as setting RC_CONFS to NULL or
passing `-f' with a NULL file-argument).
.It Fl e
Print query results as
-.Ql var=value
-.Pq useful for producing output to be fed back in .
-Ignored if
-.Fl n
+.Xr sh 1
+compatible syntax
+.Pq for example, Ql var=value .
+Ignored if either
+.Ql Fl n
+or
+.Ql Fl F
is specified.
.It Fl f Ar file
Operate on the specified file(s) instead of the files obtained by reading the
OpenPOWER on IntegriCloud