summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysrc
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-11-07 22:52:10 +0000
committerdteske <dteske@FreeBSD.org>2013-11-07 22:52:10 +0000
commit9508d6508702030737d90721f168dae31daaa750 (patch)
treeb58448e65e9717b0527f94867cfd1ccbc6ad1c76 /usr.sbin/sysrc
parentb7b6449f7c44ef9d26c7d8dc16c309cf2f981bd1 (diff)
downloadFreeBSD-src-9508d6508702030737d90721f168dae31daaa750.zip
FreeBSD-src-9508d6508702030737d90721f168dae31daaa750.tar.gz
Add new `--version' long option for getting the version (good for
comparing against the ports revision).
Diffstat (limited to 'usr.sbin/sysrc')
-rw-r--r--usr.sbin/sysrc/sysrc16
-rw-r--r--usr.sbin/sysrc/sysrc.84
2 files changed, 16 insertions, 4 deletions
diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc
index 044fdc3..01ea31f 100644
--- a/usr.sbin/sysrc/sysrc
+++ b/usr.sbin/sysrc/sysrc
@@ -38,6 +38,11 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
############################################################ GLOBALS
#
+# Version information
+#
+SYSRC_VERSION="6.0 Nov-07,2013"
+
+#
# Options
#
DELETE=
@@ -133,6 +138,8 @@ help()
"Verbose. Print the pathname of the specific rc.conf(5)"
f_err "$optfmt" "" \
"file where the directive was found."
+ f_err "$optfmt" "--version" \
+ "Print version information to stdout and exit."
f_err "$optfmt" "-x" \
"Remove variable(s) from specified file(s)."
f_err "\n"
@@ -195,19 +202,22 @@ jail_depend()
[ $# -gt 0 ] || usage
#
-# Check for `--help' command-line option
+# Check for `--help' and `--version' command-line option
#
( # Operate in sub-shell to protect $@ in parent
while [ $# -gt 0 ]; do
case "$1" in
- --help) exit 1;;
+ --help) help ;;
+ --version) # see GLOBALS
+ echo "$SYSRC_VERSION"
+ exit 1 ;;
-[fRj]) # These flags take an argument
shift 1;;
esac
shift 1
done
exit 0
-) || help
+) || die
#
# Process command-line flags
diff --git a/usr.sbin/sysrc/sysrc.8 b/usr.sbin/sysrc/sysrc.8
index b5671a0..0a4aace 100644
--- a/usr.sbin/sysrc/sysrc.8
+++ b/usr.sbin/sysrc/sysrc.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd Jul 5, 2013
+.Dd Nov 7, 2013
.Dt SYSRC 8
.Os
.Sh NAME
@@ -112,6 +112,8 @@ Verbose.
Print the pathname of the specific
.Xr rc.conf 5
file where the directive was found.
+.It Fl -version
+Print version information to stdout and exit.
.It Fl x
Remove variable(s) from specified file(s).
.El
OpenPOWER on IntegriCloud