Main Page   Interface   Data Structures   File List   Data Fields   Globals  

CLI_command.c File Reference

Handles command looping including file reading. More...

#include <stdio.h>
#include <stdlib.h>
#include "GRL/readline.h"
#include "GRL/history.h"
#include "CLI/CLI_pubdefs.h"
#include "CLI_prvdefs.h"

Defines

#define CLI_OOM   0
 Out of memory.

#define CLI_EOL   1
 End of line.

#define CLI_EOF   2
 End of file.

#define CLI_BAD   3
 Error reading file.

#define CLI_QUANTUM   256
 Memory allocation quantum.


Functions

CLI_ControlCLI_createCtl (const CLI_Syntax *)
 Allocate and initialize a CLI control structure. More...

char * CLI_getTerm (const char *)
 Fetch a line of input from the terminal. More...

char * CLI_getFile (CLI_Control *)
 Fetch a line of input from a file. More...

unsigned int CLI_getLine (FILE *, char **, int *)
 Construct the next logical line of input in a file. More...

unsigned int CLI_command (const char *ilin, const char *prompt, const CLI_Syntax *syntax, void *user)
 Parse and dispatch command lines. More...


Detailed Description

Handles command looping including file reading.

CLI_command.c handles command looping including fetching lines from files to satisfy command indirection.


Function Documentation

unsigned int CLI_command const char *    line,
const char *    prompt,
const CLI_Syntax   syntax,
void *    user
 

Parse and dispatch command lines.

Parameters:
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)
Returns:
Status code
CLI_command parses and dispatches command lines. It handles the direct command case (when ilin contains a real string) and the 'enter subcommand' case (when ilin is NULL or blank).

CLI_Control * CLI_createCtl const CLI_Syntax   syntax [static]
 

Allocate and initialize a CLI control structure.

Parameters:
syntax  Syntax to use to parse lines
Return values:
NULL  Allocation/initialization failed
x  Pointer to created control structure

char * CLI_getFile CLI_Control   ctl [static]
 

Fetch a line of input from a file.

Parameters:
ctl  A CLI control structure
Return values:
NULL  End of input
x  Pointer to input line

unsigned int CLI_getLine FILE *    fd,
char **    flin,
int *    nlin
[static]
 

Construct the next logical line of input in a file.

Parameters:
fd  File desciptor
flin  Line (returned)
nlin  Number of physical lines in logical line (returned)
Returns:
Status code

char * CLI_getTerm const char *    prompt [static]
 

Fetch a line of input from the terminal.

Parameters:
prompt  Terminal prompt
Return values:
NULL  End of input
x  Pointer to input line


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