aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorDevin Teske <dteske@FreeBSD.org>2012-11-16 00:59:11 +0000
committerDevin Teske <dteske@FreeBSD.org>2012-11-16 00:59:11 +0000
commit48c5129f93c5eb5419c87b08e4677d51513f1dc0 (patch)
tree05eb7aa142fea487f7e6581810ae0c52556ba52d /usr.sbin
parente1e0aa8d3e332ebe005beedef5b0d52bcead8953 (diff)
downloadsrc-48c5129f93c5eb5419c87b08e4677d51513f1dc0.tar.gz
src-48c5129f93c5eb5419c87b08e4677d51513f1dc0.zip
Replicate a feature from sysinstall documented in
stable/9/usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below): If /usr/sbin/sysinstall is linked to another filename, say `/usr/local/bin/configPackages', then the basename will be used as an implicit command name. To get a list of modules you can link to, see `bsdconfig -h' output. Approved by: adrian (co-mentor) (implicit)
Notes
Notes: svn path=/head/; revision=243112
Diffstat (limited to 'usr.sbin')
-rwxr-xr-xusr.sbin/bsdconfig/bsdconfig55
-rwxr-xr-xusr.sbin/bsdconfig/console/console2
-rwxr-xr-xusr.sbin/bsdconfig/console/font2
-rwxr-xr-xusr.sbin/bsdconfig/console/keymap2
-rwxr-xr-xusr.sbin/bsdconfig/console/repeat2
-rwxr-xr-xusr.sbin/bsdconfig/console/saver2
-rwxr-xr-xusr.sbin/bsdconfig/console/screenmap2
-rwxr-xr-xusr.sbin/bsdconfig/console/ttys2
-rwxr-xr-xusr.sbin/bsdconfig/diskmgmt/diskmgmt2
-rwxr-xr-xusr.sbin/bsdconfig/docsinstall/docsinstall2
-rwxr-xr-xusr.sbin/bsdconfig/dot/dot2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/disable2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/enable2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/flags2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/mouse2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/port2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/type2
-rwxr-xr-xusr.sbin/bsdconfig/networking/defaultrouter2
-rwxr-xr-xusr.sbin/bsdconfig/networking/devices2
-rwxr-xr-xusr.sbin/bsdconfig/networking/hostname2
-rwxr-xr-xusr.sbin/bsdconfig/networking/nameservers2
-rwxr-xr-xusr.sbin/bsdconfig/networking/networking2
-rwxr-xr-xusr.sbin/bsdconfig/password/password2
-rwxr-xr-xusr.sbin/bsdconfig/security/kern_securelevel2
-rwxr-xr-xusr.sbin/bsdconfig/security/security2
-rw-r--r--usr.sbin/bsdconfig/share/common.subr180
-rwxr-xr-xusr.sbin/bsdconfig/startup/misc2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcadd2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcconf2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcdelete2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcedit2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcvar2
-rwxr-xr-xusr.sbin/bsdconfig/startup/startup2
-rwxr-xr-xusr.sbin/bsdconfig/timezone/timezone2
-rwxr-xr-xusr.sbin/bsdconfig/ttys/ttys2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupadd2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupdel2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupedit2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupinput2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/useradd2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/userdel2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/useredit2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/userinput2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/usermgmt2
44 files changed, 216 insertions, 103 deletions
diff --git a/usr.sbin/bsdconfig/bsdconfig b/usr.sbin/bsdconfig/bsdconfig
index f80e5a90d2e8..8d8245a76410 100755
--- a/usr.sbin/bsdconfig/bsdconfig
+++ b/usr.sbin/bsdconfig/bsdconfig
@@ -202,6 +202,16 @@ dialog_menu_main()
############################################################ MAIN
#
+# If $0 is not "bsdconfig", interpret it as a keyword to a menuitem
+#
+if [ "$pgm" != "bsdconfig" ] &&
+ indexfile=$( f_index_file "$pgm" ) &&
+ cmd=$( f_index_menusel_command "$indexfile" "$pgm" )
+then
+ exec "$cmd" "$@" || exit 1
+fi
+
+#
# Process command-line arguments
#
while getopts hSX flag; do
@@ -244,51 +254,18 @@ if [ "$1" ]; then
esac
#
- # Find the INDEX (possibly i18n) claiming this keyword
+ # Find the INDEX (possibly i18n) claiming this keyword and get the
+ # command to execute from the menu_selection line.
#
- lang="${LANG:-$LC_ALL}"
- if [ "$lang" ]; then
- sel=$( grep "^menu_selection=\"$1|" */INDEX.$lang \
- 2> /dev/null | tail -1 )
-
- # Fall-back to non-i18n sources if nothing was found
- [ "$sel" ] ||
- sel=$( grep "^menu_selection=\"$1|" */INDEX | tail -1 )
- else
- sel=$( grep "^menu_selection=\"$1|" */INDEX | tail -1 )
- fi
-
- #
- # If no matches, display usage (which shows valid keywords)
- #
- if [ ! "$sel" ]; then
+ if ! { indexfile=$( f_index_file "$1" ) &&
+ cmd=$( f_index_menusel_command "$indexfile" "$1" )
+ }; then
+ # no matches, display usage (which shows valid keywords)
f_err "%s: %s: $msg_not_found\n" "$pgm" "$1"
usage
fi
- #
- # The command to execute is after the pipe-character (|) in the
- # menu_selection property of the INDEX file for the menuitem.
- #
- cmd="${sel#*|}"
- cmd="${cmd%\"}"
- if [ ! "$cmd" ]; then
- echo "$pgm: $1: $msg_not_found"
- usage
- fi
shift
-
- #
- # If the command pathname is not fully qualified fix-up/force to be
- # relative to the menuitem directory.
- #
- case "$cmd" in
- /*) : already fully qualified ;;
- *)
- dir="${sel%%/*}"
- cmd="$dir/$cmd"
- esac
-
exec $cmd ${USE_XDIALOG:+-X} "$@" || exit 1
fi
diff --git a/usr.sbin/bsdconfig/console/console b/usr.sbin/bsdconfig/console/console
index 73d9f5b186f3..8cf12b642f44 100755
--- a/usr.sbin/bsdconfig/console/console
+++ b/usr.sbin/bsdconfig/console/console
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/font b/usr.sbin/bsdconfig/console/font
index 2fe46110bd8a..5346dd27cf0e 100755
--- a/usr.sbin/bsdconfig/console/font
+++ b/usr.sbin/bsdconfig/console/font
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/keymap b/usr.sbin/bsdconfig/console/keymap
index ea1de2db919b..98a253ca1d0c 100755
--- a/usr.sbin/bsdconfig/console/keymap
+++ b/usr.sbin/bsdconfig/console/keymap
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/console/repeat b/usr.sbin/bsdconfig/console/repeat
index 76d60d119105..820b0b449175 100755
--- a/usr.sbin/bsdconfig/console/repeat
+++ b/usr.sbin/bsdconfig/console/repeat
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/saver b/usr.sbin/bsdconfig/console/saver
index 0ec332ca8790..5313265a1a80 100755
--- a/usr.sbin/bsdconfig/console/saver
+++ b/usr.sbin/bsdconfig/console/saver
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/screenmap b/usr.sbin/bsdconfig/console/screenmap
index bdabe6ada8e3..99fa7adb0885 100755
--- a/usr.sbin/bsdconfig/console/screenmap
+++ b/usr.sbin/bsdconfig/console/screenmap
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/ttys b/usr.sbin/bsdconfig/console/ttys
index fcf45efe63b6..2d39a4cd3bde 100755
--- a/usr.sbin/bsdconfig/console/ttys
+++ b/usr.sbin/bsdconfig/console/ttys
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/diskmgmt/diskmgmt b/usr.sbin/bsdconfig/diskmgmt/diskmgmt
index aab901f78b55..9cb5e09a62e2 100755
--- a/usr.sbin/bsdconfig/diskmgmt/diskmgmt
+++ b/usr.sbin/bsdconfig/diskmgmt/diskmgmt
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="050.diskmgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/docsinstall/docsinstall b/usr.sbin/bsdconfig/docsinstall/docsinstall
index d6fe2d2e515d..00aff614b06f 100755
--- a/usr.sbin/bsdconfig/docsinstall/docsinstall
+++ b/usr.sbin/bsdconfig/docsinstall/docsinstall
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="020.docsinstall"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/dot/dot b/usr.sbin/bsdconfig/dot/dot
index 1a9032471f27..77a34a18d3e8 100755
--- a/usr.sbin/bsdconfig/dot/dot
+++ b/usr.sbin/bsdconfig/dot/dot
@@ -35,7 +35,7 @@ BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="dot"
f_include_lang $BSDCFG_LIBE/include/messages.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/mouse/disable b/usr.sbin/bsdconfig/mouse/disable
index 099cf31b1acb..d49cb50c8d88 100755
--- a/usr.sbin/bsdconfig/mouse/disable
+++ b/usr.sbin/bsdconfig/mouse/disable
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/mouse/enable b/usr.sbin/bsdconfig/mouse/enable
index e1cf7962d6d2..6f3d5ac316f9 100755
--- a/usr.sbin/bsdconfig/mouse/enable
+++ b/usr.sbin/bsdconfig/mouse/enable
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/mouse/flags b/usr.sbin/bsdconfig/mouse/flags
index c98904814279..21478decc01f 100755
--- a/usr.sbin/bsdconfig/mouse/flags
+++ b/usr.sbin/bsdconfig/mouse/flags
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/mouse/mouse b/usr.sbin/bsdconfig/mouse/mouse
index 911ea954ee56..17cd846998c3 100755
--- a/usr.sbin/bsdconfig/mouse/mouse
+++ b/usr.sbin/bsdconfig/mouse/mouse
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/mouse/port b/usr.sbin/bsdconfig/mouse/port
index 4ab54a7adecb..e14bf0a332a5 100755
--- a/usr.sbin/bsdconfig/mouse/port
+++ b/usr.sbin/bsdconfig/mouse/port
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/mouse/type b/usr.sbin/bsdconfig/mouse/type
index f1e88fb49e6b..e4f99bec1734 100755
--- a/usr.sbin/bsdconfig/mouse/type
+++ b/usr.sbin/bsdconfig/mouse/type
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/networking/defaultrouter b/usr.sbin/bsdconfig/networking/defaultrouter
index c2375b33c807..cc9902db747d 100755
--- a/usr.sbin/bsdconfig/networking/defaultrouter
+++ b/usr.sbin/bsdconfig/networking/defaultrouter
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/networking/routing.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/networking/devices b/usr.sbin/bsdconfig/networking/devices
index c7c550fe21da..1386e01ee641 100755
--- a/usr.sbin/bsdconfig/networking/devices
+++ b/usr.sbin/bsdconfig/networking/devices
@@ -41,7 +41,7 @@ f_include $BSDCFG_SHARE/networking/netmask.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/networking/hostname b/usr.sbin/bsdconfig/networking/hostname
index 32679b456d21..db056784c0e4 100755
--- a/usr.sbin/bsdconfig/networking/hostname
+++ b/usr.sbin/bsdconfig/networking/hostname
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/networking/hostname.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/networking/nameservers b/usr.sbin/bsdconfig/networking/nameservers
index 13cdf517fb83..c9b30048576e 100755
--- a/usr.sbin/bsdconfig/networking/nameservers
+++ b/usr.sbin/bsdconfig/networking/nameservers
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/networking/resolv.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/networking/networking b/usr.sbin/bsdconfig/networking/networking
index fe3ce1b2242c..fae5c9fdb6db 100755
--- a/usr.sbin/bsdconfig/networking/networking
+++ b/usr.sbin/bsdconfig/networking/networking
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/password/password b/usr.sbin/bsdconfig/password/password
index 7a439e62341d..c060b50ded8f 100755
--- a/usr.sbin/bsdconfig/password/password
+++ b/usr.sbin/bsdconfig/password/password
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/password/password.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="040.password"
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/security/kern_securelevel b/usr.sbin/bsdconfig/security/kern_securelevel
index 1bb89d880062..e20e105f9593 100755
--- a/usr.sbin/bsdconfig/security/kern_securelevel
+++ b/usr.sbin/bsdconfig/security/kern_securelevel
@@ -39,7 +39,7 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
SECURELEVEL_HELPFILE=$BSDCFG_LIBE/$APP_DIR/include/securelevel.hlp
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/security/security b/usr.sbin/bsdconfig/security/security
index 3dd71c56119f..1a3fefc48090 100755
--- a/usr.sbin/bsdconfig/security/security
+++ b/usr.sbin/bsdconfig/security/security
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="130.security"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr
index 46fdc6fb1000..80509391960b 100644
--- a/usr.sbin/bsdconfig/share/common.subr
+++ b/usr.sbin/bsdconfig/share/common.subr
@@ -271,50 +271,186 @@ f_usage()
exit $FAILURE
}
-# f_index_menu_selection $file $pgm
+# f_index_file $keyword
+#
+# Process all INDEX files known to bsdconfig and return the path to first file
+# containing a menu_selection line with a keyword portion matching $keyword.
+#
+# If $LANG or $LC_ALL (in order of preference, respectively) is set,
+# "INDEX.encoding" files will be searched first.
+#
+# If no file is found, error status is returned along with the NULL string.
+#
+# This function is a two-parter. Below is the awk(1) portion of the function,
+# afterward is the sh(1) function which utilizes the below awk script.
+#
+f_index_file_awk='
+# Variables that should be defined on the invocation line:
+# -v keyword="keyword"
+BEGIN { found = 0 }
+( $0 ~ "^menu_selection=\"" keyword "\\|" ) {
+ print FILENAME
+ found++
+ exit
+}
+END { exit ! found }
+'
+f_index_file()
+{
+ local keyword="$1"
+ local lang="${LANG:-$LC_ALL}"
+
+ f_dprintf "lang=[$lang]"
+
+ if [ "$lang" ]; then
+ awk -v keyword="$keyword" "$f_index_file_awk" \
+ $BSDCFG_LIBE${BSDCFG_LIBE:+/}*/INDEX.$lang &&
+ return
+ # No match, fall-thru to non-i18n sources
+ fi
+ awk -v keyword="$keyword" "$f_index_file_awk" \
+ $BSDCFG_LIBE${BSDCFG_LIBE:+/}*/INDEX
+}
+
+# f_index_menusel_keyword $indexfile $pgm
+#
+# Process $indexfile and return only the keyword portion of the menu_selection
+# line with a command portion matching $pgm.
#
-# Process $file looking for $menu_selection values that correspond to $pgm.
# This function is for internationalization (i18n) mapping of the on-disk
# scriptname ($pgm) into the localized language (given language-specific
-# $file). If $LANG or $LC_ALL (in orderder of preference, respectively) is set,
-# ".encoding" will automatically be appended as a suffix to the provided $file
-# pathname.
+# $indexfile). If $LANG or $LC_ALL (in orderder of preference, respectively) is
+# set, ".encoding" will automatically be appended as a suffix to the provided
+# $indexfile pathname.
#
-# If, within $file, multiple $menu_selection values map to $pgm, only the first
-# one will be returned. If no mapping can be made, the NULL string is returned.
+# If, within $indexfile, multiple $menu_selection values map to $pgm, only the
+# first one will be returned. If no mapping can be made, the NULL string is
+# returned.
#
-# If $file does not exist, error status is returned along with the NULL string.
+# If $indexfile does not exist, error status is returned with NULL.
#
# This function is a two-parter. Below is the awk(1) portion of the function,
# afterward is the sh(1) function which utilizes the below awk script.
#
-f_index_menusel_awk='
+f_index_menusel_keyword_awk='
# Variables that should be defined on the invocation line:
# -v pgm="program_name"
#
-( $0 ~ "^menu_selection=.*\\|" pgm "\"" ) {
- sub(/\|.*/, "")
- sub(/^menu_selection="/, "")
- print
- exit
+BEGIN {
+ prefix = "menu_selection=\""
+ plen = length(prefix)
+ found = 0
}
+{
+ if (!match($0, "^" prefix ".*\\|.*\"")) next
+
+ keyword = command = substr($0, plen + 1, RLENGTH - plen - 1)
+ sub(/^.*\|/, "", command)
+ sub(/\|.*$/, "", keyword)
+
+ if ( command == pgm )
+ {
+ print keyword
+ found++
+ exit
+ }
+}
+END { exit ! found }
'
-f_index_menu_selection()
+f_index_menusel_keyword()
{
- local file="$1" pgm="$2"
+ local indexfile="$1" pgm="$2"
local lang="${LANG:-$LC_ALL}"
f_dprintf "lang=[$lang]"
- if [ -f "$file.$lang" ]; then
- awk -v pgm="$pgm" "$f_index_menusel_awk" "$file.$lang" ||
- exit $FAILURE
- elif [ -f "$file" ]; then
- awk -v pgm="$pgm" "$f_index_menusel_awk" "$file" ||
- exit $FAILURE
+ if [ -f "$indexfile.$lang" ]; then
+ awk -v pgm="$pgm" \
+ "$f_index_menusel_keyword_awk" \
+ "$indexfile.$lang"
+ elif [ -f "$indexfile" ]; then
+ awk -v pgm="$pgm" \
+ "$f_index_menusel_keyword_awk" \
+ "$indexfile"
+ fi
+}
+
+# f_index_menusel_command $indexfile $keyword
+#
+# Process $indexfile and return only the command portion of the menu_selection
+# line with a keyword portion matching $keyword.
+#
+# This function is for mapping [possibly international] keywords into the
+# command to be executed. If $LANG or $LC_ALL (order of preference) is set,
+# ".encoding" will automatically be appended as a suffix to the provided
+# $indexfile pathname.
+#
+# If, within $indexfile, multiple $menu_selection values map to $keyword, only
+# the first one will be returned. If no mapping can be made, the NULL string is
+# returned.
+#
+# If $indexfile doesn't exist, error status is returned with NULL.
+#
+# This function is a two-parter. Below is the awk(1) portion of the function,
+# afterward is the sh(1) function which utilizes the below awk script.
+#
+f_index_menusel_command_awk='
+# Variables that should be defined on the invocation line:
+# -v key="keyword"
+#
+BEGIN {
+ prefix = "menu_selection=\""
+ plen = length(prefix)
+ found = 0
+}
+{
+ if (!match($0, "^" prefix ".*\\|.*\"")) next
+
+ keyword = command = substr($0, plen + 1, RLENGTH - plen - 1)
+ sub(/^.*\|/, "", command)
+ sub(/\|.*$/, "", keyword)
+
+ if ( keyword == key )
+ {
+ print command
+ found++
+ exit
+ }
+}
+END { exit ! found }
+'
+f_index_menusel_command()
+{
+ local indexfile="$1" keyword="$2" command
+ local lang="${LANG:-$LC_ALL}"
+
+ f_dprintf "lang=[$lang]"
+
+ if [ -f "$indexfile.$lang" ]; then
+ command=$( awk -v key="$keyword" \
+ "$f_index_menusel_command_awk" \
+ "$indexfile.$lang" ) || return $FAILURE
+ elif [ -f "$indexfile" ]; then
+ command=$( awk -v key="$keyword" \
+ "$f_index_menusel_command_awk" \
+ "$indexfile" ) || return $FAILURE
else
return $FAILURE
fi
+
+ #
+ # If the command pathname is not fully qualified fix-up/force to be
+ # relative to the $indexfile directory.
+ #
+ case "$command" in
+ /*) : already fully qualified ;;
+ *)
+ local indexdir="${indexfile%/*}"
+ [ "$indexdir" != "$indexfile" ] || indexdir="."
+ command="$indexdir/$command"
+ esac
+
+ echo "$command"
}
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/startup/misc b/usr.sbin/bsdconfig/startup/misc
index 3879c5714679..6407d08863d1 100755
--- a/usr.sbin/bsdconfig/startup/misc
+++ b/usr.sbin/bsdconfig/startup/misc
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/rcadd b/usr.sbin/bsdconfig/startup/rcadd
index 8f28840bf454..13e5fb3e9db4 100755
--- a/usr.sbin/bsdconfig/startup/rcadd
+++ b/usr.sbin/bsdconfig/startup/rcadd
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/startup/rcconf.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/rcconf b/usr.sbin/bsdconfig/startup/rcconf
index 4fb58593ebf0..34454ac9e4b3 100755
--- a/usr.sbin/bsdconfig/startup/rcconf
+++ b/usr.sbin/bsdconfig/startup/rcconf
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/startup/rcconf.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/rcdelete b/usr.sbin/bsdconfig/startup/rcdelete
index b431d884b2e0..8d29f8716923 100755
--- a/usr.sbin/bsdconfig/startup/rcdelete
+++ b/usr.sbin/bsdconfig/startup/rcdelete
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/startup/rcconf.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/rcedit b/usr.sbin/bsdconfig/startup/rcedit
index c060fcb5a277..fa432917c138 100755
--- a/usr.sbin/bsdconfig/startup/rcedit
+++ b/usr.sbin/bsdconfig/startup/rcedit
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/startup/rcedit.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/startup/rcvar b/usr.sbin/bsdconfig/startup/rcvar
index b7a52295ea1e..80971238158c 100755
--- a/usr.sbin/bsdconfig/startup/rcvar
+++ b/usr.sbin/bsdconfig/startup/rcvar
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/startup/rcvar.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/startup b/usr.sbin/bsdconfig/startup/startup
index c48176195d5f..431607cb104c 100755
--- a/usr.sbin/bsdconfig/startup/startup
+++ b/usr.sbin/bsdconfig/startup/startup
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/timezone/timezone b/usr.sbin/bsdconfig/timezone/timezone
index 02626a6e5f94..7af598a6f549 100755
--- a/usr.sbin/bsdconfig/timezone/timezone
+++ b/usr.sbin/bsdconfig/timezone/timezone
@@ -42,7 +42,7 @@ f_include $BSDCFG_SHARE/timezone/zones.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="090.timezone"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/ttys/ttys b/usr.sbin/bsdconfig/ttys/ttys
index 4e67e2c8dd1c..545cc1facbef 100755
--- a/usr.sbin/bsdconfig/ttys/ttys
+++ b/usr.sbin/bsdconfig/ttys/ttys
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="150.ttys"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/usermgmt/groupadd b/usr.sbin/bsdconfig/usermgmt/groupadd
index 7326ab3aaa8a..01fbb1e7446a 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupadd
+++ b/usr.sbin/bsdconfig/usermgmt/groupadd
@@ -35,7 +35,7 @@ f_include $BSDCFG_SHARE/dialog.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/groupdel b/usr.sbin/bsdconfig/usermgmt/groupdel
index cbbe554f3be7..5a2f1100ceb9 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupdel
+++ b/usr.sbin/bsdconfig/usermgmt/groupdel
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/group_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/groupedit b/usr.sbin/bsdconfig/usermgmt/groupedit
index 6de6fa8718e5..bb314cf826dc 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupedit
+++ b/usr.sbin/bsdconfig/usermgmt/groupedit
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/group_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/groupinput b/usr.sbin/bsdconfig/usermgmt/groupinput
index 2991d336240b..dc5585273333 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupinput
+++ b/usr.sbin/bsdconfig/usermgmt/groupinput
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/group_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/usermgmt/useradd b/usr.sbin/bsdconfig/usermgmt/useradd
index 4821ccdaff19..cc1b886da057 100755
--- a/usr.sbin/bsdconfig/usermgmt/useradd
+++ b/usr.sbin/bsdconfig/usermgmt/useradd
@@ -35,7 +35,7 @@ f_include $BSDCFG_SHARE/dialog.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/userdel b/usr.sbin/bsdconfig/usermgmt/userdel
index c530682a4288..e1a26dd5272b 100755
--- a/usr.sbin/bsdconfig/usermgmt/userdel
+++ b/usr.sbin/bsdconfig/usermgmt/userdel
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/user_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/useredit b/usr.sbin/bsdconfig/usermgmt/useredit
index a38afa203c35..40a93a823f8a 100755
--- a/usr.sbin/bsdconfig/usermgmt/useredit
+++ b/usr.sbin/bsdconfig/usermgmt/useredit
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/user_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/userinput b/usr.sbin/bsdconfig/usermgmt/userinput
index aca8aed05853..0bf8d8974c3b 100755
--- a/usr.sbin/bsdconfig/usermgmt/userinput
+++ b/usr.sbin/bsdconfig/usermgmt/userinput
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/user_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/usermgmt/usermgmt b/usr.sbin/bsdconfig/usermgmt/usermgmt
index a2e4b40f11d6..f3357d42a270 100755
--- a/usr.sbin/bsdconfig/usermgmt/usermgmt
+++ b/usr.sbin/bsdconfig/usermgmt/usermgmt
@@ -39,7 +39,7 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
USERMGMT_HELPFILE=$BSDCFG_LIBE/$APP_DIR/include/usermgmt.hlp
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS