diff options
author | pgen <p.gen.progs@gmail.com> | 2015-11-24 22:20:48 +0100 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2015-11-24 22:20:48 +0100 |
commit | 85319900bb5f5c846e8ecc931852a145b11cbb7b (patch) | |
tree | 16747f120958d7c2d98172bbb50681ed2f40d68e | |
parent | 65c235497dcb91c6e62ad571f2d1d3fe6efa3611 (diff) |
Ignore the case when checking the current charset
-rw-r--r-- | smenu.c | 26 | ||||
-rw-r--r-- | smenu.h | 2 |
2 files changed, 27 insertions, 1 deletions
@@ -1155,6 +1155,30 @@ get_cursor_position(int *const r, int *const c) /* Strings and multibyte strings utility functions */ /* *********************************************** */ +/* ========================================= */ +/* Case insensitive strcmp */ +/* from http://c.snippets.org/code/stricmp.c */ +/* ========================================= */ +int +my_stricmp(const char *str1, const char *str2) +{ + int retval = 0; + + while (1) + { + retval = tolower(*str1++) - tolower(*str2++); + + if (retval) + break; + + if (*str1 && *str2) + continue; + else + break; + } + return retval; +} + /* ====================================================================== */ /* Parse a columns description string */ /* <letter><range1>,<range2>,... */ @@ -3689,7 +3713,7 @@ main(int argc, char *argv[]) while (charset_ptr->name != NULL) { - if (strcmp(charset, charset_ptr->name) == 0) + if (my_stricmp(charset, charset_ptr->name) == 0) { is_supported_charset = 1; langinfo.bits = charset_ptr->bits; @@ -41,6 +41,8 @@ void ll_init(ll_t * list); ll_node_t *ll_new_node(void); ll_t *ll_new(void); +int my_stricmp(const char *str1, const char *str2); + int isprint7(int i); int isprint8(int i); |