aboutsummaryrefslogtreecommitdiff
path: root/src/test/params.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/params.cpp')
-rw-r--r--src/test/params.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/params.cpp b/src/test/params.cpp
new file mode 100644
index 0000000..7bd2c0c
--- /dev/null
+++ b/src/test/params.cpp
@@ -0,0 +1,32 @@
1#include <stdio.h>
2#include "pproc.h"
3
4int main( int argc, char *argv[] )
5{
6 bool bOn = false;
7 bool bOff = true;
8 bool bTog = false;
9 char cChar = '?';
10 PPROC table[] = {
11 { "boolon", 'n', PPROC_BOOL_TRUE, NULL, &bOn,
12 "Set the bool on." },
13 { "booloff", 'f', PPROC_BOOL_FALSE, NULL, &bOff,
14 "Set the bool off." },
15 { "booltog", 't', PPROC_BOOL_TOGGLE, NULL, &bTog,
16 "Set the bool off." },
17 { "char", 'c', PPROC_CHAR, NULL, &cChar,
18 "Set the char." },
19 { NULL, '\0', 0, NULL, NULL, NULL }
20 };
21
22 processParams( argc, argv, table );
23
24 printf("Final results:\n");
25 printf("\tbOn = %s\n", (bOn ? "true" : "false") );
26 printf("\tbOff = %s\n", (bOff ? "true" : "false") );
27 printf("\tbTog = %s\n", (bTog ? "true" : "false") );
28 printf("\tcChar = '%c'\n", cChar );
29
30 return 0;
31}
32