From c3755aa30cbddc30cbdc26707aac2606e9cd6ec5 Mon Sep 17 00:00:00 2001 From: Devin Teske Date: Tue, 14 May 2013 03:21:13 +0000 Subject: [PATCH] Centralize standard getopts arguments, both for convenience and to correct a bug in which certain combinations of arguments produced unexpected results such as `-dX' (now properly produces debugging and X11), `-XS' (now properly produces X11 in secure mode), `-df-' (enables debugging when reading a script from standard-input, etc. Multi-word variations such as `-d -X', `-X -S', `-d -f-', `-d -f -', etc. also work as expected. Also tested were variations in argument order, which are now working as expected. --- usr.sbin/bsdconfig/bsdconfig | 2 +- usr.sbin/bsdconfig/console/console | 2 +- usr.sbin/bsdconfig/console/font | 2 +- usr.sbin/bsdconfig/console/keymap | 2 +- usr.sbin/bsdconfig/console/repeat | 2 +- usr.sbin/bsdconfig/console/saver | 2 +- usr.sbin/bsdconfig/console/screenmap | 2 +- usr.sbin/bsdconfig/console/ttys | 2 +- usr.sbin/bsdconfig/diskmgmt/diskmgmt | 2 +- usr.sbin/bsdconfig/docsinstall/docsinstall | 2 +- usr.sbin/bsdconfig/mouse/disable | 2 +- usr.sbin/bsdconfig/mouse/enable | 2 +- usr.sbin/bsdconfig/mouse/flags | 2 +- usr.sbin/bsdconfig/mouse/mouse | 2 +- usr.sbin/bsdconfig/mouse/port | 2 +- usr.sbin/bsdconfig/mouse/type | 2 +- usr.sbin/bsdconfig/networking/defaultrouter | 2 +- usr.sbin/bsdconfig/networking/devices | 2 +- usr.sbin/bsdconfig/networking/hostname | 2 +- usr.sbin/bsdconfig/networking/nameservers | 2 +- usr.sbin/bsdconfig/networking/networking | 2 +- usr.sbin/bsdconfig/packages/packages | 2 +- usr.sbin/bsdconfig/password/password | 2 +- usr.sbin/bsdconfig/security/kern_securelevel | 2 +- usr.sbin/bsdconfig/security/security | 2 +- usr.sbin/bsdconfig/share/common.subr | 16 +++++++++++++++- usr.sbin/bsdconfig/share/dialog.subr | 20 ++++++++++++++++---- usr.sbin/bsdconfig/startup/misc | 2 +- usr.sbin/bsdconfig/startup/rcadd | 2 +- usr.sbin/bsdconfig/startup/rcconf | 2 +- usr.sbin/bsdconfig/startup/rcdelete | 2 +- usr.sbin/bsdconfig/startup/rcedit | 2 +- usr.sbin/bsdconfig/startup/rcvar | 2 +- usr.sbin/bsdconfig/startup/startup | 2 +- usr.sbin/bsdconfig/timezone/timezone | 2 +- usr.sbin/bsdconfig/ttys/ttys | 2 +- usr.sbin/bsdconfig/usermgmt/groupadd | 2 +- usr.sbin/bsdconfig/usermgmt/groupdel | 2 +- usr.sbin/bsdconfig/usermgmt/groupedit | 2 +- usr.sbin/bsdconfig/usermgmt/useradd | 2 +- usr.sbin/bsdconfig/usermgmt/userdel | 2 +- usr.sbin/bsdconfig/usermgmt/useredit | 2 +- usr.sbin/bsdconfig/usermgmt/usermgmt | 2 +- 43 files changed, 72 insertions(+), 46 deletions(-) diff --git a/usr.sbin/bsdconfig/bsdconfig b/usr.sbin/bsdconfig/bsdconfig index 419d79fb950..90fcf86d95c 100755 --- a/usr.sbin/bsdconfig/bsdconfig +++ b/usr.sbin/bsdconfig/bsdconfig @@ -239,7 +239,7 @@ fi # Process command-line arguments # scripts_loaded=0 -while getopts dD:f:hSX flag; do +while getopts f:h$GETOPTS_STDARGS flag; do case "$flag" in f) [ $scripts_loaded -eq 0 ] && f_include $BSDCFG_SHARE/script.subr f_script_load "$OPTARG" diff --git a/usr.sbin/bsdconfig/console/console b/usr.sbin/bsdconfig/console/console index e2387f5f552..e4d978c3928 100755 --- a/usr.sbin/bsdconfig/console/console +++ b/usr.sbin/bsdconfig/console/console @@ -95,7 +95,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/console/font b/usr.sbin/bsdconfig/console/font index 9363ffd667a..57af2e838bf 100755 --- a/usr.sbin/bsdconfig/console/font +++ b/usr.sbin/bsdconfig/console/font @@ -119,7 +119,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/console/keymap b/usr.sbin/bsdconfig/console/keymap index e343db9ef60..e5f6462c4d2 100755 --- a/usr.sbin/bsdconfig/console/keymap +++ b/usr.sbin/bsdconfig/console/keymap @@ -217,7 +217,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/console/repeat b/usr.sbin/bsdconfig/console/repeat index b426d3690a7..544731581fb 100755 --- a/usr.sbin/bsdconfig/console/repeat +++ b/usr.sbin/bsdconfig/console/repeat @@ -99,7 +99,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/console/saver b/usr.sbin/bsdconfig/console/saver index bea046e826a..fa3bffe154d 100755 --- a/usr.sbin/bsdconfig/console/saver +++ b/usr.sbin/bsdconfig/console/saver @@ -118,7 +118,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/console/screenmap b/usr.sbin/bsdconfig/console/screenmap index 17de3564ff0..643e671b614 100755 --- a/usr.sbin/bsdconfig/console/screenmap +++ b/usr.sbin/bsdconfig/console/screenmap @@ -103,7 +103,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/console/ttys b/usr.sbin/bsdconfig/console/ttys index ad7a9c44818..77d5f1bada8 100755 --- a/usr.sbin/bsdconfig/console/ttys +++ b/usr.sbin/bsdconfig/console/ttys @@ -163,7 +163,7 @@ ttys_set_type() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/diskmgmt/diskmgmt b/usr.sbin/bsdconfig/diskmgmt/diskmgmt index b8b97dccbeb..26d39be9521 100755 --- a/usr.sbin/bsdconfig/diskmgmt/diskmgmt +++ b/usr.sbin/bsdconfig/diskmgmt/diskmgmt @@ -56,7 +56,7 @@ X11TERM_OPTS= # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/docsinstall/docsinstall b/usr.sbin/bsdconfig/docsinstall/docsinstall index 141bc7f4957..4163a4c41b6 100755 --- a/usr.sbin/bsdconfig/docsinstall/docsinstall +++ b/usr.sbin/bsdconfig/docsinstall/docsinstall @@ -56,7 +56,7 @@ X11TERM_OPTS= # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/mouse/disable b/usr.sbin/bsdconfig/mouse/disable index 2a2cfb41022..89ec1761a94 100755 --- a/usr.sbin/bsdconfig/mouse/disable +++ b/usr.sbin/bsdconfig/mouse/disable @@ -56,7 +56,7 @@ MOUSED_PIDFILE=/var/run/moused.pid # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/mouse/enable b/usr.sbin/bsdconfig/mouse/enable index 43abac5798e..d33f1196f98 100755 --- a/usr.sbin/bsdconfig/mouse/enable +++ b/usr.sbin/bsdconfig/mouse/enable @@ -56,7 +56,7 @@ MOUSED_PIDFILE=/var/run/moused.pid # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/mouse/flags b/usr.sbin/bsdconfig/mouse/flags index 0705139af03..d6f50e821a8 100755 --- a/usr.sbin/bsdconfig/mouse/flags +++ b/usr.sbin/bsdconfig/mouse/flags @@ -56,7 +56,7 @@ MOUSED_PIDFILE=/var/run/moused.pid # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/mouse/mouse b/usr.sbin/bsdconfig/mouse/mouse index b1bd9d9e63a..7c333c81f1b 100755 --- a/usr.sbin/bsdconfig/mouse/mouse +++ b/usr.sbin/bsdconfig/mouse/mouse @@ -94,7 +94,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/mouse/port b/usr.sbin/bsdconfig/mouse/port index cb4065280b4..c0bc61e0ef1 100755 --- a/usr.sbin/bsdconfig/mouse/port +++ b/usr.sbin/bsdconfig/mouse/port @@ -103,7 +103,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/mouse/type b/usr.sbin/bsdconfig/mouse/type index f76e9311726..92745c6313a 100755 --- a/usr.sbin/bsdconfig/mouse/type +++ b/usr.sbin/bsdconfig/mouse/type @@ -111,7 +111,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/networking/defaultrouter b/usr.sbin/bsdconfig/networking/defaultrouter index cc43f852231..5b8ebdc74c6 100755 --- a/usr.sbin/bsdconfig/networking/defaultrouter +++ b/usr.sbin/bsdconfig/networking/defaultrouter @@ -49,7 +49,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/networking/devices b/usr.sbin/bsdconfig/networking/devices index ae3136c9900..11614f03633 100755 --- a/usr.sbin/bsdconfig/networking/devices +++ b/usr.sbin/bsdconfig/networking/devices @@ -54,7 +54,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line options # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/networking/hostname b/usr.sbin/bsdconfig/networking/hostname index 4029d3c3468..55cc4381bde 100755 --- a/usr.sbin/bsdconfig/networking/hostname +++ b/usr.sbin/bsdconfig/networking/hostname @@ -52,7 +52,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/networking/nameservers b/usr.sbin/bsdconfig/networking/nameservers index aeda09e57fe..d1b8123552d 100755 --- a/usr.sbin/bsdconfig/networking/nameservers +++ b/usr.sbin/bsdconfig/networking/nameservers @@ -52,7 +52,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/networking/networking b/usr.sbin/bsdconfig/networking/networking index 3697f31028c..8c9468de6e6 100755 --- a/usr.sbin/bsdconfig/networking/networking +++ b/usr.sbin/bsdconfig/networking/networking @@ -91,7 +91,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/packages/packages b/usr.sbin/bsdconfig/packages/packages index 3e623434e86..8c8ccc17aae 100755 --- a/usr.sbin/bsdconfig/packages/packages +++ b/usr.sbin/bsdconfig/packages/packages @@ -55,7 +55,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/password/password b/usr.sbin/bsdconfig/password/password index f63e455acb3..e7c3180073f 100755 --- a/usr.sbin/bsdconfig/password/password +++ b/usr.sbin/bsdconfig/password/password @@ -55,7 +55,7 @@ USER_ROOT=root # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/security/kern_securelevel b/usr.sbin/bsdconfig/security/kern_securelevel index 61ad9bf0457..ca71a1e56e3 100755 --- a/usr.sbin/bsdconfig/security/kern_securelevel +++ b/usr.sbin/bsdconfig/security/kern_securelevel @@ -108,7 +108,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/security/security b/usr.sbin/bsdconfig/security/security index ba9f9e2727b..36a8aaee5e7 100755 --- a/usr.sbin/bsdconfig/security/security +++ b/usr.sbin/bsdconfig/security/security @@ -133,7 +133,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr index d92592c3092..88594b568f6 100644 --- a/usr.sbin/bsdconfig/share/common.subr +++ b/usr.sbin/bsdconfig/share/common.subr @@ -67,6 +67,16 @@ export UNAME_R="$(uname -r)" # Release Level (i.e. X.Y-RELEASE) # : ${DEBUG_SELF_INITIALIZE=1} +# +# Define standard optstring arguments that should be supported by all programs +# using this include (unless DEBUG_SELF_INITIALIZE is set to NULL to prevent +# f_debug_init() from autamatically processing "$@" for the below arguments): +# +# d Sets $debug to 1 +# D: Sets $debugFile to $OPTARG +# +GETOPTS_STDARGS="dD:" + ############################################################ FUNCTIONS # f_dprintf $fmt [ $opts ... ] @@ -102,7 +112,9 @@ f_debug_init() # set -- $ARGV local OPTIND - while getopts dD: flag > /dev/null; do + f_dprintf "f_debug_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ + "$ARGV" "$GETOPTS_STDARGS" + while getopts "$GETOPTS_STDARGS" flag > /dev/null; do case "$flag" in d) debug=1;; D) debugFile="$OPTARG";; @@ -110,6 +122,8 @@ f_debug_init() esac done shift $(( $OPTIND - 1 )) + f_dprintf "f_debug_init: debug=[%s] debugFile=[%s]" \ + "$debug" "$debugFile" # # Automagically enable debugging if debugFile is set (and non-NULL) diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr index 0f3187d21cd..294dbf09fd5 100644 --- a/usr.sbin/bsdconfig/share/dialog.subr +++ b/usr.sbin/bsdconfig/share/dialog.subr @@ -1530,25 +1530,37 @@ f_dialog_init() # eval exec $DIALOG_TERMINAL_PASSTHRU_FD\>\&1 + # + # Add `-S' and `-X' to the list of standard arguments supported by all + # + case "$GETOPTS_STDARGS" in + *SX*) : good ;; # already present + *) GETOPTS_STDARGS="${GETOPTS_STDARGS}SX" + esac + # # Process stored command-line arguments # - SECURE=$( set -- "$ARGV" - while getopts S flag > /dev/null; do + f_dprintf "f_dialog_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ + "$ARGV" "$GETOPTS_STDARGS" + SECURE=$( set -- $ARGV + while getopts "$GETOPTS_STDARGS" flag > /dev/null; do case "$flag" in S) echo 1;; \?) continue;; esac done ) - USE_XDIALOG=$( set -- "$ARGV" - while getopts SX flag > /dev/null; do + USE_XDIALOG=$( set -- $ARGV + while getopts $GETOPTS_STDARGS flag > /dev/null; do case "$flag" in S|X) echo 1;; \?) continue;; esac done ) + f_dprintf "f_dialog_init: SECURE=[%s] USE_XDIALOG=[%s]" \ + "$SECURE" "$USE_XDIALOG" # # Process `-X' command-line option diff --git a/usr.sbin/bsdconfig/startup/misc b/usr.sbin/bsdconfig/startup/misc index f0b5fb0180f..53ae2b0d5bd 100755 --- a/usr.sbin/bsdconfig/startup/misc +++ b/usr.sbin/bsdconfig/startup/misc @@ -319,7 +319,7 @@ dialog_input_value() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/startup/rcadd b/usr.sbin/bsdconfig/startup/rcadd index a3c77242729..3a4fbaadbdd 100755 --- a/usr.sbin/bsdconfig/startup/rcadd +++ b/usr.sbin/bsdconfig/startup/rcadd @@ -97,7 +97,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/startup/rcconf b/usr.sbin/bsdconfig/startup/rcconf index 45316d74f6a..4d47ea1985a 100755 --- a/usr.sbin/bsdconfig/startup/rcconf +++ b/usr.sbin/bsdconfig/startup/rcconf @@ -201,7 +201,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/startup/rcdelete b/usr.sbin/bsdconfig/startup/rcdelete index 70187747979..5a8b2114525 100755 --- a/usr.sbin/bsdconfig/startup/rcdelete +++ b/usr.sbin/bsdconfig/startup/rcdelete @@ -301,7 +301,7 @@ dialog_menu_confirm_delete() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/startup/rcedit b/usr.sbin/bsdconfig/startup/rcedit index b97211ffd98..4dea4dc96e7 100755 --- a/usr.sbin/bsdconfig/startup/rcedit +++ b/usr.sbin/bsdconfig/startup/rcedit @@ -49,7 +49,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/startup/rcvar b/usr.sbin/bsdconfig/startup/rcvar index d0268b830d8..e82a35b8b27 100755 --- a/usr.sbin/bsdconfig/startup/rcvar +++ b/usr.sbin/bsdconfig/startup/rcvar @@ -161,7 +161,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/startup/startup b/usr.sbin/bsdconfig/startup/startup index 45375fe730d..11eb9a1285e 100755 --- a/usr.sbin/bsdconfig/startup/startup +++ b/usr.sbin/bsdconfig/startup/startup @@ -92,7 +92,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/timezone/timezone b/usr.sbin/bsdconfig/timezone/timezone index 62dc7f7c040..226eef7dbf6 100755 --- a/usr.sbin/bsdconfig/timezone/timezone +++ b/usr.sbin/bsdconfig/timezone/timezone @@ -117,7 +117,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts C:dD:ehnrsSvX flag; do +while getopts C:ehnrsv$GETOPTS_STDARGS flag; do case "$flag" in C) CHROOTENV="$OPTARG";; e) TZ_OR_FAIL=1;; diff --git a/usr.sbin/bsdconfig/ttys/ttys b/usr.sbin/bsdconfig/ttys/ttys index f0c7c2a9014..64d776c7177 100755 --- a/usr.sbin/bsdconfig/ttys/ttys +++ b/usr.sbin/bsdconfig/ttys/ttys @@ -67,7 +67,7 @@ ETC_TTYS=/etc/ttys # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/usermgmt/groupadd b/usr.sbin/bsdconfig/usermgmt/groupadd index b9bfce8bd38..0eed353729f 100755 --- a/usr.sbin/bsdconfig/usermgmt/groupadd +++ b/usr.sbin/bsdconfig/usermgmt/groupadd @@ -47,7 +47,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/usermgmt/groupdel b/usr.sbin/bsdconfig/usermgmt/groupdel index ff6b702d3c8..e5a759f948e 100755 --- a/usr.sbin/bsdconfig/usermgmt/groupdel +++ b/usr.sbin/bsdconfig/usermgmt/groupdel @@ -50,7 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/usermgmt/groupedit b/usr.sbin/bsdconfig/usermgmt/groupedit index 7cd70c6d4e5..ba249c34b7e 100755 --- a/usr.sbin/bsdconfig/usermgmt/groupedit +++ b/usr.sbin/bsdconfig/usermgmt/groupedit @@ -50,7 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/usermgmt/useradd b/usr.sbin/bsdconfig/usermgmt/useradd index 1dbf0cd92e2..113caaa0676 100755 --- a/usr.sbin/bsdconfig/usermgmt/useradd +++ b/usr.sbin/bsdconfig/usermgmt/useradd @@ -47,7 +47,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/usermgmt/userdel b/usr.sbin/bsdconfig/usermgmt/userdel index 3847a1aa14a..05b160ff191 100755 --- a/usr.sbin/bsdconfig/usermgmt/userdel +++ b/usr.sbin/bsdconfig/usermgmt/userdel @@ -50,7 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/usermgmt/useredit b/usr.sbin/bsdconfig/usermgmt/useredit index 60e1476f750..60a33777e3c 100755 --- a/usr.sbin/bsdconfig/usermgmt/useredit +++ b/usr.sbin/bsdconfig/usermgmt/useredit @@ -50,7 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac diff --git a/usr.sbin/bsdconfig/usermgmt/usermgmt b/usr.sbin/bsdconfig/usermgmt/usermgmt index 3c5a5ef9c8f..06144e1561b 100755 --- a/usr.sbin/bsdconfig/usermgmt/usermgmt +++ b/usr.sbin/bsdconfig/usermgmt/usermgmt @@ -111,7 +111,7 @@ dialog_menu_main() # # Process command-line arguments # -while getopts dD:hSX flag; do +while getopts h$GETOPTS_STDARGS flag; do case "$flag" in h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; esac