]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/metar_main.cxx
Reduce amount of log output at level=debug.
[flightgear.git] / src / Main / metar_main.cxx
index 7b904d3a245f492f97246ca1a2613c766926557e..40883409ed609a5a29396f44d8dfd90fa61e20a1 100644 (file)
@@ -26,6 +26,9 @@
 #include <string.h>
 #include <time.h>
 #include <cstdlib>
+#include <cstdio>
+
+#include <boost/algorithm/string.hpp>
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/environment/metar.hxx>
@@ -33,6 +36,7 @@
 
 #include <simgear/io/HTTPClient.hxx>
 #include <simgear/io/HTTPRequest.hxx>
+#include <simgear/io/raw_socket.hxx>
 #include <simgear/timing/timestamp.hxx>
 
 using namespace std;
@@ -47,7 +51,7 @@ public:
     bool fromProxy;
     
     MetarRequest(const std::string& stationId) : 
-        HTTP::Request("http://weather.noaa.gov/pub/data/observations/metar/stations/" + stationId + ".TXT"),
+        HTTP::Request("http://weather.noaa.gov/pub/data/observations/metar/stations/" + boost::to_upper_copy(stationId) + ".TXT"),
         complete(false),
         failed(false)
     {
@@ -328,7 +332,7 @@ void printReport(SGMetar *m)
                        surface.push_back(buf);
                }
 
-               if (surface.size()) {
+               if (! surface.empty()) {
                        vector<string>::iterator rwysurf = surface.begin();
                        for (i = 0; rwysurf != surface.end(); rwysurf++, i++) {
                                if (i)
@@ -547,6 +551,8 @@ int main(int argc, char *argv[])
        string proxy_host, proxy_port;
        getproxy(proxy_host, proxy_port);
 
+  Socket::initSockets();
+  
     HTTP::Client http;
     http.setProxy(proxy_host, atoi(proxy_port.c_str()));