]> git.mxchange.org Git - flightgear.git/commitdiff
don't run the help browser from a property that a user could have
authormfranz <mfranz>
Wed, 9 Jul 2008 19:35:53 +0000 (19:35 +0000)
committermfranz <mfranz>
Wed, 9 Jul 2008 19:35:53 +0000 (19:35 +0000)
changed to something evil, but rather make sure that the browser
string can be trusted. (TODO: change system() to vfork()/execvp() ?)

src/GUI/gui_funcs.cxx
src/Main/fg_init.cxx
src/Main/globals.hxx

index 2c96b0e3171db24576918145162e78e1be342dad..ac2e7d4b641648b2cdf6a3be9e348952dcabfc63 100644 (file)
@@ -101,9 +101,6 @@ extern void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
 
 
 const __fg_gui_fn_t __fg_gui_fn[] = {
-
-        // File
-        {"reInit", reInit},
 #ifdef TR_HIRES_SNAP
         {"dumpHiResSnapShot", fgHiResDumpWrapper},
 #endif
@@ -214,13 +211,13 @@ void helpCb ()
        
 #if !defined(WIN32)
 
-    string help_app = fgGetString("/sim/startup/browser-app");
+    command = globals->get_browser();
+    string::size_type pos;
+    if ((pos = command.find("%u", 0)) != string::npos)
+        command.replace(pos, 2, path.str());
+    else
+        command += " " + path.str();
 
-    if ( system("xwininfo -name Netscape > /dev/null 2>&1") == 0 ) {
-        command = help_app + " -remote \"openURL(" + path.str() + ")\"";
-    } else {
-        command = help_app + " " + path.str();
-    }
     command += " &";
     system( command.c_str() );
 
index 6a83efb412f6cf2edaac395fce3603b03fff971b..e52616ab2815f364839ad264ff768200edec559c 100644 (file)
@@ -1390,6 +1390,8 @@ bool fgInitGeneral() {
     }
     SG_LOG( SG_GENERAL, SG_INFO, "FG_ROOT = " << '"' << root << '"' << endl );
 
+    globals->set_browser(fgGetString("/sim/startup/browser-app", "firefox %u"));
+
 #if defined(FX) && defined(XMESA)
     // initialize full screen flag
     globals->set_fullscreen(false);
index 9182326ee245bd0f01545bdb33ae3af4e139a137..0d830b3bb7ada01763d25fae814cc5dfe8c86ba0 100644 (file)
@@ -116,6 +116,8 @@ private:
     // Roots of FlightGear scenery tree
     string_list fg_scenery;
 
+    string browser;
+
     // Fullscreen mode for old 3DFX cards.
 #if defined(FX) && defined(XMESA)
     bool fullscreen;
@@ -238,6 +240,9 @@ public:
     inline const string_list &get_fg_scenery () const { return fg_scenery; }
     void set_fg_scenery (const string &scenery);
 
+    inline const string &get_browser () const { return browser; }
+    void set_browser (const string &b) { browser = b; }
+
 #if defined(FX) && defined(XMESA)
     inline bool get_fullscreen() const { return fullscreen; }
     inline bool set_fullscreen( bool f ) { fullscreen = f; }