summaryrefslogtreecommitdiff
path: root/server/src/macrotool_dump.cc
diff options
context:
space:
mode:
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;