Source: src/si_config.cc


Annotated List
Files
Globals
Hierarchy
Index
//loads configuration from file
#include 

using namespace std;
#include 
#include 
#include 

#include "define.h"
#include "si_string.h"
#include "si_system.h"


int load_hash( map &data, string fname, string aname )
{
	PACKFILE *fp;
	char buff[MAX_LINE_LENGTH];
	int p;
	string s,a,b;

	//converts name to datafile syntax
	s = fname;
	s += "#";
	s += aname;

	fp = pack_fopen(s.c_str(),"rb");
	if(!fp) { 
		error("Unable to open hash file %s %s", fname.c_str(), aname.c_str());
		return ERROR_NO_HASH_FILE;
	}

	while(pack_fgets(buff, MAX_LINE_LENGTH - 1, fp)) {
//		chop(buff); 	Allegro sa chova inak pri fgets
		s = buff;
		if(check_syntax(s)) {
			p = s.find('=');
			a = remove_spaces(s.substr(0,p));
			b = remove_spaces(s.substr(p+1, s.length()));

			data[a] = b;
		}
	}
	pack_fclose(fp);
	
	return NO_ERROR;
}


Generated by: georgik on armada on Sat Jul 24 07:07:15 2004, using kdoc 2.0a54.