Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11718) bug in civserver console
Home

[Freeciv-Dev] (PR#11718) bug in civserver console

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: booktinker@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#11718) bug in civserver console
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Dec 2004 13:39:47 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11718 >

Good report.  Here's a patch (for 2.0 and dev branches).

-jason

? diff
? gmon.out
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.373
diff -u -r1.373 stdinhand.c
--- server/stdinhand.c  24 Dec 2004 16:56:36 -0000      1.373
+++ server/stdinhand.c  30 Dec 2004 21:37:18 -0000
@@ -1544,14 +1544,19 @@
 
   if (*command != '\0') {
     cmd=lookup_option(command);
-    if (cmd==-1) {
-      cmd_reply(CMD_EXPLAIN, caller, C_FAIL, _("No explanation for that 
yet."));
+    if (cmd >= 0 && cmd < SETTINGS_NUM) {
+      show_help_option(caller, CMD_EXPLAIN, cmd);
+    } else if (cmd == -1 || cmd == -3) {
+      cmd_reply(CMD_EXPLAIN, caller, C_FAIL,
+               _("No explanation for that yet."));
       return FALSE;
-    } else if (cmd==-2) {
+    } else if (cmd == -2) {
       cmd_reply(CMD_EXPLAIN, caller, C_FAIL, _("Ambiguous option name."));
       return FALSE;
     } else {
-      show_help_option(caller, CMD_EXPLAIN, cmd);
+      freelog(LOG_ERROR, "Unexpected case %d in %s line %d",
+             cmd, __FILE__, __LINE__);
+      return FALSE;
     }
   } else {
     show_help_option_list(caller, CMD_EXPLAIN);

[Prev in Thread] Current Thread [Next in Thread]