[passepartout] prepare getxsltparams to become a real testcase



commit 0903531e49be103a5178e8c8faf41ce63e1911b3
Author: Sven Herzberg <herzi lanedo com>
Date:   Tue Apr 28 13:07:13 2009 +0200

    prepare getxsltparams to become a real testcase
    
    * src/pptout/document/getxsltparams.cc: receive a command line argument;
      fail if no argument was passed or if the xslt file didn't contain parameters
---
 src/pptout/document/getxsltparams.cc |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/pptout/document/getxsltparams.cc b/src/pptout/document/getxsltparams.cc
index c0cbcf5..ae08bf8 100644
--- a/src/pptout/document/getxsltparams.cc
+++ b/src/pptout/document/getxsltparams.cc
@@ -60,8 +60,25 @@ std::vector<std::string> getXsltParams(const std::string& source) {
 #ifdef STANDALONE
 #include <iostream>
 
-int main() {
-  std::vector<std::string> params = getXsltParams ("/home/kaj/proj/emission/emissionxml/passepartout/teaser.xslt");
+int
+main (int   argc,
+      char**argv)
+{
+  if (argc <= 1)
+    {
+      std::cerr << "Usage:" << std::endl
+                << "\t" << argv[0] << " <xslt-file>" << std::endl;
+      return 1;
+    }
+
+  std::vector<std::string> params = getXsltParams (argv[1]);
+
+  if (params.size () <= 0)
+    {
+      std::cerr << "File \"" << argv[1] << "\" didn't contain parameters" << std::endl;
+      return 2;
+    }
+
   for(std::vector<std::string>::const_iterator i = params.begin();
       i != params.end(); ++i) {
     std::cout << "Found parameter: " << *i << std::endl;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]