Main Page   Interface   Data Structures   File List   Data Fields   Globals  

CLI_parse.c File Reference

Parses the input line according to the provided syntax. More...

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "CLI/CLI_pubdefs.h"
#include "CLI_prvdefs.h"

Typedefs

typedef enum _CLI_Mode CLI_Mode
 Typedef for enum _CLI_Mode.


Enumerations

enum  _CLI_Mode {
  CLI_MD_VERB,
  CLI_MD_QUAL,
  CLI_MD_PVAL,
  CLI_MD_QVAL
}
 Parsing mode. More...


Functions

unsigned int CLI_saveVerb (char *, char *, CLI_Control *, CLI_VerbDef **)
 Validate and save a verb. More...

unsigned int CLI_saveQual (char *, char *, CLI_VerbDef *, CLI_Qual *, CLI_Qual **, CLI_QualDef **)
 Validate and save a qualifier. More...

unsigned int CLI_savePval (char *, char *, CLI_ParmDef *, CLI_Parm **)
 Validate and save a parameter value. More...

unsigned int CLI_saveQval (char *, char *, CLI_Qual *, CLI_QualDef *)
 Validate and save a qualifier value. More...

unsigned int CLI_saveRest (char *, CLI_Parm **)
 Save the rest of the line as a single parameter. More...

unsigned int CLI_dispatch (CLI_Control *, void *)
 Dispatch a CLI command. More...

unsigned int CLI_parse (const char *ilin, CLI_Control *ctl, void *user)
 Parse a command line with the given syntax. More...


Detailed Description

Parses the input line according to the provided syntax.

CLI_parse.c parses the input line according to the provided syntax.


Enumeration Type Documentation

enum _CLI_Mode
 

Parsing mode.

Enumeration values:
CLI_MD_QUAL  Verb
CLI_MD_PVAL  Qualifier
CLI_MD_QVAL  Qualifier value


Function Documentation

unsigned int CLI_dispatch CLI_Control   ctl,
void *    user
[static]
 

Dispatch a CLI command.

Parameters:
ctl  CLI control structure
user  (Opaque) pointer to user parameter(s)
Returns:
Status code
Dispatch a CLI command for execution.

unsigned int CLI_parse const char *    ilin,
CLI_Control   ctl,
void *    user
 

Parse a command line with the given syntax.

Parameters:
ilin  Input line to parse
ctl  CLI control structure
user  (Opaque) pointer to user parameter(s)
Returns:
Status code
CLI_parse parses a line of text (the command line) using the syntax defined in ctl->syntax and if the line makes sense, dispatches it to the user defined callback routine.

unsigned int CLI_savePval char *    tbeg,
char *    tend,
CLI_ParmDef   pdef,
CLI_Parm **    plst
[static]
 

Validate and save a parameter value.

Parameters:
tbeg  First character
tend  (One past) the last character
pdef  Parameter definition
plst  Where to link the new parameter structure (if successful)
Returns:
Status code

unsigned int CLI_saveQual char *    tbeg,
char *    tend,
CLI_VerbDef   vdef,
CLI_Qual   qhed,
CLI_Qual **    qret,
CLI_QualDef **    qdef
[static]
 

Validate and save a qualifier.

Parameters:
tbeg  First character
tend  (One past) the last character
vdef  Primary verb (for looking up qualifiers)
qhed  Head of already parsed qualifier list
qret  Qualifier token pointer (returned)
qdef  Qualifier definition pointer (returned)
Returns:
Status code

unsigned int CLI_saveQval char *    tbeg,
char *    tend,
CLI_Qual   qual,
CLI_QualDef   qdef
[static]
 

Validate and save a qualifier value.

Parameters:
tbeg  First character
tend  (One past) the last character
qual  Qualifier structure which stores the value(s)
qdef  Qualifier definition
Returns:
Status code

unsigned int CLI_saveRest char *    tbeg,
CLI_Parm **    plst
[static]
 

Save the rest of the line as a single parameter.

Parameters:
tbeg  First character
plst  Where to link the new parameter structure (if successful)
Returns:
Status code

unsigned int CLI_saveVerb char *    tbeg,
char *    tend,
CLI_Control   ctl,
CLI_VerbDef **    vdef
[static]
 

Validate and save a verb.

Parameters:
tbeg  First character
tend  (One past) the last character
ctl  CLI control structure (contains the syntax)
verb  Verb definition (returned)
Returns:
Status code


Generated on Tue Nov 5 12:16:22 2002 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002