Unit 'amigados' Package
[Overview][Constants][Types][Procedures and functions][Index] [#amunits]

CliInitRun

Set up a process to be a shell from initial packet

Declaration

Source position: amigados.pas line 1595

function CliInitRun(

  dp: pDosPacket

):LongInt;

Arguments

dp

  

startup arguments specified as a packet

Function result

Flags or a Pointer

Description

This function initializes a process and CLI structure for a new shell, from parameters in an initial packet passed by the system (Run, SystemTagList(), Execute())). The format of the data in the packet is purposely not defined. The setup includes all the normal fields in the structures that are required for proper operation (current directory, paths, input streams, etc).

It returns a set of flags containing information about what type of shell invocation this is.

Definitions for the values of fn:

Bit 31
Set to indicate flags are valid
Bit 3
Set to indicate asynch system call
Bit 2
Set if this is a SystemTagList() call
Bit 1
Set if user provided input stream
Bit 0
Set if RUN provided output stream

If Bit 31 is 0, then you must check IoErr() to determine if an error occurred. If IoErr() returns a pointer to your process, there has been an error, and you should clean up and exit. The packet will have already been returned by CliInitNewcli(). If it isn't a pointer to your process and Bit 31 is 0, you should wait before replying the packet until after you've loaded the first command (or when you exit). This helps avoid disk "gronking" with the Run command. (Note: this is different from what you do for CliInitNewcli()).)

If Bit 31 is 1, then if Bit 3 is one, ReplyPkt() the packet immediately (Asynch SystemTagList()), otherwise wait until your shell exits (Sync SystemTagList(), Execute()). (Note: this is different from what you do for CliInitNewcli().)

This function is very similar to CliInitNewcli().

See also

CliInitNewcli

  

Set up a process to be a shell using a startup packet.

ReplyPkt

  

Replies a packet to the person who sent it to you

WaitPkt

  

Waits for a packet to arrive at your pr_MsgPort

IoErr

  

Return extra information from the system

SystemTagList

  

Have a shell execute a command line

Execute

  

Execute a CLI command


Documentation generated on: 2021-07-30