123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844 |
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
- // $Id: configuration.cc,v 1.28 2004/04/30 04:00:15 mdz Exp $
- /* ######################################################################
- Configuration Class
-
- This class provides a configuration file and command line parser
- for a tree-oriented configuration environment. All runtime configuration
- is stored in here.
- This source is placed in the Public Domain, do with it what you will
- It was originally written by Jason Gunthorpe <jgg@debian.org>.
-
- ##################################################################### */
- /*}}}*/
- // Include files /*{{{*/
- #include <apt-pkg/configuration.h>
- #include <apt-pkg/error.h>
- #include <apt-pkg/strutl.h>
- #include <apt-pkg/fileutl.h>
- #include <apti18n.h>
- #include <vector>
- #include <fstream>
- #include <iostream>
- using namespace std;
- /*}}}*/
- Configuration *_config = new Configuration;
- // Configuration::Configuration - Constructor /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- Configuration::Configuration() : ToFree(true)
- {
- Root = new Item;
- }
- Configuration::Configuration(const Item *Root) : Root((Item *)Root), ToFree(false)
- {
- };
- /*}}}*/
- // Configuration::~Configuration - Destructor /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- Configuration::~Configuration()
- {
- if (ToFree == false)
- return;
-
- Item *Top = Root;
- for (; Top != 0;)
- {
- if (Top->Child != 0)
- {
- Top = Top->Child;
- continue;
- }
-
- while (Top != 0 && Top->Next == 0)
- {
- Item *Parent = Top->Parent;
- delete Top;
- Top = Parent;
- }
- if (Top != 0)
- {
- Item *Next = Top->Next;
- delete Top;
- Top = Next;
- }
- }
- }
- /*}}}*/
- // Configuration::Lookup - Lookup a single item /*{{{*/
- // ---------------------------------------------------------------------
- /* This will lookup a single item by name below another item. It is a
- helper function for the main lookup function */
- Configuration::Item *Configuration::Lookup(Item *Head,const char *S,
- unsigned long Len,bool Create)
- {
- int Res = 1;
- Item *I = Head->Child;
- Item **Last = &Head->Child;
-
- // Empty strings match nothing. They are used for lists.
- if (Len != 0)
- {
- for (; I != 0; Last = &I->Next, I = I->Next)
- if ((Res = stringcasecmp(I->Tag,S,S + Len)) == 0)
- break;
- }
- else
- for (; I != 0; Last = &I->Next, I = I->Next);
-
- if (Res == 0)
- return I;
- if (Create == false)
- return 0;
-
- I = new Item;
- I->Tag.assign(S,Len);
- I->Next = *Last;
- I->Parent = Head;
- *Last = I;
- return I;
- }
- /*}}}*/
- // Configuration::Lookup - Lookup a fully scoped item /*{{{*/
- // ---------------------------------------------------------------------
- /* This performs a fully scoped lookup of a given name, possibly creating
- new items */
- Configuration::Item *Configuration::Lookup(const char *Name,bool Create)
- {
- if (Name == 0)
- return Root->Child;
-
- const char *Start = Name;
- const char *End = Start + strlen(Name);
- const char *TagEnd = Name;
- Item *Itm = Root;
- for (; End - TagEnd >= 2; TagEnd++)
- {
- if (TagEnd[0] == ':' && TagEnd[1] == ':')
- {
- Itm = Lookup(Itm,Start,TagEnd - Start,Create);
- if (Itm == 0)
- return 0;
- TagEnd = Start = TagEnd + 2;
- }
- }
- // This must be a trailing ::, we create unique items in a list
- if (End - Start == 0)
- {
- if (Create == false)
- return 0;
- }
-
- Itm = Lookup(Itm,Start,End - Start,Create);
- return Itm;
- }
- /*}}}*/
- // Configuration::Find - Find a value /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- string Configuration::Find(const char *Name,const char *Default) const
- {
- const Item *Itm = Lookup(Name);
- if (Itm == 0 || Itm->Value.empty() == true)
- {
- if (Default == 0)
- return "";
- else
- return Default;
- }
-
- return Itm->Value;
- }
- /*}}}*/
- // Configuration::FindFile - Find a Filename /*{{{*/
- // ---------------------------------------------------------------------
- /* Directories are stored as the base dir in the Parent node and the
- sub directory in sub nodes with the final node being the end filename
- */
- string Configuration::FindFile(const char *Name,const char *Default) const
- {
- const Item *RootItem = Lookup("RootDir");
- std::string rootDir = (RootItem == 0) ? "" : RootItem->Value;
- if(rootDir.size() > 0 && rootDir[rootDir.size() - 1] != '/')
- rootDir.push_back('/');
- const Item *Itm = Lookup(Name);
- if (Itm == 0 || Itm->Value.empty() == true)
- {
- if (Default == 0)
- return rootDir;
- else
- return rootDir + Default;
- }
-
- string val = Itm->Value;
- while (Itm->Parent != 0 && Itm->Parent->Value.empty() == false)
- {
- // Absolute
- if (val.length() >= 1 && val[0] == '/')
- break;
- // ~/foo or ./foo
- if (val.length() >= 2 && (val[0] == '~' || val[0] == '.') && val[1] == '/')
- break;
-
- // ../foo
- if (val.length() >= 3 && val[0] == '.' && val[1] == '.' && val[2] == '/')
- break;
-
- if (Itm->Parent->Value.end()[-1] != '/')
- val.insert(0, "/");
- val.insert(0, Itm->Parent->Value);
- Itm = Itm->Parent;
- }
- return rootDir + val;
- }
- /*}}}*/
- // Configuration::FindDir - Find a directory name /*{{{*/
- // ---------------------------------------------------------------------
- /* This is like findfile execept the result is terminated in a / */
- string Configuration::FindDir(const char *Name,const char *Default) const
- {
- string Res = FindFile(Name,Default);
- if (Res.end()[-1] != '/')
- return Res + '/';
- return Res;
- }
- /*}}}*/
- // Configuration::FindVector - Find a vector of values /*{{{*/
- // ---------------------------------------------------------------------
- /* Returns a vector of config values under the given item */
- vector<string> Configuration::FindVector(const char *Name) const
- {
- vector<string> Vec;
- const Item *Top = Lookup(Name);
- if (Top == NULL)
- return Vec;
- Item *I = Top->Child;
- while(I != NULL)
- {
- Vec.push_back(I->Value);
- I = I->Next;
- }
- return Vec;
- }
- /*}}}*/
- // Configuration::FindI - Find an integer value /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- int Configuration::FindI(const char *Name,int Default) const
- {
- const Item *Itm = Lookup(Name);
- if (Itm == 0 || Itm->Value.empty() == true)
- return Default;
-
- char *End;
- int Res = strtol(Itm->Value.c_str(),&End,0);
- if (End == Itm->Value.c_str())
- return Default;
-
- return Res;
- }
- /*}}}*/
- // Configuration::FindB - Find a boolean type /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- bool Configuration::FindB(const char *Name,bool Default) const
- {
- const Item *Itm = Lookup(Name);
- if (Itm == 0 || Itm->Value.empty() == true)
- return Default;
-
- return StringToBool(Itm->Value,Default);
- }
- /*}}}*/
- // Configuration::FindAny - Find an arbitrary type /*{{{*/
- // ---------------------------------------------------------------------
- /* a key suffix of /f, /d, /b or /i calls Find{File,Dir,B,I} */
- string Configuration::FindAny(const char *Name,const char *Default) const
- {
- string key = Name;
- char type = 0;
- if (key.size() > 2 && key.end()[-2] == '/')
- {
- type = key.end()[-1];
- key.resize(key.size() - 2);
- }
- switch (type)
- {
- // file
- case 'f':
- return FindFile(key.c_str(), Default);
-
- // directory
- case 'd':
- return FindDir(key.c_str(), Default);
-
- // bool
- case 'b':
- return FindB(key, Default) ? "true" : "false";
-
- // int
- case 'i':
- {
- char buf[16];
- snprintf(buf, sizeof(buf)-1, "%d", FindI(key, Default ? atoi(Default) : 0 ));
- return buf;
- }
- }
- // fallback
- return Find(Name, Default);
- }
- /*}}}*/
- // Configuration::CndSet - Conditinal Set a value /*{{{*/
- // ---------------------------------------------------------------------
- /* This will not overwrite */
- void Configuration::CndSet(const char *Name,const string &Value)
- {
- Item *Itm = Lookup(Name,true);
- if (Itm == 0)
- return;
- if (Itm->Value.empty() == true)
- Itm->Value = Value;
- }
- /*}}}*/
- // Configuration::Set - Set a value /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- void Configuration::Set(const char *Name,const string &Value)
- {
- Item *Itm = Lookup(Name,true);
- if (Itm == 0)
- return;
- Itm->Value = Value;
- }
- /*}}}*/
- // Configuration::Set - Set an integer value /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- void Configuration::Set(const char *Name,int Value)
- {
- Item *Itm = Lookup(Name,true);
- if (Itm == 0)
- return;
- char S[300];
- snprintf(S,sizeof(S),"%i",Value);
- Itm->Value = S;
- }
- /*}}}*/
- // Configuration::Clear - Clear an single value from a list /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- void Configuration::Clear(const string Name, int Value)
- {
- char S[300];
- snprintf(S,sizeof(S),"%i",Value);
- Clear(Name, S);
- }
- /*}}}*/
- // Configuration::Clear - Clear an single value from a list /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- void Configuration::Clear(const string Name, string Value)
- {
- Item *Top = Lookup(Name.c_str(),false);
- if (Top == 0 || Top->Child == 0)
- return;
- Item *Tmp, *Prev, *I;
- Prev = I = Top->Child;
- while(I != NULL)
- {
- if(I->Value == Value)
- {
- Tmp = I;
- // was first element, point parent to new first element
- if(Top->Child == Tmp)
- Top->Child = I->Next;
- I = I->Next;
- Prev->Next = I;
- delete Tmp;
- } else {
- Prev = I;
- I = I->Next;
- }
- }
-
- }
- /*}}}*/
- // Configuration::Clear - Clear an entire tree /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- void Configuration::Clear(string Name)
- {
- Item *Top = Lookup(Name.c_str(),false);
- if (Top == 0)
- return;
- Top->Value.clear();
- Item *Stop = Top;
- Top = Top->Child;
- Stop->Child = 0;
- for (; Top != 0;)
- {
- if (Top->Child != 0)
- {
- Top = Top->Child;
- continue;
- }
- while (Top != 0 && Top->Next == 0)
- {
- Item *Tmp = Top;
- Top = Top->Parent;
- delete Tmp;
-
- if (Top == Stop)
- return;
- }
-
- Item *Tmp = Top;
- if (Top != 0)
- Top = Top->Next;
- delete Tmp;
- }
- }
- /*}}}*/
- // Configuration::Exists - Returns true if the Name exists /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- bool Configuration::Exists(const char *Name) const
- {
- const Item *Itm = Lookup(Name);
- if (Itm == 0)
- return false;
- return true;
- }
- /*}}}*/
- // Configuration::ExistsAny - Returns true if the Name, possibly /*{{{*/
- // ---------------------------------------------------------------------
- /* qualified by /[fdbi] exists */
- bool Configuration::ExistsAny(const char *Name) const
- {
- string key = Name;
- 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);
- }
- /*}}}*/
- // Configuration::Dump - Dump the config /*{{{*/
- // ---------------------------------------------------------------------
- /* Dump the entire configuration space */
- void Configuration::Dump(ostream& str)
- {
- /* Write out all of the configuration directives by walking the
- configuration tree */
- const Configuration::Item *Top = Tree(0);
- for (; Top != 0;)
- {
- str << Top->FullTag() << " \"" << Top->Value << "\";" << endl;
-
- if (Top->Child != 0)
- {
- Top = Top->Child;
- continue;
- }
-
- while (Top != 0 && Top->Next == 0)
- Top = Top->Parent;
- if (Top != 0)
- Top = Top->Next;
- }
- }
- /*}}}*/
- // Configuration::Item::FullTag - Return the fully scoped tag /*{{{*/
- // ---------------------------------------------------------------------
- /* Stop sets an optional max recursion depth if this item is being viewed as
- part of a sub tree. */
- string Configuration::Item::FullTag(const Item *Stop) const
- {
- if (Parent == 0 || Parent->Parent == 0 || Parent == Stop)
- return Tag;
- return Parent->FullTag(Stop) + "::" + Tag;
- }
- /*}}}*/
- // ReadConfigFile - Read a configuration file /*{{{*/
- // ---------------------------------------------------------------------
- /* The configuration format is very much like the named.conf format
- used in bind8, in fact this routine can parse most named.conf files.
- Sectional config files are like bind's named.conf where there are
- sections like 'zone "foo.org" { .. };' This causes each section to be
- added in with a tag like "zone::foo.org" instead of being split
- tag/value. AsSectional enables Sectional parsing.*/
- bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
- unsigned Depth)
- {
- // Open the stream for reading
- ifstream F(FName.c_str(),ios::in);
- if (!F != 0)
- return _error->Errno("ifstream::ifstream",_("Opening configuration file %s"),FName.c_str());
- string LineBuffer;
- string Stack[100];
- unsigned int StackPos = 0;
-
- // Parser state
- string ParentTag;
-
- int CurLine = 0;
- bool InComment = false;
- while (F.eof() == false)
- {
- // The raw input line.
- std::string Input;
- // The input line with comments stripped.
- std::string Fragment;
- // Grab the next line of F and place it in Input.
- do
- {
- char *Buffer = new char[1024];
- F.clear();
- F.getline(Buffer,sizeof(Buffer) / 2);
- Input += Buffer;
- delete[] Buffer;
- }
- while (F.fail() && !F.eof());
- // Expand tabs in the input line and remove leading and trailing
- // whitespace.
- {
- const int BufferSize = Input.size() * 8 + 1;
- char *Buffer = new char[BufferSize];
- try
- {
- memcpy(Buffer, Input.c_str(), Input.size() + 1);
- _strtabexpand(Buffer, BufferSize);
- _strstrip(Buffer);
- Input = Buffer;
- }
- catch(...)
- {
- delete[] Buffer;
- throw;
- }
- delete[] Buffer;
- }
- CurLine++;
- // Now strip comments; if the whole line is contained in a
- // comment, skip this line.
- // The first meaningful character in the current fragment; will
- // be adjusted below as we remove bytes from the front.
- std::string::const_iterator Start = Input.begin();
- // The last meaningful character in the current fragment.
- std::string::const_iterator End = Input.end();
- // Multi line comment
- if (InComment == true)
- {
- for (std::string::const_iterator I = Start;
- I != End; ++I)
- {
- if (*I == '*' && I + 1 != End && I[1] == '/')
- {
- Start = I + 2;
- InComment = false;
- break;
- }
- }
- if (InComment == true)
- continue;
- }
-
- // Discard single line comments
- bool InQuote = false;
- for (std::string::const_iterator I = Start;
- I != End; ++I)
- {
- if (*I == '"')
- InQuote = !InQuote;
- if (InQuote == true)
- continue;
- if ((*I == '/' && I + 1 != End && I[1] == '/') ||
- (*I == '#' && strcmp(string(I,I+6).c_str(),"#clear") != 0 &&
- strcmp(string(I,I+8).c_str(),"#include") != 0))
- {
- End = I;
- break;
- }
- }
- // Look for multi line comments and build up the
- // fragment.
- Fragment.reserve(End - Start);
- InQuote = false;
- for (std::string::const_iterator I = Start;
- I != End; ++I)
- {
- if (*I == '"')
- InQuote = !InQuote;
- if (InQuote == true)
- Fragment.push_back(*I);
- else if (*I == '/' && I + 1 != End && I[1] == '*')
- {
- InComment = true;
- for (std::string::const_iterator J = I;
- J != End; ++J)
- {
- if (*J == '*' && J + 1 != End && J[1] == '/')
- {
- // Pretend we just finished walking over the
- // comment, and don't add anything to the output
- // fragment.
- I = J + 1;
- InComment = false;
- break;
- }
- }
-
- if (InComment == true)
- break;
- }
- else
- Fragment.push_back(*I);
- }
- // Skip blank lines.
- if (Fragment.empty())
- continue;
-
- // The line has actual content; interpret what it means.
- InQuote = false;
- Start = Fragment.begin();
- End = Fragment.end();
- for (std::string::const_iterator I = Start;
- I != End; ++I)
- {
- if (*I == '"')
- InQuote = !InQuote;
-
- if (InQuote == false && (*I == '{' || *I == ';' || *I == '}'))
- {
- // Put the last fragment into the buffer
- std::string::const_iterator NonWhitespaceStart = Start;
- std::string::const_iterator NonWhitespaceStop = I;
- for (; NonWhitespaceStart != I && isspace(*NonWhitespaceStart) != 0; NonWhitespaceStart++)
- ;
- for (; NonWhitespaceStop != NonWhitespaceStart && isspace(NonWhitespaceStop[-1]) != 0; NonWhitespaceStop--)
- ;
- if (LineBuffer.empty() == false && NonWhitespaceStop - NonWhitespaceStart != 0)
- LineBuffer += ' ';
- LineBuffer += string(NonWhitespaceStart, NonWhitespaceStop);
- // Drop this from the input string, saving the character
- // that terminated the construct we just closed. (i.e., a
- // brace or a semicolon)
- char TermChar = *I;
- Start = I + 1;
-
- // Syntax Error
- if (TermChar == '{' && LineBuffer.empty() == true)
- return _error->Error(_("Syntax error %s:%u: Block starts with no name."),FName.c_str(),CurLine);
-
- // No string on this line
- if (LineBuffer.empty() == true)
- {
- if (TermChar == '}')
- {
- if (StackPos == 0)
- ParentTag = string();
- else
- ParentTag = Stack[--StackPos];
- }
- continue;
- }
-
- // Parse off the tag
- 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);
- // Parse off the word
- string Word;
- bool NoWord = false;
- if (ParseCWord(Pos,Word) == false &&
- ParseQuoteWord(Pos,Word) == false)
- {
- if (TermChar != '{')
- {
- Word = Tag;
- Tag = "";
- }
- else
- NoWord = true;
- }
- if (strlen(Pos) != 0)
- return _error->Error(_("Syntax error %s:%u: Extra junk after value"),FName.c_str(),CurLine);
- // Go down a level
- if (TermChar == '{')
- {
- if (StackPos <= 100)
- Stack[StackPos++] = ParentTag;
-
- /* Make sectional tags incorperate the section into the
- tag string */
- if (AsSectional == true && Word.empty() == false)
- {
- Tag += "::" ;
- Tag += Word;
- Word = "";
- }
-
- if (ParentTag.empty() == true)
- ParentTag = Tag;
- else
- ParentTag += string("::") + Tag;
- Tag = string();
- }
-
- // Generate the item name
- string Item;
- if (ParentTag.empty() == true)
- Item = Tag;
- else
- {
- if (TermChar != '{' || Tag.empty() == false)
- Item = ParentTag + "::" + Tag;
- else
- Item = ParentTag;
- }
-
- // Specials
- if (Tag.length() >= 1 && Tag[0] == '#')
- {
- if (ParentTag.empty() == false)
- return _error->Error(_("Syntax error %s:%u: Directives can only be done at the top level"),FName.c_str(),CurLine);
- Tag.erase(Tag.begin());
- if (Tag == "clear")
- Conf.Clear(Word);
- else if (Tag == "include")
- {
- if (Depth > 10)
- return _error->Error(_("Syntax error %s:%u: Too many nested includes"),FName.c_str(),CurLine);
- if (Word.length() > 2 && Word.end()[-1] == '/')
- {
- if (ReadConfigDir(Conf,Word,AsSectional,Depth+1) == false)
- return _error->Error(_("Syntax error %s:%u: Included from here"),FName.c_str(),CurLine);
- }
- else
- {
- if (ReadConfigFile(Conf,Word,AsSectional,Depth+1) == false)
- return _error->Error(_("Syntax error %s:%u: Included from here"),FName.c_str(),CurLine);
- }
- }
- else
- return _error->Error(_("Syntax error %s:%u: Unsupported directive '%s'"),FName.c_str(),CurLine,Tag.c_str());
- }
- else
- {
- // Set the item in the configuration class
- if (NoWord == false)
- Conf.Set(Item,Word);
- }
-
- // Empty the buffer
- LineBuffer.clear();
-
- // Move up a tag, but only if there is no bit to parse
- if (TermChar == '}')
- {
- if (StackPos == 0)
- ParentTag.clear();
- else
- ParentTag = Stack[--StackPos];
- }
-
- }
- }
- // Store the remaining text, if any, in the current line buffer.
- // NB: could change this to use string-based operations; I'm
- // using strstrip now to ensure backwards compatibility.
- // -- dburrows 2008-04-01
- {
- char *Buffer = new char[End - Start + 1];
- try
- {
- std::copy(Start, End, Buffer);
- Buffer[End - Start] = '\0';
- const char *Stripd = _strstrip(Buffer);
- if (*Stripd != 0 && LineBuffer.empty() == false)
- LineBuffer += " ";
- LineBuffer += Stripd;
- }
- catch(...)
- {
- delete[] Buffer;
- throw;
- }
- delete[] Buffer;
- }
- }
- if (LineBuffer.empty() == false)
- return _error->Error(_("Syntax error %s:%u: Extra junk at end of file"),FName.c_str(),CurLine);
- return true;
- }
- /*}}}*/
- // ReadConfigDir - Read a directory of config files /*{{{*/
- // ---------------------------------------------------------------------
- /* */
- bool ReadConfigDir(Configuration &Conf,const string &Dir,
- bool AsSectional, unsigned Depth)
- {
- vector<string> const List = GetListOfFilesInDir(Dir, "conf", true, true);
- // Read the files
- for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++)
- if (ReadConfigFile(Conf,*I,AsSectional,Depth) == false)
- return false;
- return true;
- }
- /*}}}*/
|