diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc index 044fdc392d6..01ea31f8115 100644 --- a/usr.sbin/sysrc/sysrc +++ b/usr.sbin/sysrc/sysrc @@ -37,6 +37,11 @@ BSDCFG_SHARE="/usr/share/bsdconfig" ############################################################ GLOBALS +# +# Version information +# +SYSRC_VERSION="6.0 Nov-07,2013" + # # Options # @@ -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 b5671a0a59f..0a4aace2e86 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