]> git.mxchange.org Git - flightgear.git/commitdiff
fgelev: Work on stdin/stdout like the previous one did.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Fri, 24 Aug 2012 19:20:44 +0000 (21:20 +0200)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Fri, 24 Aug 2012 19:24:19 +0000 (21:24 +0200)
Instead of working on arguments work on stdin and stdout.
Note that this version still does not page out.

utils/fgelev/fgelev.cxx

index 20a093e3555d7574f997e6adf3c597504822e1f9..c8352bdaf142884e2ec04abfad3136d2f2904f9f 100644 (file)
@@ -303,18 +303,14 @@ main(int argc, char** argv)
         return EXIT_FAILURE;
     }
 
-    // now handle all the position pairs
-    for(int i = 1; i < arguments.argc(); ++i) {
-        if (arguments.isOption(i))
-            continue;
-
-        std::istringstream ss(arguments[i]);
+    while (std::cin.good()) {
+        std::string id;
+        std::cin >> id;
         double lon, lat;
-        char sep;
-        ss >> lon >> sep >> lat;
-        if (ss.fail()) {
+        std::cin >> lon >> lat;
+        if (std::cin.fail())
             return EXIT_FAILURE;
-        }
+        std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
 
         SGVec3d start = SGVec3d::fromGeod(SGGeod::fromDegM(lon, lat, 10000));
         SGVec3d end = SGVec3d::fromGeod(SGGeod::fromDegM(lon, lat, -1000));
@@ -322,7 +318,7 @@ main(int argc, char** argv)
         intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
         loadedModel->accept(intersectVisitor);
 
-        std::cout << arguments[i] << ": ";
+        std::cout << id << ": ";
         if (!intersectVisitor.getHaveHit()) {
             std::cout << "-1000" << std::endl;
         } else {