All pastes #77531 Raw Edit

Untitled

public text v1 · immutable
·published 2006-07-03 04:06 UTC
rendered paste body
void __stdcall command_test(vector<Param> params)
{
	cout << "Test just executed\n";
}

void __stdcall command_repeat(vector<Param> params)
{
	if (params[0].type != PARAM_UL)
	{
		cout << "Bad format buddy\n";
		return;
	}
	if (params.size() < 2)
	{
		cout << "Uuh, what do you want to repeat?\n";
		return;
	}
	unsigned long count = params[0].l;
	for (unsigned long i = 0; i < count; i++)
		ExecuteCommand(params[1].sp);
}

void CommandLineTest()
{
	commandlist["help"] = command_help;
	commandlist["test"] = command_test;
	commandlist["repeat"] = command_repeat;

	ExecuteCommand("repeat 4 repeat 2 test");
}