setSize() in run client.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 15 Oct 2013 18:24:29 +0000 (20:24 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 16 Oct 2013 17:49:07 +0000 (19:49 +0200)
run.cpp

diff --git a/run.cpp b/run.cpp
index 7608027..9f438f4 100644 (file)
--- a/run.cpp
+++ b/run.cpp
@@ -12,13 +12,14 @@ int main(int argc, char *argv[]) {
        std::string conf = DMLITE_DEFAULT_CONF;
 
        if (argc < 3) {
-               std::cout << "Usage: " << argv[0] << " [ DMLITE_CONFIGFILE [ s | d | h | (r|w|c) [PATH] ] ]" << std::endl;
+               std::cout << "Usage: " << argv[0] << " [ DMLITE_CONFIGFILE [ s | d | h | (r|w|c) [PATH] | z [PATH [SIZE]] ] ]" << std::endl;
                std::cout << "  s ... stat" << std::endl;
                std::cout << "  d ... opendir/readdir" << std::endl;
                std::cout << "  r ... read" << std::endl;
                std::cout << "  h ... chdir" << std::endl;
                std::cout << "  w ... whereToWrite" << std::endl;
                std::cout << "  c ... create" << std::endl;
+               std::cout << "  z ... setSize" << std::endl;
        }
 
        if (argc >= 2) conf = argv[1];
@@ -185,6 +186,22 @@ int main(int argc, char *argv[]) {
                        return e.code();
                }
                break;
+
+       case 'z':
+               try {
+                       std::string path;
+                       size_t size;
+
+                       path = "/tmp/pokus";
+                       size = 20000;
+                       if (argc >= 4) path = argv[3];
+                       if (argc >= 5) size = atoll(argv[4]);
+                       catalog->setSize(path, size);
+               } catch (dmlite::DmException& e) {
+                       std::cout << "Could not set size." << std::endl
+                                 << "Reason: " << e.what() << std::endl;
+                       return e.code();
+               }
        }
 
 //     delete catalog;