xcall MIAMEX, MX_CHAINTO, opcode, progrm
MX_CHAINTO allows you to define a program to chain to automatically if an attempt is made to run a program for which the user does not have sufficient (read) privileges. This is useful if you wish to use the operating system file access privileges for restricting access to sensitive programs (as an alternative, for example, to password protecting them). If no chain-to specification is defined, then such an attempt will cause the program to abort, displaying an "access denied" message, probably leaving the user at the dot prompt. By defining a chain-to program, when such an error occurs, the user will automatically be redirected to the specified program (which might be a menu, or perhaps an error recovery program).
Parameters
opcode (Num)
0 to retrieve the current chain-to specification into the progrm variable, or 1 to set the new chain-to specification from the contents of the progrm argument.
progrm (String)
will either return (for opcode 0) or be used to set (for opcode 1) the chain-to specification. It should be a RUN or LIT program in AMOS format (no CMD or DO files allowed). Examples would be "MAIN.RUN" or "DSK0:MAIN.RUN[100,22]" or "SYS:HOST.LIT."
Comments
If the application allows the user to move around to different PPNs, it would be wise to include the complete specification for the desired chain-to program (else it might not be found). Also note that even though the program can be found, the user may no longer be in the expected directory, so a robust program would probably want to log the user to the expected directory automatically (see LOG).