Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

CmdLine Class Reference

the command line itself. Basically executes command from user input. More...

#include <cmdline.h>

List of all members.

Public Methods

 CmdLine ()
 Builds the vector of command objects.

virtual ~CmdLine ()
 delete all command objects.

int exec (const char *cmdLine, int argc=0, char **argv=0)
 execute a command line. More...


Static Public Methods

int getNextToken (const char *string, const char *delim)
int splitString (char *inputString, char **outputArray, unsigned arraySize, const char *delimiters)
 split a string into an array of words. More...


Detailed Description

the command line itself. Basically executes command from user input.

Definition at line 50 of file cmdline.h.


Member Function Documentation

int CmdLine::exec const char *    cmdLine,
int    argc = 0,
char **    argv = 0
 

execute a command line.

Execute a command. If it's a script, skip comments and replace argument passing. Comments are replaced using \1, \2, etc. \0 is the name of the script.

Parameters:
cmdLine  the command line to execute, null-terminated.
argc  in case of a script execution, argc contains the number of argument of the script command line.
argv  in case of a script execution, argv is an array of parameters. \0, \1 .. \argc are replaced by these parameters.
Returns:
-1 if the command wants to quit. -2 == cmd not found. 0 on success.

Definition at line 625 of file cmdline.cpp.

References CMD_SCRIPT_DEBUG, debugMessage(), and splitString().

Referenced by ProgramFlashCmd::exec(), and EventSelector::handleInputCommand().

int CmdLine::getNextToken const char *    string,
const char *    delim
[static]
 

return the index of the next character which is not in "delim", or -1 if not found.

Definition at line 693 of file cmdline.cpp.

int CmdLine::splitString char *    inputString,
char **    outputArray,
unsigned    arraySize,
const char *    delimiters
[static]
 

split a string into an array of words.

Fill an array of char pointer, given an input string and a string of delimiters. In case of overflow, the end of the command line is dropped.

Parameters:
inputString  input null terminated string, or 0.
outputArray  already allocated array with at least arraySize elements.
arraySize  number of elements of outputArray.
delimiters  null terminated string containing caracters that separates the words.
Returns:
the number of words found.

Definition at line 716 of file cmdline.cpp.

Referenced by exec().


The documentation for this class was generated from the following files:
Generated on Fri May 16 13:01:48 2003 for Jelie by doxygen1.2.15