Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] Re: (PR#10982) server console character-encoding bugs
Home

[Freeciv-Dev] Re: (PR#10982) server console character-encoding bugs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#10982) server console character-encoding bugs
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Nov 2004 08:47:42 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10982 >

Christian Knoke wrote:

> One problem remains. The --help output of civserver still shows corrupted
> chars in lines like
>   -G  --Guests          GÀstelogin bei Authentifizierung erlauben.
>   -i, --info INFO       ZusÀtzliche Infos fÌr den Metaserver
> 
> The output of civclient --help or civclient -- --help is ok, even without
> your patch.

This patch fixes all stderr output.  Looks like the client output was 
broken too (although it may work anyway depending on which client you use).

jason

Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.201
diff -u -r1.201 civclient.c
--- client/civclient.c  10 Nov 2004 06:21:26 -0000      1.201
+++ client/civclient.c  12 Nov 2004 16:47:17 -0000
@@ -173,37 +173,42 @@
      argv[1 + ui_options] = argv[i];
      ui_options++;
    } else if (is_option("--help", argv[i])) {
-    fprintf(stderr, _("Usage: %s [option ...]\n"
+    fc_fprintf(stderr, _("Usage: %s [option ...]\n"
                      "Valid options are:\n"), argv[0]);
-    fprintf(stderr, _("  -a, --autoconnect\tSkip connect dialog\n"));
+    fc_fprintf(stderr, _("  -a, --autoconnect\tSkip connect dialog\n"));
 #ifdef DEBUG
-    fprintf(stderr, _("  -d, --debug NUM\tSet debug log level (0 to 4,"
+    fc_fprintf(stderr, _("  -d, --debug NUM\tSet debug log level (0 to 4,"
                                   " or 4:file1,min,max:...)\n"));
 #else
-    fprintf(stderr, _("  -d, --debug NUM\tSet debug log level (0 to 3)\n"));
+    fc_fprintf(stderr,
+              _("  -d, --debug NUM\tSet debug log level (0 to 3)\n"));
 #endif
-    fprintf(stderr, _("  -h, --help\t\tPrint a summary of the options\n"));
-    fprintf(stderr, _("  -l, --log FILE\tUse FILE as logfile "
+    fc_fprintf(stderr,
+              _("  -h, --help\t\tPrint a summary of the options\n"));
+    fc_fprintf(stderr, _("  -l, --log FILE\tUse FILE as logfile "
                       "(spawned server also uses this)\n"));
-    fprintf(stderr, _("  -m, --meta HOST\t"
+    fc_fprintf(stderr, _("  -m, --meta HOST\t"
                      "Connect to the metaserver at HOST\n"));
-    fprintf(stderr, _("  -n, --name NAME\tUse NAME as name\n"));
-    fprintf(stderr, _("  -p, --port PORT\tConnect to server port PORT\n"));
-    fprintf(stderr, _("  -P, --Plugin PLUGIN\tUse PLUGIN for sound output 
%s\n"),
+    fc_fprintf(stderr, _("  -n, --name NAME\tUse NAME as name\n"));
+    fc_fprintf(stderr,
+              _("  -p, --port PORT\tConnect to server port PORT\n"));
+    fc_fprintf(stderr,
+              _("  -P, --Plugin PLUGIN\tUse PLUGIN for sound output %s\n"),
            audio_get_all_plugin_names());
-    fprintf(stderr, _("  -r, --read FILE\tRead startup script FILE "
+    fc_fprintf(stderr, _("  -r, --read FILE\tRead startup script FILE "
                       "(for spawned server only)\n"));
-    fprintf(stderr, _("  -s, --server HOST\tConnect to the server at HOST\n"));
-    fprintf(stderr, _("  -S, --Sound FILE\tRead sound tags from FILE\n"));
-    fprintf(stderr, _("  -t, --tiles FILE\t"
+    fc_fprintf(stderr,
+              _("  -s, --server HOST\tConnect to the server at HOST\n"));
+    fc_fprintf(stderr, _("  -S, --Sound FILE\tRead sound tags from FILE\n"));
+    fc_fprintf(stderr, _("  -t, --tiles FILE\t"
                      "Use data file FILE.tilespec for tiles\n"));
-    fprintf(stderr, _("  -v, --version\t\tPrint the version number\n"));
-    fprintf(stderr, _("      --\t\t"
+    fc_fprintf(stderr, _("  -v, --version\t\tPrint the version number\n"));
+    fc_fprintf(stderr, _("      --\t\t"
                      "Pass any following options to the UI.\n"
                      "\t\t\tTry \"%s -- --help\" for more.\n"), argv[0]);
     exit(EXIT_SUCCESS);
    } else if (is_option("--version",argv[i])) {
-    fprintf(stderr, "%s %s\n", freeciv_name_version(), client_string);
+    fc_fprintf(stderr, "%s %s\n", freeciv_name_version(), client_string);
     exit(EXIT_SUCCESS);
    } else if ((option = get_option("--log",argv,&i,argc))) {
       logfile = mystrdup(option); /* never free()d */
@@ -235,7 +240,7 @@
    else if (is_option("--", argv[i])) {
      ui_separator = TRUE;
    } else { 
-      fprintf(stderr, _("Unrecognized option: \"%s\"\n"), argv[i]);
+      fc_fprintf(stderr, _("Unrecognized option: \"%s\"\n"), argv[i]);
       exit(EXIT_FAILURE);
    }
    i++;
Index: client/gui-ftwl/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/gui_main.c,v
retrieving revision 1.5
diff -u -r1.5 gui_main.c
--- client/gui-ftwl/gui_main.c  9 Oct 2004 15:32:02 -0000       1.5
+++ client/gui-ftwl/gui_main.c  12 Nov 2004 16:47:18 -0000
@@ -182,19 +182,21 @@
 
   while (i < argc) {
     if (is_option("--help", argv[i])) {
-      fprintf(stderr, _("  -d, --dump\t\tEnable screen dumper\n"));
+      fc_fprintf(stderr, _("  -d, --dump\t\tEnable screen dumper\n"));
       if (be_supports_fullscreen()) {
-       fprintf(stderr,
-               _("  -f, --fullscreen\tSwitch to full-screen at start\n"));
+       fc_fprintf(stderr,
+                  _("  -f, --fullscreen\t"
+                    "Switch to full-screen at start\n"));
       }
-      fprintf(stderr, _("  -h, --help\t\tThis list\n"));
-      fprintf(stderr,
-             _
-             ("  -r, --res <res>\tUse the given resolution [Default: %s]\n"),
-             DEFAULT_RESOLUTION);
-      fprintf(stderr,
-             _("  -t, --theme <name>\tUse the given theme [Default: %s]\n"),
-             DEFAULT_THEME);
+      fc_fprintf(stderr, _("  -h, --help\t\tThis list\n"));
+      fc_fprintf(stderr,
+                _("  -r, --res <res>\t"
+                  "Use the given resolution [Default: %s]\n"),
+                DEFAULT_RESOLUTION);
+      fc_fprintf(stderr,
+                _("  -t, --theme <name>\t"
+                  "Use the given theme [Default: %s]\n"),
+                DEFAULT_THEME);
       exit(EXIT_SUCCESS);
     } else if (is_option("--dump", argv[i])) {
       freelog(LOG_NORMAL, "enabling screen dumper");
Index: client/gui-gtk/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_main.c,v
retrieving revision 1.152
diff -u -r1.152 gui_main.c
--- client/gui-gtk/gui_main.c   23 Sep 2004 20:48:08 -0000      1.152
+++ client/gui-gtk/gui_main.c   12 Nov 2004 16:47:18 -0000
@@ -159,7 +159,7 @@
 static void print_usage(const char *argv0)
 {
   /* add client-specific usage information here */
-  fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
+  fc_fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
 }
 
 /**************************************************************************
Index: client/gui-mui/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/gui_main.c,v
retrieving revision 1.86
diff -u -r1.86 gui_main.c
--- client/gui-mui/gui_main.c   29 Sep 2004 02:24:21 -0000      1.86
+++ client/gui-mui/gui_main.c   12 Nov 2004 16:47:18 -0000
@@ -47,6 +47,7 @@
 #include <proto/usergroup.h>
 
 #include "capability.h"
+#include "fciconv.h"
 #include "fcintl.h"
 #include "mem.h"
 #include "netintf.h"
@@ -104,7 +105,7 @@
 static void print_usage(const char *argv0)
 {
   /* add client-specific usage information here */
-  fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS); 
+  fc_fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS); 
 }
 
 /**************************************************************************
Index: client/gui-sdl/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_main.c,v
retrieving revision 1.45
diff -u -r1.45 gui_main.c
--- client/gui-sdl/gui_main.c   6 Sep 2004 17:13:06 -0000       1.45
+++ client/gui-sdl/gui_main.c   12 Nov 2004 16:47:18 -0000
@@ -43,14 +43,15 @@
 #include <SDL/SDL.h>
 
 #include "fcintl.h"
+#include "fciconv.h"
 #include "log.h"
-#include "game.h"
-#include "map.h"
+#include "shared.h"
+#include "support.h"
 
 #include "gui_mem.h"
 
-#include "shared.h"
-#include "support.h"
+#include "game.h"
+#include "map.h"
 #include "version.h"
 
 #include "gui_string.h"
@@ -150,9 +151,11 @@
 static void print_usage(const char *argv0)
 {
   /* add client-specific usage information here */
-  fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
-  fprintf(stderr, _("  -f,  --fullscreen\tStart Client in Fulscreen mode\n"));
-  fprintf(stderr, _("  -e,  --eventthread\tInit Event Subsystem in other 
thread (only Linux and BeOS)\n"));
+  fc_fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
+  fc_fprintf(stderr,
+            _("  -f,  --fullscreen\tStart Client in Fulscreen mode\n"));
+  fc_fprintf(stderr, _("  -e,  --eventthread\tInit Event Subsystem in "
+                      "other thread (only Linux and BeOS)\n"));
 }
 
 /**************************************************************************
Index: client/gui-stub/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/gui_main.c,v
retrieving revision 1.11
diff -u -r1.11 gui_main.c
--- client/gui-stub/gui_main.c  23 Feb 2004 20:03:56 -0000      1.11
+++ client/gui-stub/gui_main.c  12 Nov 2004 16:47:18 -0000
@@ -17,6 +17,8 @@
 
 #include <stdio.h>
 
+#include "fciconv.h"
+
 #include "options.h"
 
 #include "gui_main.h"
@@ -44,7 +46,7 @@
 void ui_main(int argc, char *argv[])
 {
   /* PORTME */
-  fprintf(stderr, "Freeciv rules!\n");
+  fc_fprintf(stderr, "Freeciv rules!\n");
 }
 
 /**************************************************************************
Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.95
diff -u -r1.95 gui_main.c
--- client/gui-xaw/gui_main.c   21 Sep 2004 01:03:57 -0000      1.95
+++ client/gui-xaw/gui_main.c   12 Nov 2004 16:47:19 -0000
@@ -223,7 +223,7 @@
 static void print_usage(const char *argv0)
 {
   /* add client-specific usage information here */
-  fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
+  fc_fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
 }
 
 /**************************************************************************
Index: server/civserver.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/civserver.c,v
retrieving revision 1.223
diff -u -r1.223 civserver.c
--- server/civserver.c  18 Oct 2004 23:49:27 -0000      1.223
+++ server/civserver.c  12 Nov 2004 16:47:19 -0000
@@ -24,6 +24,7 @@
 #include <Dialogs.h>
 #endif
 
+#include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
 #include "shared.h"
@@ -75,8 +76,8 @@
     else if ((option = get_option("--gamelog", argv, &inx, argc)))
       srvarg.gamelog_filename = option;
     else if (is_option("--nometa", argv[inx])) {
-      fprintf(stderr, _("Warning: the %s option is obsolete.  "
-                       "Use -m to enable the metaserver.\n"), argv[inx]);
+      fc_fprintf(stderr, _("Warning: the %s option is obsolete.  "
+                          "Use -m to enable the metaserver.\n"), argv[inx]);
       showhelp = TRUE;
     } else if (is_option("--meta", argv[inx]))
       srvarg.metaserver_no_send = FALSE;
@@ -117,7 +118,7 @@
     } else if (is_option("--version", argv[inx]))
       showvers = TRUE;
     else {
-      fprintf(stderr, _("Error: unknown option '%s'\n"), argv[inx]);
+      fc_fprintf(stderr, _("Error: unknown option '%s'\n"), argv[inx]);
       showhelp = TRUE;
       break;
     }
@@ -125,7 +126,7 @@
   }
 
   if (showvers && !showhelp) {
-    fprintf(stderr, "%s \n", freeciv_name_version());
+    fc_fprintf(stderr, "%s \n", freeciv_name_version());
     exit(EXIT_SUCCESS);
   }
   con_write(C_VERSION, _("This is the server for %s"), freeciv_name_version());
@@ -133,33 +134,45 @@
            WEBSITE_URL);
 
   if (showhelp) {
-    fprintf(stderr, _("Usage: %s [option ...]\nValid options are:\n"), 
argv[0]);
-    fprintf(stderr, _("  -a  --auth\t\tEnable server authentication.\n"));
-    fprintf(stderr, _("  -G  --Guests\t\tAllow guests to login if auth is 
enabled.\n"));
-    fprintf(stderr, _("  -N  --Newusers\tAllow new users to login if auth is 
enabled.\n"));
-    fprintf(stderr, _("  -b  --bind ADDR\tListen for clients on ADDR\n"));
+    fc_fprintf(stderr,
+              _("Usage: %s [option ...]\nValid options are:\n"), argv[0]);
+    fc_fprintf(stderr, _("  -a  --auth\t\tEnable server authentication.\n"));
+    fc_fprintf(stderr, _("  -G  --Guests\t\tAllow guests to "
+                        "login if auth is enabled.\n"));
+    fc_fprintf(stderr, _("  -N  --Newusers\tAllow new users to "
+                        "login if auth is enabled.\n"));
+    fc_fprintf(stderr, _("  -b  --bind ADDR\tListen for clients on ADDR\n"));
 #ifdef DEBUG
-    fprintf(stderr, _("  -d, --debug NUM\tSet debug log level (0 to 4,"
+    fc_fprintf(stderr, _("  -d, --debug NUM\tSet debug log level (0 to 4,"
                      " or 4:file1,min,max:...)\n"));
 #else
-    fprintf(stderr, _("  -d, --debug NUM\tSet debug log level (0 to 3)\n"));
+    fc_fprintf(stderr,
+              _("  -d, --debug NUM\tSet debug log level (0 to 3)\n"));
 #endif
-    fprintf(stderr, _("  -f, --file FILE\tLoad saved game FILE\n"));
-    fprintf(stderr, _("  -g, --gamelog FILE\tUse FILE as game logfile\n"));
-    fprintf(stderr, _("  -h, --help\t\tPrint a summary of the options\n"));
-    fprintf(stderr, _("  -i, --info INFO\tExtra info for the metaserver\n"));
-    fprintf(stderr, _("  -l, --log FILE\tUse FILE as logfile\n"));
-    fprintf(stderr, _("  -m, --meta\t\tNotify metaserver and send server's 
info\n"));
-    fprintf(stderr, _("  -M, --Metaserver ADDR\tSet ADDR as metaserver 
address\n"));
-
-    fprintf(stderr, _("  -p, --port PORT\tListen for clients on port PORT\n"));
-    fprintf(stderr, _("  -q, --quitidle TIME\tQuit if no players for TIME 
seconds\n"));
-    fprintf(stderr, _("  -e, --exit-on-end\t"
+    fc_fprintf(stderr, _("  -f, --file FILE\tLoad saved game FILE\n"));
+    fc_fprintf(stderr,
+              _("  -g, --gamelog FILE\tUse FILE as game logfile\n"));
+    fc_fprintf(stderr,
+              _("  -h, --help\t\tPrint a summary of the options\n"));
+    fc_fprintf(stderr,
+              _("  -i, --info INFO\tExtra info for the metaserver\n"));
+    fc_fprintf(stderr, _("  -l, --log FILE\tUse FILE as logfile\n"));
+    fc_fprintf(stderr, _("  -m, --meta\t\tNotify metaserver and "
+                        "send server's info\n"));
+    fc_fprintf(stderr, _("  -M, --Metaserver ADDR\tSet ADDR "
+                        "as metaserver address\n"));
+
+    fc_fprintf(stderr, _("  -p, --port PORT\tListen for clients on "
+                        "port PORT\n"));
+    fc_fprintf(stderr, _("  -q, --quitidle TIME\tQuit if no players "
+                        "for TIME seconds\n"));
+    fc_fprintf(stderr, _("  -e, --exit-on-end\t"
                      "When a game ends, exit instead of restarting\n"));
-    fprintf(stderr, _("  -s, --saves DIR\tSave games to directory DIR\n"));
-    fprintf(stderr, _("  -r, --read FILE\tRead startup script FILE\n"));
-    fprintf(stderr, _("  -v, --version\t\tPrint the version number\n"));
-    fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
+    fc_fprintf(stderr,
+              _("  -s, --saves DIR\tSave games to directory DIR\n"));
+    fc_fprintf(stderr, _("  -r, --read FILE\tRead startup script FILE\n"));
+    fc_fprintf(stderr, _("  -v, --version\t\tPrint the version number\n"));
+    fc_fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
     exit(EXIT_SUCCESS);
   }
 
Index: utility/shared.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/shared.c,v
retrieving revision 1.119
diff -u -r1.119 shared.c
--- utility/shared.c    18 Oct 2004 23:49:27 -0000      1.119
+++ utility/shared.c    12 Nov 2004 16:47:19 -0000
@@ -43,6 +43,7 @@
 #endif
 
 #include "astring.h"
+#include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
 #include "mem.h"
@@ -160,11 +161,11 @@
        (*i)++;
        opt = argv[*i];
        if (strlen(opt)==0) {
-         fprintf(stderr, _("Empty argument for \"%s\".\n"), option_name);
+         fc_fprintf(stderr, _("Empty argument for \"%s\".\n"), option_name);
          exit(EXIT_FAILURE);
        }
       }        else {
-       fprintf(stderr, _("Missing argument for \"%s\".\n"), option_name);
+       fc_fprintf(stderr, _("Missing argument for \"%s\".\n"), option_name);
        exit(EXIT_FAILURE);
       }
     }
@@ -1298,10 +1299,10 @@
   return;
 #else
   if (getuid()==0 || geteuid()==0) {
-    fprintf(stderr,
-           _("%s: Fatal error: you're trying to run me as superuser!\n"),
-           (argv0 ? argv0 : fallback ? fallback : "freeciv"));
-    fprintf(stderr, _("Use a non-privileged account instead.\n"));
+    fc_fprintf(stderr,
+              _("%s: Fatal error: you're trying to run me as superuser!\n"),
+              (argv0 ? argv0 : fallback ? fallback : "freeciv"));
+    fc_fprintf(stderr, _("Use a non-privileged account instead.\n"));
     exit(EXIT_FAILURE);
   }
 #endif

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