Add new `--version' long option for getting the version (good for

comparing against the ports revision).
This commit is contained in:
Devin Teske 2013-11-07 22:52:10 +00:00
parent ed39dd91b1
commit 3e74984c3a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257826
2 changed files with 16 additions and 4 deletions

View File

@ -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

View File

@ -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