aboutsummaryrefslogtreecommitdiff
path: root/src/test/param/param.cpp
blob: a4d2824814d494a026e7a77905fba53950bc19b0 (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
41
42
43
44
45
46
#include "param.h"
#include <stdio.h>

Param::Param()
{
	addHelpBanner("param - A test of the libbu++ parameter systems\n"
			"Enjoy with care and caution\n\nTest stuff:\n");
	addParam( "name", 's', mkproc( Param::printStuff ), &str, "Test a param param" );
	//addParam( "name", &str );
	addParam( "job", 'U', mkproc( Param::printStuff ), "Test a paramless param" );

	addHelpBanner("\nInformational:\n");
	addParam( "help", mkproc( ParamProc::help ), "Help!" );

	addHelpBanner("\nThanks for trying my test!\n\n");
}

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[] )
{
	if( argc == 1 )
	{
		printf("You have to enter some parameter, try '--help'\n\n");
		return 0;
	}

	Param p;
	p.process( argc, argv );
}