GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CLI / V0-1-2 > cli / rhel6-64
#include <stdio.h>
#include <stdlib.h>
#include <CLI/CLI_msgs.h>
#include <CLI/CLI_pubdefs.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <MDB/MDB_pubdefs.h>
#include <CLI_prvdefs.h>
Defines | |
#define | CLI_OOM 0 |
#define | CLI_EOL 1 |
#define | CLI_EOF 2 |
#define | CLI_QUANTUM 256 |
Functions | |
static CLI_Control * | CLI_createCtl (const CLI_Syntax *syntax) |
Allocate and initialize a CLI control structure. | |
static char * | CLI_getFile (CLI_Control *ctl) |
Fetch a line of input from a file. | |
static unsigned int | CLI_getLine (FILE *fd, char **flin, int *nlin) |
Construct the next logical line of input in a file. | |
static char * | CLI_getTerm (const char *prompt) |
Fetch a line of input from the terminal. | |
unsigned int | CLI_command (const char *ilin, const char *prompt, const CLI_Syntax *syntax, void *user) |
Parse and dispatch command lines. |
CVS $Id: CLI_command.c,v 1.5 2011/03/25 00:51:25 apw Exp $
unsigned int CLI_command | ( | const char * | ilin, | |
const char * | prompt, | |||
const CLI_Syntax * | syntax, | |||
void * | user | |||
) |
Parse and dispatch command lines.
ilin | Input line to parse (can be NULL or blank) | |
prompt | Command prompt to use (when in subcommand mode) | |
syntax | (Opaque) pointer to syntax to use to decode lines | |
user | (Opaque) pointer to user parameter(s) |
References CLI_clearFiles(), CLI_clearTokens(), CLI_createCtl(), CLI_getFile(), CLI_getTerm(), CLI_parse(), _CLI_Control::file, _CLI_File::frst, _CLI_Syntax::id, _CLI_File::last, _CLI_File::name, and _CLI_Control::tokens.
Referenced by CLI_parse().
static CLI_Control * CLI_createCtl | ( | const CLI_Syntax * | syntax | ) | [inline, static] |
Allocate and initialize a CLI control structure.
syntax | Syntax to use to parse lines |
NULL | Allocation/initialization failed | |
x | Pointer to created control structure |
References _CLI_Control::file, _CLI_Control::id, _CLI_Tokens::line, _CLI_Tokens::parm, _CLI_Tokens::qual, _CLI_Control::syntax, _CLI_Control::tokens, and _CLI_Tokens::verb.
Referenced by CLI_command().
static char * CLI_getFile | ( | CLI_Control * | ctl | ) | [inline, static] |
Fetch a line of input from a file.
ctl | A CLI control structure |
NULL | End of input | |
x | Pointer to input line |
References CLI_clearFiles(), CLI_getLine(), _CLI_File::fd, _CLI_Control::file, _CLI_File::frst, _CLI_File::last, _CLI_File::line, _CLI_File::name, _CLI_File::next, and _CLI_File::stat.
Referenced by CLI_command().
static unsigned int CLI_getLine | ( | FILE * | fd, | |
char ** | flin, | |||
int * | nlin | |||
) | [inline, static] |
Construct the next logical line of input in a file.
fd | File desciptor | |
flin | Line (returned) | |
nlin | Number of physical lines in logical line (returned) |
Referenced by CLI_getFile().
static char * CLI_getTerm | ( | const char * | prompt | ) | [inline, static] |
Fetch a line of input from the terminal.
prompt | Terminal prompt |
NULL | End of input | |
x | Pointer to input line |
Referenced by CLI_command().