+void ParseStack::DoReadFile(const std::string& key, const std::string& name, int flags, bool exec)
+{
+ if (flags & FLAG_NO_INC)
+ throw CoreException("Invalid <files> tag in file included with noinclude=\"yes\"");
+ if (exec && (flags & FLAG_NO_EXEC))
+ throw CoreException("Invalid <execfiles> tag in file included with noexec=\"yes\"");
+
+ FileWrapper file(exec ? popen(name.c_str(), "r") : fopen(name.c_str(), "r"), exec);
+ if (!file)
+ throw CoreException("Could not read \"" + name + "\" for \"" + key + "\" file");
+
+ file_cache& cache = FilesOutput[key];
+ cache.clear();
+
+ char linebuf[MAXBUF*10];
+ while (fgets(linebuf, sizeof(linebuf), file))
+ {
+ size_t len = strlen(linebuf);
+ if (len)
+ {
+ if (linebuf[len-1] == '\n')
+ len--;
+ cache.push_back(std::string(linebuf, len));
+ }
+ }
+}
+
+bool ParseStack::ParseFile(const std::string& name, int flags, const std::string& mandatory_tag)