Download OpenVMS User`s Manual - Living Computer Museum

Transcript
Annotated Command Procedures
C.8 FORTUSER.COM Command Procedure
$ PRINT:
$
PRINT ’FILE_NAME’
$
GOTO GET_COMMAND
$ BADFILE:
+?
$
WRITE SYS$OUTPUT "File must be in current default directory."
$ FILE:
$
INQUIRE FILE_NAME "File name"
$
IF FILE_NAME .EQS. "" THEN GOTO FILE
$
IF F$PARSE(FILE_NAME,,,"DIRECTORY") .NES. F$DIRECTORY() - +@
THEN GOTO BADFILE
$
FILE_NAME = F$PARSE(FILE_NAME,,,"NAME")
$
GOTO GET_COMMAND
$ DONE:
$ EXIT
Notes for FORTUSER.COM Command Procedure
! The SET NOCONTROL=Y command ensures that the user who logs in under
the control of this procedure cannot interrupt the procedure or any command
or program in it.
" The option table lists the commands that the user will be allowed to execute.
Each command is separated by a slash.
# The procedure introduces itself.
$ The symbol name PROMPT is given the value of a label in the procedure.
When the procedure is initially invoked, this symbol has the value INIT.
The HELP command text terminates with a GOTO command that specifies
the label PROMPT. When this text is displayed for the first time, the GOTO
command results in a branch to the label HELP. This displays the HELP
message that explains the commands that you can enter. Then, the procedure
branches back to the label INIT, where the value for PROMPT is changed
to "GET_COMMAND". Finally, the procedure branches to the label FILE to
get a file name. Thereafter, when the help text is displayed, the procedure
branches to the label GET_COMMAND to get the next command.
% The Ctrl/Y condition action is set to return to the label GET_COMMAND, as
is the warning condition action. The procedure prompts for a command and
continues to prompt, even if nothing is entered. To terminate the session and
return to interactive command level, enter the command DONE.
& The procedure uses the F$LOCATE and F$LENGTH lexical functions to
determine whether the command is included in the list of options. The
F$LOCATE function searches for the user-entered command, followed by a
slash. (For example, if you enter EDIT, the procedure searches for EDIT/.) If
the command is not included in the option list, then the procedure branches
to the label INVALID_COMMAND. If the command is valid, the procedure
branches to the appropriate label.
’ At the label INVALID_COMMAND, the procedure writes an error message
and displays the help text that lists the commands that are valid.
( The help text lists the commands that are valid. This text is displayed
initially. It is also displayed whenever the user enters the HELP command or
any invalid command.
) At the conclusion of the HELP text, the GOTO command specifies the symbol
name PROMPT. When this procedure is first invoked, the symbol has the
value INIT. Thereafter, it has the value GET_COMMAND.
C–18 Annotated Command Procedures