All pastes #340298 Raw Edit

Untitled

public text v1 · immutable
·published 2007-02-04 18:09 UTC
rendered paste body
forward OnCfgExecute(cmd[], params[]);

public RunCfg(path[])
{
	new g_i;
	new buffer[1024];
	new cmd[64];
	if (!fexist(path))
		return 0;
	new File: cfg_file = fopen(path, io_read);
	while(fread(cfg_file, buffer, sizeof(buffer), false))
	{
		if (strlen(buffer) > 0)
		{
			g_i = 0;
			cmd = strtok(buffer, g_i);
			OnCfgExecute(cmd, buffer[g_i+1]);
		}
	}
	fclose(cfg_file);
	return 1;
}