aboutsummaryrefslogtreecommitdiff
path: root/src/test/param.cpp
blob: 0641f90b3e9ab660779d6259b4d60cb5db272847 (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
36
37
38
39
40
#include "param.h"
#include <stdio.h>

Param::Param()
{
	addParam( "name", 's', mkproc( Param::printStuff ), &str );
	//addParam( "name", &str );
	addParam( "job", 'U', mkproc( Param::printStuff ) );

	// --name=Bobo
	// --job hello
}

Param::~Param()
{
}

int Param::printStuff( int argc, char *argv[] )
{
	printf("------------%02d-------------\n", argc );
	for( int j = 0; j < argc; j++ )
	{
		printf("%d: %s\n", j, argv[j] );
	}
	printf("---------------------------\n" );
	printf("SETVAR===\"%s\"\n", str.c_str() );

	return 1;
}

int main( int argc, char *argv[] )
{
	printf("Starting...\n");
	Param p;
	p.process( argc, argv );

	//printf("Calling by hand...\n");
	//p.printStuff();
}