SERDISP_PROCCMD

Version information for command processor

#define SDCMD_VERSION_MAJOR   0
 
#define SDCMD_VERSION_MINOR   9
 

Return codes

#define SDCMD_RCCODE_VERSION   210
 
#define SDCMD_RCCODE_INFO   212
 
#define SDCMD_RCCODE_HELP   214
 
#define SDCMD_RCCODE_SUCCESS   250
 
#define SDCMD_RCCODE_ALREADY   251
 
#define SDCMD_RCCODE_ERRCMD   500
 
#define SDCMD_RCCODE_ERRARGS   501
 
#define SDCMD_RCCODE_ERRRUNT   504
 
#define SDCMD_RCCODE_ERRNAVAIL   505
 
#define SDCMD_RCCODE_ERRSIZE   509
 

Main function

int SDCMD_proccmd (serdisp_t *dd, char *cmdline, char *msgbuf, int msgbuf_size, int show_rccode)
 processes a command line More...
 

Detailed Description

Introduction

serdisp_proccmd.h offers a command processor which can be used in two ways:

Function Documentation

int SDCMD_proccmd ( serdisp_t *  dd,
char *  cmdline,
char *  msgbuf,
int  msgbuf_size,
int  show_rccode 
)

processes a command line (eg: 'GPO SET gpo0 1', 'OPTION SET option1 3')

Parameters
dddevice descriptor
cmdlinecommand line that should be processed
msgbufmessage buffer (or NULL if not used)
msgbuf_sizesize of message buffer
show_rccodeshow or hide return code information
Returns
return code (one of SDCMD_RCCODE_*)
Remarks
the answer returned by the command processor can be single or multi-lined.
each line is preceded by a 3-digit return code and either a space if the answer is single-lined or a dash if the answer is multi-lined (unless show_rccode is set to 0).

format of an answer-line
rccode['-'|' ']message

msgbuf
the answer will be filled into the message buffer msgbuf. the max. size of this buffer is given by msgbuf_size.
answers bigger than msgbuf_size will be cropped.
if msgbuf is NULL the answer will be printed to stdout.

show_rccode
depending on show_rccode the answer will contain return code information.

the command line GPO HELP may return the following outputs:
  • show_rccode == 1
       214-Commands:
       214-  INFO  HELP  SET  TOGGLE  VERSION 
  • show_rccode == 0
       Commands:
         INFO  HELP  SET  TOGGLE  VERSION  
Since
1.98.0