blob: bf5063cd78df173b843202d19c84146b1216c43d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifndef PPROC_H_
#define PPROC_H_
/**
* Contains all required info to handle a single program parameter.
*@author Mike Buland
*/
typedef struct PPROC
{
const char *lpWord; /**< The full text-word to use as a param. */
const char cChar; /**< The short char version of the param. */
/**
* Pointer to the function to call when this param is triggered.
*@param argc The number of params after and including the one that
* triggered this call.
*@param argv The array of commandline tokens to use as parameters.
*@returns 0 for everything is ok. A number greater than zero signals that
* this parameter function used n parameters and they should be skipped by
* the processParams function.
*/
int (*proc)( int argc, char *argv[] );
bool *stateVar; /**< A pointer to a bool to be setwhen this is triggered */
bool bSetState; /**< The state to set the above bool to. */
} PPROC;
/**
* Process command line parameters based on a null-terminated array of PPROC
* structures.
*@param argc Should come straight from your main function's argc.
*@param argv Should come straight from your main function's argv.
*@param pproc The array of params that this function can respond to.
*/
void processParams( int argc, char *argv[], PPROC *pproc );
#endif /*PPROC_H_*/
|