awk -v CMDFILE="uucp_commands" '# invoke -- menu-based
# command generator
# first line in CMDFILE is the title of the menu
# subsequent lines contain: $1 - Description;
# $2 Command to execute
BEGIN { FS = ":"
# process CMDFILE, reading items into menu array
if ((getline < CMDFILE) > 0)
title = $1
else
exit 1
while ((getline < CMDFILE) > 0) {
# load array
++sizeOfArray
# array of menu items
menu[sizeOfArray] = $1
# array of commands associated with items
command[sizeOfArray] = $2
}
# call function to display menu items and prompt
display_menu()
}
# Applies the user response to prompt
{
# test value of user response
if ($1 > 0 && $1 <= sizeOfArray) {
# print command that is executed
printf("Executing ... %s\n", command[$1])
# then execute it.
system(command[$1])
printf("
This HTML Help has been published using the chm2web software.