aboutsummaryrefslogtreecommitdiff
path: root/src/test/params.cpp
blob: bb62047e099e6f96b588fd079d7c65f41820b217 (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
#include <stdio.h>
#include "pproc.h"

int main( int argc, char *argv[] )
{
	bool bOn = false;
	bool bOff = true;
	bool bTog = false;
	char cChar = '?';
	PPROC table[] = {
		{ "boolon",		'n', PPROC_BOOL_TRUE,	NULL,	&bOn,
				"Set the bool on." },
		{ "booloff",	'f', PPROC_BOOL_FALSE,	NULL,	&bOff,
				"Set the bool off." },
		{ "booltog",	't', PPROC_BOOL_TOGGLE,	NULL,	&bTog,
				"Set the bool off." },
		{ "char",		'c', PPROC_CHAR,		NULL,	&cChar,
				"Set the char." },
		{ NULL,			'\0',0, 				NULL, 	NULL,
				NULL }
	};

	processParams( argc, argv, table );

	printf("Final results:\n");
	printf("\tbOn   = %s\n", (bOn ? "true" : "false") );
	printf("\tbOff  = %s\n", (bOff ? "true" : "false") );
	printf("\tbTog  = %s\n", (bTog ? "true" : "false") );
	printf("\tcChar = '%c'\n", cChar );

	return 0;
}