menu - display menu on terminal


menu [-b] [-k] [-m] [-p] [-s] [-f firstmenu ] menufile


Menu displays a menu on the terminal screen. The menu displayed is described by the contents of the menufile argument. If menufile is specified as -, the menu description is read from standard input. If the -p flag is specified and the menufile is not found, menu will additionally look for the menufile in the C/Base administrative directory (e.g. \cbase\lib\cbase\menufile, see cbasedir(C-3).

If the menufile contains more than one menu description, -f firstmenu specifies the name of the first menu to display. The default is to display the first menu description in the file.

The -k flag allows the user to terminate a session immediately by using the INTERRUPT key. This flag is useful for debugging new menus.

The -b flag allows the operator to enter and execute any Dos command from within the menu by entering an exclamation point followed by the command to execute.

The -m flag enables the built-in menu commands that can be used in menufile. Built-in menu commands are disabled by default. The -m flag is ignored if the menufile explicitly enables or disables built-in menu commands.

The -s flag specifies that the menufile is to be run as a script. A script contains only menufile commands. No menu descriptions are displayed nor are menu descriptions described in the menufile. After running the commands, menu exits.

Menu selection is done by moving the menu cursor to a particular menu choice and pressing the RETURN key. The menu cursor is terminal dependent. For terminals that have inverse video the menu cursor highlights the selected choice. On terminals without inverse video, the current choice is surrounded by parentheses.

The menu cursor can be moved in several ways. The arrow keys move the cursor in the direction of the arrow. The SPACE key moves the cursor down one choice. As an alternative to the arrow keys, the first word of a choice may be typed to move the menu cursor to the choice.

To move the menu cursor up or down with the arrow keys, there must be another menu choice in the same column as the current choice. To move the menu cursor left or right using the arrow keys, there must be another menu choice in the same row as the current choice.

After a menu choice is selected with the RETURN key, the terminal screen is cleared and the menu choice is shown at the top of the screen. The command(s) associated with the choice are then executed. After the command has finished, the terminal screen is cleared again and the menu is redisplayed with the menu cursor on the last selected choice.

The menufile argument names a text file that contains a sequence of menu definitions and parameter form definitions. With the -s flag omitted, a menufile must contain at least one menu definition. See Chapter 8, Creating Menus for information about menufiles.



Chapter 8, Creating Menus.