summaryrefslogtreecommitdiff
path: root/server/src/macrotool_dump.cc
diff options
context:
space:
mode:
authordeva <deva>2009-07-10 09:59:41 +0000
committerdeva <deva>2009-07-10 09:59:41 +0000
commita619ccc300a00947207600e11fac848b7d37b26b (patch)
tree1fcfef3cdde2f176368b7a15f795a0ad5508687b /server/src/macrotool_dump.cc
parentca32aba4df1b021b1acaa8f0650fa6a0cd7b9d80 (diff)
Fieldname queries added macrotool.
Diffstat (limited to 'server/src/macrotool_dump.cc')
-rw-r--r--server/src/macrotool_dump.cc48
1 files changed, 2 insertions, 46 deletions
diff --git a/server/src/macrotool_dump.cc b/server/src/macrotool_dump.cc
index 9248d03..370397a 100644
--- a/server/src/macrotool_dump.cc
+++ b/server/src/macrotool_dump.cc
@@ -27,6 +27,8 @@
*/
#include "macrotool_dump.h"
+#include "macrotool_util.h"
+
#include "debug.h"
#include "macroparser.h"
@@ -36,9 +38,6 @@
#include <map>
#include <set>
-#include <sys/types.h>
-#include <dirent.h>
-
#include <config.h>
#include "configuration.h"
@@ -65,49 +64,6 @@ static const char usage_str[] =
" templates Writes template names, versions, filenames, titles and macro references to stdout.\n"
;
-
-static std::vector<std::string> listdir(std::string path)
-{
- std::vector<std::string> files;
-
- DIR* dir = opendir(path.c_str());
- if(!dir) {
- PRACRO_ERR(dump, "Could not open directory: %s\n", path.c_str());
- return files;
- }
-
- struct dirent *d;
- while((d = readdir(dir)) != 0) {
- //if(d->d_type == DT_DIR) {
- std::string name = d->d_name;
- if(name.length() >= 4 && name.substr(name.length() - 4) == ".xml")
- files.push_back(name);
- //}
- }
- closedir(dir);
-
- return files;
-}
-
-static std::vector<std::string> getMacros()
-{
- std::vector<std::string> macros = listdir(Conf::xml_basedir + "/macros");
- return macros;
-}
-
-static std::vector<std::string> getTemplates()
-{
- std::vector<std::string> templates = listdir(Conf::xml_basedir + "/templates");
- return templates;
-}
-
-static void printcolumn(std::string text, size_t width)
-{
- printf(text.c_str());
- for(size_t i = text.length(); i < width; i++) printf(" ");
- printf("\t");
-}
-
static std::map<std::string, struct _macro> macroList()
{
std::map<std::string, struct _macro> macros;