Doxygen Documentation

Main Index

Package Index

Package:

CLI

Version:

V0-0-5

Marked:

(not marked)

Constituent:

cli

Tag:

linux-gcc


Interface   Compound List   File List   Compound Members   File Members  

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.

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

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

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

unsigned int CLI_command (const char *ilin, const char *prompt, const CLI_Syntax *syntax, void *user)
 Process commands.


Detailed Description

Handles command looping including file reading.

CVS $Id: CLI_command.c,v 1.3 2003/12/12 06:13:49 apw Exp $
Author:
A.P.Waite - apw@slac.stanford.edu
CLI_command.c handles command looping including fetching lines from files to satisfy command indirection.

Function Documentation

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

Process commands.

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 Thu Dec 11 22:17:31 2003 by doxygen 1.3.3