[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-XBoard] Infinite recursion
From: |
Byrial Jensen |
Subject: |
Re: [Bug-XBoard] Infinite recursion |
Date: |
Thu, 12 Apr 2012 16:19:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120411 Thunderbird/11.0.1 |
Den 12-04-2012 11:54, h.g. muller skrev:
If Xboard is dependent on untranslated error messages from libc, it
should run the engines in the C locale. It can be done by calling
putenv("LANGUAGE=C") in the child proces before the exec() call.
It is not that simple. One would want the engines to run in the same
locale as XBoard, in order to get translation of the engine-defined
options in the Engine Settings dialogs. The libc messages that are
recognized by XBoard are supposed to come from intermediaries like
ssh, which you typically use when you run the engines on a remote
machine (using -firstHost, -secondHost). This is needed because such
interediaries might not exit when they fail to execute the engine
binary. The engine itself, when run locally, can inform XBoard of its
failure to start by simply quitting. Failure to exectute the engine is
announced by XBoard to itself (i.e. from the child process to the main
process through the pipe) using perror(), which presumably would use
the current locale. So perhaps we should make the child switch to the
C locale after exec failure, before using perror(). Is that possible?
Yes it is possible to change locale at any time. In order to force
gettext to notice the change, you can use the this code according to the
gettext manual:
extern int _nl_msg_cat_cntr;
++_nl_msg_cat_cntr;
However if exec fails, or if the child cannot change to the engine
directory, it could just send some recognizable code which an engine
never would use, followed by the localized perror() message.