freebsd-nq/usr.sbin/bsdconfig
Devin Teske 5b4765c331 Fix option processing from the library layer to address unexpected
behavior(s); e.g., `-Xd' versus `-dX' did not produce the same results.

The libraries common.subr and dialog.subr automatically process the
arguments passed to the program and enable/disable functionality without the
need to process the arguments within your program. For example, if "$@"
contains `-d', common.subr will see this and enable debugging regardless of
whether you process "$@" yourself or not (this automatic processing can
easily be disabled for custom scripts that don't want it; see the afore-
mentioned scripts for additional details).

NOTE: common.subr stores a copy of "$@" in $ARGV for convenient (and
repeated) processing by libraries such as dialog.subr which provide such
transparent functionality for the consuming script(s).

However, the libraries don't know if a program wants to accept `extra'
options. Flags are not really a problem, because the library can be
programmed to silently ignore unknown flags. The trouble comes into play
when the program wants to define an option that takes an argument.

For example:

	bsdconfig -D logfile -X

In the above example, the library uses getopts to process $ARGV and if it
doesn't know that `-D' takes an argument, the option processing will
prematurely terminate on `logfile' (this is standard/correct behavior for
getopts but is undesired in our situation where we have partially off-loaded
main argument processing).

The problem is solved by allowing the program to define an extra set of
options to be included in each library's handling of $ARGV. Only options
that require arguments are truly necessary to be pre-specified in this new
manner.
2013-06-02 22:04:39 +00:00
..
console Standardize the way functions build their arguments leading up to a dialog 2013-06-02 20:02:50 +00:00
diskmgmt Centralize standard getopts arguments, both for convenience and to correct 2013-05-14 03:21:13 +00:00
docsinstall Centralize standard getopts arguments, both for convenience and to correct 2013-05-14 03:21:13 +00:00
dot Explicitly track "script.subr" which wasn't showing up in the graph because 2013-05-07 04:47:56 +00:00
examples Improve the debugging abilities and clean up debug messages. In most cases, 2012-12-21 19:26:17 +00:00
include Fix i18n violations in the package management module. A few words like 2013-05-12 00:46:18 +00:00
mouse Standardize the way functions build their arguments leading up to a dialog 2013-06-02 20:02:50 +00:00
networking Standardize the way functions build their arguments leading up to a dialog 2013-06-02 20:02:50 +00:00
packages Centralize standard getopts arguments, both for convenience and to correct 2013-05-14 03:21:13 +00:00
password Standardize the way functions build their arguments leading up to a dialog 2013-06-02 20:02:50 +00:00
security Standardize the way functions build their arguments leading up to a dialog 2013-06-02 20:02:50 +00:00
share Fix option processing from the library layer to address unexpected 2013-06-02 22:04:39 +00:00
startup Standardize the way functions build their arguments leading up to a dialog 2013-06-02 20:02:50 +00:00
timezone Standardize the way functions build their arguments leading up to a dialog 2013-06-02 20:02:50 +00:00
ttys Centralize standard getopts arguments, both for convenience and to correct 2013-05-14 03:21:13 +00:00
usermgmt Standardize the way functions build their arguments leading up to a dialog 2013-06-02 20:02:50 +00:00
bsdconfig Fix option processing from the library layer to address unexpected 2013-06-02 22:04:39 +00:00
bsdconfig.8 Update copyrights and dates following last commit. 2013-01-06 18:18:09 +00:00
Makefile Commit first portion of package module -- this includes the ability to view 2013-05-07 05:40:20 +00:00
USAGE Add new flags -d' (sets debug=1) and -D file' (sets debugFile) and 2013-04-22 05:02:34 +00:00