Author: cazfi
Date: Sat Dec 27 08:02:10 2014
New Revision: 27419

URL: http://svn.gna.org/viewcvs/freeciv?rev=27419&view=rev
Log:
Added gui-specific commandline parameter handling to modpack installer as was 
already
claimed by "--help", notably added '-- --help" for all guis.

See bug #23102

Modified:
    branches/S2_5/tools/mpcli.c
    branches/S2_5/tools/mpgui_gtk2.c
    branches/S2_5/tools/mpgui_gtk3.c
    branches/S2_5/tools/mpgui_qt.cpp

Modified: branches/S2_5/tools/mpcli.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/tools/mpcli.c?rev=27419&r1=27418&r2=27419&view=diff
==============================================================================
--- branches/S2_5/tools/mpcli.c (original)
+++ branches/S2_5/tools/mpcli.c Sat Dec 27 08:02:10 2014
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 
 /* utility */
+#include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
 #include "mem.h"
@@ -104,6 +105,25 @@
   ui_options = fcmp_parse_cmdline(argc, argv);
 
   if (ui_options != -1) {
+    int i;
+
+    for (i = 1; i <= ui_options; i++) {
+      if (is_option("--help", argv[i])) {
+        fc_fprintf(stderr,
+                   _("This modpack installer does not support any specific 
options\n\n"));
+
+        /* TRANS: No full stop after the URL, could cause confusion. */
+        fc_fprintf(stderr, _("Report bugs at %s\n"), BUG_URL);
+
+        ui_options = -1;
+      } else {
+        log_error(_("Unknown option '--' '%s'"), argv[i]);
+        ui_options = -1;
+      }
+    }
+  }
+
+  if (ui_options != -1) {
     const char *rev_ver = fc_svn_revision();
 
     load_install_info_lists(&fcmp);

Modified: branches/S2_5/tools/mpgui_gtk2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/tools/mpgui_gtk2.c?rev=27419&r1=27418&r2=27419&view=diff
==============================================================================
--- branches/S2_5/tools/mpgui_gtk2.c    (original)
+++ branches/S2_5/tools/mpgui_gtk2.c    Sat Dec 27 08:02:10 2014
@@ -20,6 +20,7 @@
 #include <gtk/gtk.h>
 
 /* utility */
+#include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
 #include "mem.h"
@@ -568,6 +569,23 @@
   ui_options = fcmp_parse_cmdline(argc, argv);
 
   if (ui_options != -1) {
+    int i;
+
+    for (i = 1; i <= ui_options; i++) {
+      if (is_option("--help", argv[i])) {
+        fc_fprintf(stderr,
+             _("This modpack installer accepts the standard Gtk command-line 
options\n"
+               "after '--'. See the Gtk documentation.\n\n"));
+
+        /* TRANS: No full stop after the URL, could cause confusion. */
+        fc_fprintf(stderr, _("Report bugs at %s\n"), BUG_URL);
+
+        ui_options = -1;
+      }
+    }
+  }
+
+  if (ui_options != -1) {
 
     load_install_info_lists(&fcmp);
 

Modified: branches/S2_5/tools/mpgui_gtk3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/tools/mpgui_gtk3.c?rev=27419&r1=27418&r2=27419&view=diff
==============================================================================
--- branches/S2_5/tools/mpgui_gtk3.c    (original)
+++ branches/S2_5/tools/mpgui_gtk3.c    Sat Dec 27 08:02:10 2014
@@ -20,6 +20,7 @@
 #include <gtk/gtk.h>
 
 /* utility */
+#include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
 #include "mem.h"
@@ -574,6 +575,23 @@
   ui_options = fcmp_parse_cmdline(argc, argv);
 
   if (ui_options != -1) {
+    int i;
+
+    for (i = 1; i <= ui_options; i++) {
+      if (is_option("--help", argv[i])) {
+        fc_fprintf(stderr,
+             _("This modpack installer accepts the standard Gtk command-line 
options\n"
+               "after '--'. See the Gtk documentation.\n\n"));
+
+        /* TRANS: No full stop after the URL, could cause confusion. */
+        fc_fprintf(stderr, _("Report bugs at %s\n"), BUG_URL);
+
+        ui_options = -1;
+      }
+    }
+  }
+
+  if (ui_options != -1) {
 
     load_install_info_lists(&fcmp);
 

Modified: branches/S2_5/tools/mpgui_qt.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/tools/mpgui_qt.cpp?rev=27419&r1=27418&r2=27419&view=diff
==============================================================================
--- branches/S2_5/tools/mpgui_qt.cpp    (original)
+++ branches/S2_5/tools/mpgui_qt.cpp    Sat Dec 27 08:02:10 2014
@@ -28,6 +28,7 @@
 #include <QVBoxLayout>
 
 // utility
+#include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
 
@@ -84,6 +85,23 @@
 
   /* This modifies argv! */
   ui_options = fcmp_parse_cmdline(argc, argv);
+
+  if (ui_options != -1) {
+    int i;
+
+    for (i = 1; i <= ui_options; i++) {
+      if (is_option("--help", argv[i])) {
+        fc_fprintf(stderr,
+             _("This modpack installer accepts the standard Qt command-line 
options\n"
+               "after '--'. See the Qt documentation.\n\n"));
+
+        /* TRANS: No full stop after the URL, could cause confusion. */
+        fc_fprintf(stderr, _("Report bugs at %s\n"), BUG_URL);
+
+        ui_options = -1;
+      }
+    }
+  }
 
   if (ui_options != -1) {
     QApplication *qapp;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to