// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: configuration.cc,v 1.24 2002/11/09 17:11:25 doogie Exp $
+// $Id: configuration.cc,v 1.28 2004/04/30 04:00:15 mdz Exp $
/* ######################################################################
Configuration Class
case 'i':
{
char buf[16];
- snprintf(buf, sizeof(buf)-1, "%d", FindI(key, atoi(Default)));
+ snprintf(buf, sizeof(buf)-1, "%d", FindI(key, Default ? atoi(Default) : 0 ));
return buf;
}
}
{
string key = Name;
- if (key.size() > 2 && key.end()[-2] == '/' &&
- key.find_first_of("fdbi",key.size()-1) < key.size())
- {
- key.resize(key.size() - 2);
- if (Exists(key.c_str()))
- return true;
- }
+ if (key.size() > 2 && key.end()[-2] == '/')
+ if (key.find_first_of("fdbi",key.size()-1) < key.size())
+ {
+ key.resize(key.size() - 2);
+ if (Exists(key.c_str()))
+ return true;
+ }
+ else
+ {
+ _error->Warning(_("Unrecognized type abbreviation: '%c'"), key.end()[-3]);
+ }
return Exists(Name);
}
if (!F != 0)
return _error->Errno("ifstream::ifstream",_("Opening configuration file %s"),FName.c_str());
- char Buffer[300];
+ char Buffer[1024];
string LineBuffer;
string Stack[100];
unsigned int StackPos = 0;
{
F.getline(Buffer,sizeof(Buffer));
CurLine++;
+ // This should be made to work instead, but this is better than looping
+ if (F.fail() && !F.eof())
+ return _error->Error(_("Line %d too long (max %d)"), CurLine, sizeof(Buffer));
+
_strtabexpand(Buffer,sizeof(Buffer));
_strstrip(Buffer);
string Tag;
const char *Pos = LineBuffer.c_str();
if (ParseQuoteWord(Pos,Tag) == false)
- return _error->Error(_("Syntax error %s:%u: Malformed Tag"),FName.c_str(),CurLine);
+ return _error->Error(_("Syntax error %s:%u: Malformed tag"),FName.c_str(),CurLine);
// Parse off the word
string Word;