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