The form description file consists of a number of keywords, each denoting the start of a new section of the form. For example, there is a keyword .top which specifies that the text that follows will be placed at the top of the screen. The text in each section of the form description file can be hard-coded in the form description file, or it may be redirected from a file or command.
System Installation
).
Load Floppy Disk
).
Enter A Value
).
Del=Cancel F1=Help
).
Esc=Quit help Del=Cancel F1=Instructions 1=Page down 2=Page up
).
Esc=Quit instructions Del=Cancel 1=Page down 2=Page up
).
This string is displayed at the top of a help screen: the specification would look like Page %d of %d. See fprintf(3S) for details.
Your options are:
.
Enter a number between %d
and %d:
.
See
fprintf(3S)
for details.
More can be defined in a numbered menu than is shown in this example, (see the complete list of keywords under ``Keywords'') but the following lines in a form description file would be sufficient to produce this menu:
.optstring What type of mouse is attached to your system? .form Serial mouse Bus mouse PS/2-Compatible mouse No mouse .selection Type a number between %d and %d followed by ENTER (or <Return>):The keyword .optstring causes the following line of text to be displayed one space above the numbered choices in the numbered menu. This is useful for an introduction to the list of choices, such as
What type of mouse is attached to your system?
.
The keyword .form, when followed by lines of plain text, causes each line following the keyword to be displayed as a numbered choice in the menu. The complete list is automatically followed by an input field.
The keyword .selection specifies a string that is displayed just below the last entry in a numbered menu, and just to the left of the input field that is displayed automatically following a numbered menu. The string following the .selection keyword is a format statement for an sprintf(3S) statement, and will accept two integers as arguments; the first number (always 1) and the last number of the items on the menu.
The user can exit a numbered menu in either of two ways; first, by interrupting the execution with a SIGINTR (for example, by pressing the DELETE key); and second, by entering a valid number in the input field. If the user enters an invalid number, or makes some other typing mistake, an error bar is displayed on the screen. The user can then erase the field with the backspace key and retype the value.
At exit from a numbered menu, the output file looks like this:
RETURN_VALUE="
n``"''
where n is the number entered by the user.
More can be defined in a form than is shown in this example,
(see the complete list of keywords under ``Keywords'')
but the following lines in a form description file would
be sufficient to produce this form:
.form
5 0 30//[A-z0-9 ]*//First and last name://USERNAME//
//Enter the first and last name of the user being added//
5 0 8//[A-z0-9 ]*//Login name://LOGNAME//
//Enter the login name of the user being added (max 8 chars)//
1 3 100 1024//ID number://USERID//
//Enter the user ID of the user being added (100-1024)//
5 0 30//[A-z0-9/]*//Home directory://HOMEDIR//
//Enter the home directory of the user being added//
.button
Apply
Reset
Specifying a form is more complex than specifying a numbered menu. Each form field takes two lines in the form description file, in the format:
field_type arg [arg ...]//string/string//...//ENVIRONMENT_VARIABLE// //More detailed instruction for field//where field_type can be one of six types. The format for specifying each follows.
Where min is the minimum length string to be accepted as input from the user, and max is the maximum length string to be accepted, and ENVIRONMENT_VARIABLE is the environment variable that will, in the output file, be assigned the value entered in this field.
1 min max//ENVIRONMENT_VARIABLE //Detailed description of what to enter//Where min is the minimum length string to be accepted as input from the user, and max is the maximum length string to be accepted, and ENVIRONMENT_VARIABLE is the environment variable that will, in the output file, be assigned the value entered in this field.
2 num//TAG::string1//...//TAG::stringnum //Field label//ENVIRONMENT_VARIABLE //Right/Left arrow keys for new choice (num choices)//Where num is the number of choices to be enumerated for user selection in this field. For each of the num choices, there is a TAG::string pair, where the field will display string on the screen, and ENVIRONMENT_VARIABLE is the environment variable that will, in the output file, be assigned the TAG associated with the string selected in this field. TAG is a label associated with a string in a form that a shell script displaying a menu can use to make its decision. Thus, the shell script does not need to change if the string is translated to another language.
3 precision min max//ENVIRONMENT_VARIABLE //Detailed description of what to enter//Where min is the minimum length string to be accepted as input from the user, and max is the maximum length string to be accepted, precision is the width for left padding with zeros, and ENVIRONMENT_VARIABLE is the environment variable that will, in the output file, be assigned the value entered in this field.
4 min max precision//ENVIRONMENT_VARIABLE //Detailed description of what to enter//Where min is the minimum length string to be accepted as input from the user, and max is the maximum length string to be accepted, precision is the number of digits to the right of the decimal point, and ENVIRONMENT_VARIABLE is the environment variable that will, in the output file, be assigned the value entered in this field.
5 min max//regexp//ENVIRONMENT_VARIABLE //Detailed description of what to enter//Where min is the minimum length string to be accepted as input from the user, and max is the maximum length string to be accepted, regexp is the ed(1) style regular expression to validate the input against, and ENVIRONMENT_VARIABLE is the environment variable that will, in the output file, be assigned the value entered in this field.
The keyword .button specifies the labels for the Radio Buttons at the bottom of the form. The text following this keyword should generally be the same as is shown the example, as the actions these buttons generate are to apply the current selection and move on, or to reset the form's fields to their values at invocation.
To navigate in a form, the user presses the TAB key to move to the next field or the BACKTAB (shifted TAB) key to move to the previous field. For all types of fields except the TYPE_ENUM type, the input field is shown in inverse-video, When the cursor is positioned in a field, the user can type a value in the inverse-video area. In TYPE_ENUM fields, the first choice is already displayed in the field, in bright video. The user can cause the next choice to be displayed in the field. by pressing the left or right arrow key (or the '-' or '+' keys). The user can select the choice currently displayed, and move on to the next field, by pressing ENTER or TAB.
When the form is filled out to the user's satisfaction, the user then presses the TAB key to move to the Apply Radio Button, and presses ENTER to apply the choices filled out in the form fields. A user cannot exit from a form screen until the Apply button is ``pressed'' (or menu is interrupted).
After the form has been filled out, a user can reset the form to its state when first displayed by pressing the TAB key to move to the Reset Radio Button, and then pressing ENTER.
Press ENTER (or <Return>) to continue: _More can be defined in an information screen than is shown in this example, (see the complete list of keywords under ``Keywords'') but the following lines in a form description file would be sufficient to produce this information screen:
.selection
Press ENTER (or <Return>) to continue:
.form
ENTER
If a .form section is specified and just contains the string ENTER, then the string specified in the section delineated by the .selection keyword is displayed near the bottom of the screen, and the cursor is placed to the right of that string.
If no .form section is specified, then the behavior will
be similar, that is, the user must press ENTER or <Return> to exit
the menu tool (or interrupt its execution).
The only difference is that if no .form section is specified
and the -r command-line option is specified,
then menu exits (it does not wait for input from the user),
the "Working..." message flashes at the bottom of the screen,
and the screen is not cleared.
This would typically be used, for instance, to announce something
that is going to take some processing time (such as a kernel rebuild),
where the user does not need to press any key to start the processing.
|----------------------------------------------------------| |Operating System Installation Foundation Set Media Type| |----------------------------------------------------------| | | |Software for this operating system is packaged in sets. | |The Foundation Set is the required software all users | |must install. Read the help screen for more information. | |Select the distribution format and drive you will be | |using to install the Foundation Set. | | | | | |Your choices are: | | 1. Floppy Drive 1 | | 2. Floppy Drive 2 | | 3. Cartridge Tape | | | |Type a number from '1' to '3' followed by ENTER/RETURN: __| | | |----------------------------------------------------------| |Please make a selection |Del=Cancel F1=Help | |----------------------------------------------------------|
The following help screen would be displayed when a user presses F1.
|----------------------------------------------------------| |Help on Foundation Set Media Type Page 1 of 1 | |----------------------------------------------------------| | | |For further instructions on using this help facility and | |on using the installation program, press the 'F1' key (or | |the '?' key) at any time while you are reading help. | | | |If you need more information than is available through | |this help facility, refer to the "Installation Guide". | | | |The Installation Process needs to know where to look for | |the software that needs to be installed. | |----------------------------------------------------------| | | Del=Cancel F1=Help ESC=Exit help 1=Forward 2=Back | |----------------------------------------------------------|
The following listing is the source file for this menu and its help screen.
.pageno Page %d of %d .ul Operating System Installation .hhelp_ban Help on the Help facility and the Installation program .helpbanner Help on Foundation Set Media Type .ur Foundation Set Media Type .ll Please make a selection. .lr Del=Cancel F1=Help .top Software for the Operating System is packaged in sets. The Foundation Set is the required software all users must install.Select the distribution format and drive you will be using to install the Foundation Set. .optstring Your choices are: .form `[ "${NF1}" = "1" ] && echo "Floppy Drive 1"` `[ "${NF2}" = "1" ] && echo "Floppy Drive 2"` `[ "${NC1}" = "1" ] && echo "Cartridge Tape"` .selection Press a number between %d and %d followed by ENTER/RETURN: .help For further instructions on using this help facility and on using the installation program, press the 'F1' key (or the '?' key) at any time while you are reading help.
If you need more information than is available through this help facility, refer to the "Installation Guide".
The Installation Process needs to know where to look for the software that needs to be installed. .helpinst Del=Cancel F1=Help ESC=Exit help 1=Forward 2=Back .working Working... .end
|----------------------------------------------------------| |Operating System Installation Owner's Account | |----------------------------------------------------------| | | |Create a login account for your use in accessing the | |computer. Read the Help screen for information about | |each field. | | | | Owner's name: _________________________ | | Owner's login name: ________ | | Owner's user number: _____ | |Owner's desktop environment: _________ | | | | +-----+ +-----+ | | |Apply| |Reset| | | +-----+ +-----+ | | | |Press 'TAB' to move the cursor between fields. When | |finished, move the cursor to "Apply" and then press | |'ENTER' (or '<Return>') to continue. | |----------------------------------------------------------| |Type the owner's first and last name |Del=Cancel F1=Help| |----------------------------------------------------------|
The following listing is the source file for this form.
.pageno Page %d of %d .ul Operating System Installation .hhelp_ban Help on Help and How to Use the Menu Tool .helpbanner Help on Owner's Account .ur Owner's Account .ll .lr Del=Cancel F1=Help .top < /tmp/err.loginCreate a login account for your use in accessing the computer. Read the Help screen for information about each field.
.form 5 3 25//[^:]+//Owner's name://USERNAME// //Type the owner's first and last name//
1 2 8 //Owner's login name://USERID// //Type the owner's login name// 5 1 5//[0-9]+//Owner's user number://USERNUM// //Type the owner's user number (must be 101 or higher)// `[ "${DESKTOP_PRESENT}" = "Yes" ] && echo "2 3//OLOOK::OPEN_LOOK (tm)//MOTIF:\ :Motif//NONE::None//Owner's desktop environment://DESKTOP// "` `[ "${DESKTOP_PRESENT}" = "Yes" ] && echo "//Right/Left arrow keys for\ more choices// "` .button Apply Reset .bottom Press 'TAB' to move the cursor between fields. When finished, move the cursor to "Apply" and then press 'ENTER' (or '<Return>') to continue.. . help screens could be defined here .
.working Working... .end
|----------------------------------------------------------| |Foundation Set Installation Installation Complete | |----------------------------------------------------------| | | |The Foundation Set installation is complete. Applications| |and other software sets can be installed using the tools | |available with the Foundation Set. | | | |After the computer reboots you will see a login prompt. | |Type a login, either "root" to do system maintenance, | |or the user account login created in the previous step. | | | |Please refer to the "Getting Started Manual" for more | |information. | | | | | |Press 'Enter' (or '<Return>') to continue: _____ | |----------------------------------------------------------| | |Del=Cancel F1=Help | |----------------------------------------------------------|
The following listing is the source file for this information screen.
.pageno Page %d of %d .ul Foundation Set Installation .hhelp_ban Help on the Help facility and the Installation program .helpbanner Help on Installation Complete .ur Installation Complete .ll .lr Del=Cancel F1=Help .top The Foundation Set installation is complete. Applications and other software sets can be installed using the tools available with the Foundation Set.After the computer reboots you will see a login prompt. Type a login, either "root" to do system maintenance, or the user account login you created in the previous step.
Please refer to the "Getting Started Manual" for more information. .form ENTER .selection Press 'ENTER' (or '<Return>') to continue:
. . help screens could be defined here .
.working Working... .end