From 9508d6508702030737d90721f168dae31daaa750 Mon Sep 17 00:00:00 2001 From: dteske Date: Thu, 7 Nov 2013 22:52:10 +0000 Subject: Add new `--version' long option for getting the version (good for comparing against the ports revision). --- usr.sbin/sysrc/sysrc | 16 +++++++++++++--- usr.sbin/sysrc/sysrc.8 | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'usr.sbin/sysrc') 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 -- cgit v1.1