#include "tier1/commandline.h"
#include "tier1/utlvector.h"

CUtlVector<char*> cl_params;

void ICommandLine::CreateCommandLine( int argc, char **argv )
{
	cl_params.AppendTail(argv,argc);
}

bool ICommandLine::CheckParam( const char *psz )
{
	for (auto szParam: cl_params) {
		if (!V_strcmp(szParam, psz))
		{
			return true;
		}
	}
	return false;
}

char *ICommandLine::ParamValue( const char *psz )
{
	int i = 0;
	for (auto szParam: cl_params) {
		i++;
		if (i>=cl_params.GetSize())
		{
			return 0;
		}
		if (!V_strcmp(szParam, psz))
			return cl_params[i];
	}
	return 0;
}

void ICommandLine::AddParam( char *psz )
{
}

void ICommandLine::RemoveParam( char *psz )
{

}
int ICommandLine::ParamCount()
{
	return cl_params.GetSize();
}
int ICommandLine::FindParam( const char *psz )
{
	int i = 0;
	for (auto szParam: cl_params) {
		if (!V_strcmp(szParam, psz))
			return i;
		i++;
	}
	return 0;
}
const char *ICommandLine::GetParam(int nIndex)
{
	return cl_params[nIndex];
}

static ICommandLine g_CommandLine;
