CMDProcessCommandLine

Synopsis

extern "C" CMDAPIIMPORT int CMDProcessCommandLine ( void * Interpreter, BOOL CMDBYREF LineWasNotBlank, const char * line, BOOL show_prompt, BOOL disable_echo ) ;

Description

This function executes a command line using the given instance of the interpreter. After an application has received a command line from the user, it calls this function to execute it. The function returns when the command line has been completely executed (or if the exit flag was set during execution) including any command scripts that it called.

The LineWasNotBlank parameter is set to a non-zero value if the line executed was not a blank line. This allows front ends to mimic the behaviour of the 16-bit CMD supplied with IBM OS/2 if needs be. (The 16-bit CMD supplied with IBM OS/2 prints a newline before printing the prompt if the last command line executed was non-blank.)

The command line itself is passed as a parameter. It is not modified in any way.

The "show prompt" and "disable echo" flags control whether or not and how the command line is echoed to standard output before it is executed. If the "disable echo" flag is set, then no echoing is performed. Otherwise echoing is controlled by the state of the echo flag for this instance of the interpreter. If the "show prompt" flag is set, the prompt string is displayed before the command line is echoed.

Usually an application will call this function from its main interactive loop with "show prompt" set to FALSE, since it will have already displayed the prompt itself before reading the command line, and "disable echo" set to TRUE, since reading the command line usually echoes it at the same time.

When called by an application that is parsing its command line and executing commands contained therein, "show prompt" is set to FALSE and "disable echo" is set to TRUE.


The 32-bit Command Interpreter is © Copyright Jonathan de Boyne Pollard. "Moral" rights are asserted.