This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch upstream-master
in repository pktools.

commit d10f2215117a9a091bf3710cad4cdf7fc6c09647
Author: Pieter Kempeneers <kempe...@gmail.com>
Date:   Fri Dec 27 09:17:56 2013 +0100

    check of mandatory options are present
---
 src/apps/pkascii2ogr.cc |  8 ++++++++
 src/apps/pkcrop.cc      |  8 ++++----
 src/apps/pkextract.cc   | 17 +++++++++++++----
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/apps/pkascii2ogr.cc b/src/apps/pkascii2ogr.cc
index a502ce6..eb20f41 100644
--- a/src/apps/pkascii2ogr.cc
+++ b/src/apps/pkascii2ogr.cc
@@ -59,6 +59,14 @@ int main(int argc, char *argv[])
     std::cout << "short option -h shows basic options only, use long option 
--help to show all options" << std::endl;
     exit(0);//help was invoked, stop processing
   }
+  if(input_opt.empty()){
+    std::cerr << "No input file provided (use option -i). Use --help for help 
information";
+    exit(0);
+  }
+ if(output_opt.empty()){
+   std::cerr << "No output file provided (use option -o). Use --help for help 
information";
+      exit(0);
+  }
 
   string theProjection;
   theProjection=projection_opt[0];
diff --git a/src/apps/pkcrop.cc b/src/apps/pkcrop.cc
index 32e986d..a05dfa1 100644
--- a/src/apps/pkcrop.cc
+++ b/src/apps/pkcrop.cc
@@ -103,12 +103,12 @@ int main(int argc, char *argv[])
     exit(0);//help was invoked, stop processing
   }
   if(input_opt.empty()){
-    std::cerr << "No input file provided (use option -i). Use pkinfo --help 
for help information" << std::endl;
-    exit(0);//help was invoked, stop processing
+    std::cerr << "No input file provided (use option -i). Use --help for help 
information" << std::endl;
+    exit(0);
   }
   if(output_opt.empty()){
-    std::cerr << "No output file provided (use option -o). Use pkinfo --help 
for help information" << std::endl;
-    exit(0);//help was invoked, stop processing
+    std::cerr << "No output file provided (use option -o). Use --help for help 
information" << std::endl;
+    exit(0);
   }
 
   short nodataValue=nodata_opt.size()? nodata_opt[0] : 0;
diff --git a/src/apps/pkextract.cc b/src/apps/pkextract.cc
index 17c5b76..8d3eb51 100644
--- a/src/apps/pkextract.cc
+++ b/src/apps/pkextract.cc
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
   Optionpk<string> label_opt("cn", "cname", "name of the class label in the 
output vector file", "label");
   Optionpk<bool> polygon_opt("polygon", "polygon", "create OGRPolygon as 
geometry instead of OGRPoint. Only if sample option is also of polygon type.", 
false);
   Optionpk<int> band_opt("b", "band", "band index to crop. Use -1 to use all 
bands)", -1);
-  Optionpk<string> rule_opt("r", "rule", "rule how to report image information 
per feature. point (value at each point or at centroid of the polygon if line 
is set), centroid, mean (mean value written to centroid of polygon if line is 
set), proportion, minimum (of polygon), maximum (of polygon), maxvote.", 
"point");
+  Optionpk<string> rule_opt("r", "rule", "rule how to report image information 
per feature. point (value at each point or at centroid if polygon), centroid, 
mean (of polygon), proportion, minimum (of polygon), maximum (of polygon), 
maxvote.", "point");
   Optionpk<short> verbose_opt("v", "verbose", "verbose mode if > 0", 0);
 
   bool doProcess;//stop process when program was invoked with help option (-h 
--help)
@@ -128,8 +128,18 @@ int main(int argc, char *argv[])
   if(verbose_opt[0]>1)
     std::cout << "boundary: " << boundary_opt[0] << std::endl;
   ImgReaderGdal imgReader;
-  assert(image_opt.size());
-  assert(output_opt.size());
+  if(image_opt.empty()){
+    std::cerr << "No image file provided (use option -i). Use --help for help 
information";
+      exit(0);//help was invoked, stop processing
+  }
+  if(output_opt.empty()){
+    std::cerr << "No output file provided (use option -o). Use --help for help 
information";
+      exit(0);//help was invoked, stop processing
+  }
+  if(sample_opt.empty()){
+    std::cerr << "No sample file provided (use option -s). Use --help for help 
information";
+    exit(0);//help was invoked, stop processing
+  }
   try{
     imgReader.open(image_opt[0]);
   }
@@ -228,7 +238,6 @@ int main(int argc, char *argv[])
   double progress=0;
   srandom(time(NULL));
 
-  assert(sample_opt.size());
   if((sample_opt[0].find(".tif"))!=std::string::npos){//raster file
     if(class_opt.empty()){
       std::cout << "Warning: no classes selected, if classes must be 
extracted, set to -1 for all classes using option -c -1" << std::endl;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-grass/pktools.git

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to