]> skyeroc.xyz Git - dgamelaunch/commitdiff
Make locale configurable.
authorPasi Kallinen <paxed@alt.org>
Tue, 4 Oct 2011 14:03:15 +0000 (14:03 +0000)
committerPasi Kallinen <paxed@alt.org>
Tue, 4 Oct 2011 14:03:15 +0000 (14:03 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@610 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

config.l
config.y
dgamelaunch.c
dgamelaunch.h
dgl-common.c
examples/dgamelaunch.conf

index 95eadb0e839bd524a51d2579fad16a6b59e4c724..0779001443c625e5b012fe41b9353d20240d586a 100644 (file)
--- a/config.l
+++ b/config.l
@@ -93,6 +93,7 @@ watch_columns { return TYPE_WATCH_COLUMNS; }
 commands       { return TYPE_CMDQUEUE; }
 postcommands   { return TYPE_POSTCMDQUEUE; }
 encoding       { return TYPE_ENCODING; }
+locale         { return TYPE_LOCALE; }
 yes            { yylval.i = 1; return TYPE_BOOL; }
 no             { yylval.i = 0; return TYPE_BOOL; }
 dglstart       { yylval.i = DGLTIME_DGLSTART; return TYPE_CMDQUEUENAME; }
index c5000719dc49ad9326273b570487ec1419f580b2..436bf67d49bc19398a08e7e25e349b2de79d2aab 100644 (file)
--- a/config.y
+++ b/config.y
@@ -59,7 +59,7 @@ static int sortmode_number(const char *sortmode_name) {
 %token TYPE_CMDQUEUE TYPE_DEFINE_MENU TYPE_BANNER_FILE TYPE_CURSOR
 %token TYPE_POSTCMDQUEUE
 %token TYPE_MAX_IDLE_TIME TYPE_MENU_MAX_IDLE_TIME TYPE_EXTRA_INFO_FILE
-%token TYPE_ENCODING
+%token TYPE_ENCODING TYPE_LOCALE
 %token <s> TYPE_VALUE
 %token <i> TYPE_NUMBER TYPE_CMDQUEUENAME
 %type  <kt> KeyType
@@ -206,6 +206,11 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']'
       globalconfig.passwd = strdup($3);
       break;
 
+    case TYPE_LOCALE:
+      if (globalconfig.locale) free(globalconfig.locale);
+      globalconfig.locale = strdup($3);
+      break;
+
     default:
       fprintf(stderr, "%s:%d: token %s does not take a string, bailing out\n",
         config, line, lookup_token($1));
@@ -622,6 +627,7 @@ KeyType : TYPE_SUSER        { $$ = TYPE_SUSER; }
        | TYPE_PATH_LOCKFILE    { $$ = TYPE_PATH_LOCKFILE; }
        | TYPE_PATH_INPROGRESS  { $$ = TYPE_PATH_INPROGRESS; }
        | TYPE_ENCODING         { $$ = TYPE_ENCODING; }
+       | TYPE_LOCALE           { $$ = TYPE_LOCALE; }
        | TYPE_RC_FMT           { $$ = TYPE_RC_FMT; }
        | TYPE_WATCH_SORTMODE   { $$ = TYPE_WATCH_SORTMODE; }
        | TYPE_SERVER_ID        { $$ = TYPE_SERVER_ID; }
@@ -657,6 +663,7 @@ const char* lookup_token (int t)
     case TYPE_WATCH_SORTMODE: return "sortmode";
     case TYPE_WATCH_COLUMNS: return "watch_columns";
     case TYPE_SERVER_ID: return "server_id";
+    case TYPE_LOCALE: return "locale";
     default: abort();
   }
 }
index 436ad6e8a0f37a3e4936e4733d8c45d79e195520..10c5cee1fe446eb41ae287660a366c9908670d8a 100644 (file)
@@ -2687,7 +2687,9 @@ main (int argc, char** argv)
        }
     }
 
-  setlocale(LC_CTYPE, "en_US.UTF-8");
+  if (globalconfig.locale) {
+      setlocale(LC_CTYPE, globalconfig.locale);
+  }
 
   if (showplayers) {
     inprogressdisplay(-1);
index 41cc7645b1b5d4ffd83f6083a5ffb8745caa88e0..7f7daec52c30b27089b592469a71fef0f063d4ac 100644 (file)
@@ -225,6 +225,7 @@ struct dg_globalconfig
     int allow_registration; /* allow registering new nicks */
     int sortmode; /* default watching-screen sortmode */
     char *server_id; /* string for the server name or whatever */
+    char *locale;
 
     struct dg_cmdpart *cmdqueue[NUM_DGLTIMES];
 
index d8d5044426417dfc9c363adf3d58cda63c88d34b..a3c7e4265ed07440315a17588724f2ca09ffd6a0 100644 (file)
@@ -738,6 +738,7 @@ create_config ()
   if (!globalconfig.allow_registration) globalconfig.allow_registration = 1;
   globalconfig.menulist = NULL;
   globalconfig.server_id = NULL;
+  globalconfig.locale = NULL;
 
   globalconfig.shed_uid = (uid_t)-1;
   globalconfig.shed_gid = (gid_t)-1;
index cd78773b98cebd80ee00e7b54a1cedb31f8afe6e..bd9868307b7922f233ca348463a3534e6a543c2d 100644 (file)
@@ -74,6 +74,9 @@ banner = "/dgl-banner"
 shed_uid = 5
 shed_gid = 60
 
+# Locale. Leaving this out, dgamelaunch will not explicitly set locale.
+locale = "en_US.UTF-8"
+
 # Maximum time in seconds user can idle in the dgamelaunch menus
 # before dgl exits. Default value is 0, which disables the idling timer.
 # Does not apply to external programs or config editors.