DEADSOFTWARE

cp866: move to common/
[flatwaifu.git] / src / config.c
index 1980bc61ec2986f13e9d82bfe4100a47abecfa9e..86b6d227c96893cbc7cde91cdc83ca5c31a7f406 100644 (file)
@@ -1,24 +1,17 @@
-/*
-   Copyright (C) Prikol Software 1996-1997
-   Copyright (C) Aleksey Volynskov 1996-1997
-   Copyright (C) <ARembo@gmail.com> 2011
-
-   This file is part of the Doom2D:Rembo project.
-
-   Doom2D:Rembo is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License version 2 as
-   published by the Free Software Foundation.
-
-   Doom2D:Rembo is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/> or
-   write to the Free Software Foundation, Inc.,
-   51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
-*/
+/* Copyright (C) 2020 SovietPony
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
 
 #include "glob.h"
 #include <stdio.h>
@@ -30,6 +23,8 @@
 #include "files.h"
 #include "input.h"
 
+#include "common/cp866.h"
+
 static FILE *f;
 static int ch;
 
@@ -37,7 +32,7 @@ const cfg_t *CFG_find_entry (const char *key, const cfg_t *cfg) {
   assert(key != NULL);
   if (cfg != NULL) {
     int i = 0;
-    while (cfg[i].cfg && strcasecmp(cfg[i].cfg, key) != 0) {
+    while (cfg[i].cfg && cp866_strcasecmp(cfg[i].cfg, key) != 0) {
       i++;
     }
     return cfg[i].cfg ? &cfg[i] : NULL;
@@ -57,8 +52,8 @@ int CFG_update_key (const char *key, const char *value, const cfg_t *cfg) {
       case Y_WORD: *(word*)p = atoi(value); break;
       case Y_DWORD: *(dword*)p = atoi(value); break;
       case Y_STRING: strcpy(p, value); break; // TODO fix this security problem
-      case Y_SW_ON: *(byte*)p = strcasecmp(value, "on") == 0 ? 1 : 0; break;
-      case Y_SW_OFF: *(byte*)p = strcasecmp(value, "off") == 0 ? 1 : 0; break;
+      case Y_SW_ON: *(byte*)p = cp866_strcasecmp(value, "on") == 0 ? 1 : 0; break;
+      case Y_SW_OFF: *(byte*)p = cp866_strcasecmp(value, "off") == 0 ? 1 : 0; break;
       case Y_FILES: F_addwad(value); break;
       case Y_KEY: *(int*)p = I_string_to_key(value); break;
       default: assert(0); // unknown type -> something broken