Don't calculate the tag until we know that we're going to make a new menu

item entry. Also join simple NULL assignments into a single line.
This commit is contained in:
Devin Teske 2013-07-05 19:57:40 +00:00
parent fe24bdd45e
commit e363bf2b1d
2 changed files with 17 additions and 8 deletions

View File

@ -170,11 +170,8 @@ dialog_menu_main()
local menuitem menu_title menu_help menu_selection index=2
for menuitem in $( cd $BSDCFG_LIBE && ls -d [0-9][0-9][0-9].* ); do
[ $index -lt ${#DIALOG_MENU_TAGS} ] || break
tag=$( f_substr "$DIALOG_MENU_TAGS" $index 1 )
menu_program=
menu_title=
menu_help=
menu_program= menu_title= menu_help=
f_include_lang $BSDCFG_LIBE/$menuitem/INDEX
[ "$menu_program" ] || continue
@ -183,9 +180,11 @@ dialog_menu_main()
*) menu_program="$menuitem/$menu_program"
esac
tag=$( f_substr "$DIALOG_MENU_TAGS" $index 1 )
setvar "menu_program$tag" "$menu_program"
f_shell_escape "$menu_title" menu_title
f_shell_escape "$menu_help" menu_help
setvar "menu_program$tag" "$menu_program"
menu_list="$menu_list '$tag' '$menu_title' '$menu_help'"
index=$(( $index + 1 ))

View File

@ -531,12 +531,22 @@ f_index_file()
if [ "$lang" ]; then
awk -v keyword="$keyword" "$f_index_file_awk" \
$BSDCFG_LIBE${BSDCFG_LIBE:+/}*/INDEX.$lang &&
return
$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
$BSDCFG_LIBE${BSDCFG_LIBE:+/}*/INDEX && return
# No match? Fall-thru to `local' libexec sources (add-on modules)
[ "$BSDCFG_LOCAL_LIBE" ] || return $FAILURE
if [ "$lang" ]; then
awk -v keyword="$keyword" "$f_index_file_awk" \
$BSDCFG_LOCAL_LIBE/*/INDEX.$lang && return
# No match, fall-thru to non-i18n sources
fi
awk -v keyword="$keyword" "$f_index_file_awk" \
$BSDCFG_LOCAL_LIBE/*/INDEX
}
# f_index_menusel_keyword $indexfile $pgm