src/main.c

changeset 69
c8f2c280cff7
parent 55
54ea19938d57
--- a/src/main.c	Wed Aug 29 17:31:36 2018 +0200
+++ b/src/main.c	Tue Sep 18 15:02:08 2018 +0200
@@ -34,6 +34,7 @@
 #include <string.h>
 #include <time.h>
 #include <getopt.h>
+#include <locale.h>
 
 int get_settings(int argc, char **argv, Settings *settings) {
     char *valid;
@@ -41,7 +42,7 @@
     uint8_t timeunit = 60;
     size_t len;
     
-    for (int opt ; (opt = getopt(argc, argv, "a:bc:hp:rsS:t:v")) != -1 ;) {
+    for (int opt ; (opt = getopt(argc, argv, "a:bc:hp:rsS:t:Uv")) != -1 ;) {
         switch (opt) {
         case 'c':
             settings->continuepgn = optarg;
@@ -58,6 +59,9 @@
         case 'S':
             settings->analyzepgn = optarg;
             break;
+        case 'U':
+            settings->unicode = 0;
+            break;
         case 't':
         case 'a':
             len = strlen(optarg);
@@ -114,6 +118,7 @@
 "  -r            Distribute color randomly\n"
 "  -s            Single machine mode\n"
 "  -t <time>     Specifies time limit (default: no limit)\n"
+"  -U            Disables unicode pieces\n"
 "\nNotes\n"
 "The time unit for -a is seconds and for -t minutes by default. To "
 "specify\nseconds for the -t option, use the s suffix.\n"
@@ -151,6 +156,7 @@
     memset(&settings, 0, sizeof(Settings));
     settings.gameinfo.servercolor = WHITE;
     settings.port = "27015";
+    settings.unicode = !!setlocale(LC_CTYPE, "C.UTF-8");
     return settings;
 }
 

mercurial