RAPICAM_3-15-2015
RaspiCLI.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include "interface/vcos/vcos.h"
#include "RaspiCLI.h"

Functions

int raspicli_get_command_id (const COMMAND_LIST *commands, const int num_commands, const char *arg, int *num_parameters)
 
void raspicli_display_help (const COMMAND_LIST *commands, const int num_commands)
 
int raspicli_map_xref (const char *str, const XREF_T *map, int num_refs)
 
const char * raspicli_unmap_xref (const int en, XREF_T *map, int num_refs)
 

Detailed Description

Code for handling command line parameters

Date
4th March 2013 : James Hughes

Description

Some functions/structures for command line parameter parsing

Function Documentation

void raspicli_display_help ( const COMMAND_LIST commands,
const int  num_commands 
)

Display the list of commands in help format

Parameters
commandsArray of command to check
num_commandNumber of commands in the arry
int raspicli_get_command_id ( const COMMAND_LIST commands,
const int  num_commands,
const char *  arg,
int *  num_parameters 
)

Convert a string from command line to a comand_id from the list

Parameters
commandsArray of command to check
num_commandNumber of commands in the array
argString to search for in the list
num_parametersReturns the number of parameters used by the command
Returns
command ID if found, -1 if not found
int raspicli_map_xref ( const char *  str,
const XREF_T map,
int  num_refs 
)

Function to take a string, a mapping, and return the int equivalent

Parameters
strIncoming string to match
mapMapping data
num_refsThe number of items in the mapping data
Returns
The integer match for the string, or -1 if no match
const char* raspicli_unmap_xref ( const int  en,
XREF_T map,
int  num_refs 
)

Function to take a mmal enum (as int) and return the string equivalent

Parameters
enIncoming int to match
mapMapping data
num_refsThe number of items in the mapping data
Returns
const pointer to string, or NULL if no match