Ignore case while comparing encoding names

git-svn-id: svn://kolibrios.org@7045 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
ashmew2 2017-10-03 21:56:34 +00:00
parent f44791aeb7
commit 71ef8794b4

View File

@ -1,4 +1,4 @@
//#include <string.h> #include <string.h>
//#include <stdio.h> //#include <stdio.h>
typedef unsigned int size_t; typedef unsigned int size_t;
#define NULL ((void*)0) #define NULL ((void*)0)
@ -30,15 +30,6 @@ typedef int iconv_t;
#define ISO8859_5 4 #define ISO8859_5 4
#define UTF_8 5 #define UTF_8 5
int strcmp (const char* a, const char* b)
{
return (*a && *b && (*a == *b)) ? ((*(a+1) || *(b+1)) ? (strcmp(a+1, b+1)) : (0)) : ((*a > *b) ? (1) : (-1));
}
#include "cp866.h" #include "cp866.h"
#include "cp1251.h" #include "cp1251.h"
#include "cp1252.h" #include "cp1252.h"
@ -46,7 +37,6 @@ int strcmp (const char* a, const char* b)
#include "iso8859_5.h" #include "iso8859_5.h"
#include "utf8.h" #include "utf8.h"
int encoding(char *what) { int encoding(char *what) {
/* Ignore //TRANSLIT or //IGNORE for now. */ /* Ignore //TRANSLIT or //IGNORE for now. */
@ -58,14 +48,13 @@ int encoding(char *what) {
} }
} }
if (!strcmp(what,"CP866")) return CP866; if (!strcasecmp(what,"CP866")) return CP866;
if (!strcmp(what,"CP1251")) return CP1251; if (!strcasecmp(what,"CP1251")) return CP1251;
if (!strcmp(what,"windows-1252")) return CP1252; if (!strcasecmp(what,"windows-1252")) return CP1252;
if (!strcmp(what,"Windows-1252")) return CP1252; if (!strcasecmp(what,"CP1252")) return CP1252;
if (!strcmp(what,"CP1252")) return CP1252; if (!strcasecmp(what,"KOI8-RU")) return KOI8_RU;
if (!strcmp(what,"KOI8-RU")) return KOI8_RU; if (!strcasecmp(what,"ISO8859-5")) return ISO8859_5;
if (!strcmp(what,"ISO8859-5")) return ISO8859_5; if (!strcasecmp(what,"UTF-8")) return UTF_8;
if (!strcmp(what,"UTF-8")) return UTF_8;
return -1; return -1;
} }