From d80c8e9e575239553719b4991b40e2dca6e6478e Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 3 Sep 2005 12:37:20 +0000 Subject: [PATCH] Fixed bug with strings comparison (str[n]casecmp) and some locales (like turkish), now using ASCII comparison --- ChangeLog | 4 +- po/fr.po | 4 +- src/common/command.c | 102 ++++++++++----------- src/common/completion.c | 116 ++++++++++++------------ src/common/weechat.c | 76 +++++++++++++++- src/common/weechat.h | 2 + src/common/weeconfig.c | 52 +++++------ src/common/weelist.c | 4 +- src/gui/curses/gui-display.c | 4 +- src/gui/gtk/gui-display.c | 4 +- src/gui/gui-keyboard.c | 18 ++-- src/irc/irc-channel.c | 2 +- src/irc/irc-nick.c | 13 ++- src/irc/irc-recv.c | 12 +-- src/irc/irc-send.c | 4 +- src/plugins/perl/wee-perl.c | 36 ++++---- src/plugins/plugins.c | 6 +- src/plugins/python/wee-python.c | 18 ++-- src/plugins/ruby/wee-ruby.c | 18 ++-- weechat/ChangeLog | 4 +- weechat/po/fr.po | 4 +- weechat/src/common/command.c | 102 ++++++++++----------- weechat/src/common/completion.c | 116 ++++++++++++------------ weechat/src/common/weechat.c | 76 +++++++++++++++- weechat/src/common/weechat.h | 2 + weechat/src/common/weeconfig.c | 52 +++++------ weechat/src/common/weelist.c | 4 +- weechat/src/gui/curses/gui-display.c | 4 +- weechat/src/gui/gtk/gui-display.c | 4 +- weechat/src/gui/gui-keyboard.c | 18 ++-- weechat/src/irc/irc-channel.c | 2 +- weechat/src/irc/irc-nick.c | 13 ++- weechat/src/irc/irc-recv.c | 12 +-- weechat/src/irc/irc-send.c | 4 +- weechat/src/plugins/perl/wee-perl.c | 36 ++++---- weechat/src/plugins/plugins.c | 6 +- weechat/src/plugins/python/wee-python.c | 18 ++-- weechat/src/plugins/ruby/wee-ruby.c | 18 ++-- 38 files changed, 570 insertions(+), 420 deletions(-) diff --git a/ChangeLog b/ChangeLog index cbd894b76..71729de09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2005-09-02 +ChangeLog - 2005-09-03 Version 0.1.5 (under dev!): + * fixed bug with strings comparison (str[n]casecmp) and some locales + (like turkish), now using ASCII comparison (thanks to roktas) * signal SIGQUIT is now ignored * fixed refresh bug when one line is bigger than screen size * fixed look_nicklist_min_size and look_nicklist_max_size options diff --git a/po/fr.po b/po/fr.po index 677ab91cd..2bd279e77 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: WeeChat 0.1.5-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "POT-Creation-Date: 2005-08-21 14:31+0200\n" -"PO-Revision-Date: 2005-08-21 14:31+0200\n" +"PO-Revision-Date: 2005-09-03 13:24+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2673,7 +2673,7 @@ msgstr "%s l'alias ou la commande \"%s\" existe d #: src/common/command.c:282 #, c-format msgid "%s alias cannot run another alias!\n" -msgstr "%s l'alias ne peux pas lancer un autre alias !\n" +msgstr "%s l'alias ne peut pas lancer un autre alias !\n" #: src/common/command.c:289 #, c-format diff --git a/src/common/command.c b/src/common/command.c index 0835cf192..073ed2a82 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -191,7 +191,7 @@ alias_search (char *alias_name) for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) { - if (strcasecmp (alias_name, ptr_alias->alias_name) == 0) + if (ascii_strcasecmp (alias_name, ptr_alias->alias_name) == 0) return ptr_alias; } return NULL; @@ -208,7 +208,7 @@ alias_find_pos (char *alias_name) for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) { - if (strcasecmp (alias_name, ptr_alias->alias_name) < 0) + if (ascii_strcasecmp (alias_name, ptr_alias->alias_name) < 0) return ptr_alias; } return NULL; @@ -484,7 +484,7 @@ exec_weechat_command (t_irc_server *server, char *string) for (i = 0; weechat_commands[i].command_name; i++) { - if (strcasecmp (weechat_commands[i].command_name, command + 1) == 0) + if (ascii_strcasecmp (weechat_commands[i].command_name, command + 1) == 0) { if ((argc < weechat_commands[i].min_arg) || (argc > weechat_commands[i].max_arg)) @@ -544,7 +544,7 @@ exec_weechat_command (t_irc_server *server, char *string) } for (i = 0; irc_commands[i].command_name; i++) { - if ((strcasecmp (irc_commands[i].command_name, command + 1) == 0) && + if ((ascii_strcasecmp (irc_commands[i].command_name, command + 1) == 0) && ((irc_commands[i].cmd_function_args) || (irc_commands[i].cmd_function_1arg))) { @@ -615,7 +615,7 @@ exec_weechat_command (t_irc_server *server, char *string) for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) { - if (strcasecmp (ptr_alias->alias_name, command + 1) == 0) + if (ascii_strcasecmp (ptr_alias->alias_name, command + 1) == 0) { if (ptr_args) { @@ -890,7 +890,7 @@ weechat_cmd_buffer (int argc, char **argv) char *error; int target_buffer; - if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) + if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0))) { /* list opened buffers */ @@ -908,7 +908,7 @@ weechat_cmd_buffer (int argc, char **argv) } else { - if (strcasecmp (argv[0], "move") == 0) + if (ascii_strcasecmp (argv[0], "move") == 0) { /* move buffer to another number in the list */ @@ -943,7 +943,7 @@ weechat_cmd_buffer (int argc, char **argv) return -1; } } - else if (strcasecmp (argv[0], "close") == 0) + else if (ascii_strcasecmp (argv[0], "close") == 0) { /* close buffer (server or channel/private) */ @@ -995,7 +995,7 @@ weechat_cmd_buffer (int argc, char **argv) } gui_draw_buffer_status (gui_current_window->buffer, 1); } - else if (strcasecmp (argv[0], "notify") == 0) + else if (ascii_strcasecmp (argv[0], "notify") == 0) { /* set notify level for buffer */ @@ -1114,7 +1114,7 @@ weechat_cmd_clear (int argc, char **argv) { if (argc == 1) { - if (strcasecmp (argv[0], "-all") == 0) + if (ascii_strcasecmp (argv[0], "-all") == 0) gui_buffer_clear_all (); else { @@ -1198,7 +1198,7 @@ weechat_cmd_debug (int argc, char **argv) return -1; } - if (strcasecmp (argv[0], "dump") == 0) + if (ascii_strcasecmp (argv[0], "dump") == 0) { wee_dump (0); } @@ -1294,7 +1294,7 @@ weechat_cmd_help (int argc, char **argv) { for (i = 0; weechat_commands[i].command_name; i++) { - if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0) + if (ascii_strcasecmp (weechat_commands[i].command_name, argv[0]) == 0) { gui_printf (NULL, "\n"); gui_printf (NULL, "[w]"); @@ -1319,7 +1319,7 @@ weechat_cmd_help (int argc, char **argv) } for (i = 0; irc_commands[i].command_name; i++) { - if ((strcasecmp (irc_commands[i].command_name, argv[0]) == 0) + if ((ascii_strcasecmp (irc_commands[i].command_name, argv[0]) == 0) && (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)) { gui_printf (NULL, "\n"); @@ -1402,7 +1402,7 @@ weechat_cmd_key (char *arguments) weechat_cmd_key_display (ptr_key, 0); } } - else if (strncasecmp (arguments, "unbind ", 7) == 0) + else if (ascii_strncasecmp (arguments, "unbind ", 7) == 0) { arguments += 7; while (arguments[0] == ' ') @@ -1418,7 +1418,7 @@ weechat_cmd_key (char *arguments) return -1; } } - else if (strcasecmp (arguments, "functions") == 0) + else if (ascii_strcasecmp (arguments, "functions") == 0) { gui_printf (NULL, "\n"); gui_printf (NULL, _("Internal key functions:\n")); @@ -1431,12 +1431,12 @@ weechat_cmd_key (char *arguments) i++; } } - else if (strncasecmp (arguments, "reset", 5) == 0) + else if (ascii_strncasecmp (arguments, "reset", 5) == 0) { arguments += 5; while (arguments[0] == ' ') arguments++; - if (strcasecmp (arguments, "-yes") == 0) + if (ascii_strcasecmp (arguments, "-yes") == 0) { gui_key_free_all (); gui_key_init (); @@ -1570,18 +1570,18 @@ weechat_cmd_perl (int argc, char **argv) break; case 1: - if (strcasecmp (argv[0], "autoload") == 0) + if (ascii_strcasecmp (argv[0], "autoload") == 0) plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload"); - else if (strcasecmp (argv[0], "reload") == 0) + else if (ascii_strcasecmp (argv[0], "reload") == 0) { plugin_unload (PLUGIN_TYPE_PERL, NULL); plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload"); } - else if (strcasecmp (argv[0], "unload") == 0) + else if (ascii_strcasecmp (argv[0], "unload") == 0) plugin_unload (PLUGIN_TYPE_PERL, NULL); break; case 2: - if (strcasecmp (argv[0], "load") == 0) + if (ascii_strcasecmp (argv[0], "load") == 0) { /* load Perl script */ if (strstr(argv[1], DIR_SEPARATOR)) @@ -1713,18 +1713,18 @@ weechat_cmd_python (int argc, char **argv) break; case 1: - if (strcasecmp (argv[0], "autoload") == 0) + if (ascii_strcasecmp (argv[0], "autoload") == 0) plugin_auto_load (PLUGIN_TYPE_PYTHON, "python/autoload"); - else if (strcasecmp (argv[0], "reload") == 0) + else if (ascii_strcasecmp (argv[0], "reload") == 0) { plugin_unload (PLUGIN_TYPE_PYTHON, NULL); plugin_auto_load (PLUGIN_TYPE_PYTHON, "python/autoload"); } - else if (strcasecmp (argv[0], "unload") == 0) + else if (ascii_strcasecmp (argv[0], "unload") == 0) plugin_unload (PLUGIN_TYPE_PYTHON, NULL); break; case 2: - if (strcasecmp (argv[0], "load") == 0) + if (ascii_strcasecmp (argv[0], "load") == 0) { /* load Python script */ if (strstr(argv[1], DIR_SEPARATOR)) @@ -1856,18 +1856,18 @@ weechat_cmd_ruby (int argc, char **argv) break; case 1: - if (strcasecmp (argv[0], "autoload") == 0) + if (ascii_strcasecmp (argv[0], "autoload") == 0) plugin_auto_load (PLUGIN_TYPE_RUBY, "ruby/autoload"); - else if (strcasecmp (argv[0], "reload") == 0) + else if (ascii_strcasecmp (argv[0], "reload") == 0) { plugin_unload (PLUGIN_TYPE_RUBY, NULL); plugin_auto_load (PLUGIN_TYPE_RUBY, "ruby/autoload"); } - else if (strcasecmp (argv[0], "unload") == 0) + else if (ascii_strcasecmp (argv[0], "unload") == 0) plugin_unload (PLUGIN_TYPE_RUBY, NULL); break; case 2: - if (strcasecmp (argv[0], "load") == 0) + if (ascii_strcasecmp (argv[0], "load") == 0) { /* load Ruby script */ if (strstr(argv[1], DIR_SEPARATOR)) @@ -1967,7 +1967,7 @@ weechat_cmd_server (int argc, char **argv) } else { - if (strcasecmp (argv[0], "del") == 0) + if (ascii_strcasecmp (argv[0], "del") == 0) { if (argc < 2) { @@ -2067,15 +2067,15 @@ weechat_cmd_server (int argc, char **argv) { if (argv[i][0] == '-') { - if (strcasecmp (argv[i], "-auto") == 0) + if (ascii_strcasecmp (argv[i], "-auto") == 0) server.autoconnect = 1; - if (strcasecmp (argv[i], "-noauto") == 0) + if (ascii_strcasecmp (argv[i], "-noauto") == 0) server.autoconnect = 0; - if (strcasecmp (argv[i], "-ipv6") == 0) + if (ascii_strcasecmp (argv[i], "-ipv6") == 0) server.ipv6 = 1; - if (strcasecmp (argv[i], "-ssl") == 0) + if (ascii_strcasecmp (argv[i], "-ssl") == 0) server.ssl = 1; - if (strcasecmp (argv[i], "-pwd") == 0) + if (ascii_strcasecmp (argv[i], "-pwd") == 0) { if (i == (argc - 1)) { @@ -2088,7 +2088,7 @@ weechat_cmd_server (int argc, char **argv) } server.password = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-nicks") == 0) + if (ascii_strcasecmp (argv[i], "-nicks") == 0) { if (i >= (argc - 3)) { @@ -2103,7 +2103,7 @@ weechat_cmd_server (int argc, char **argv) server.nick2 = strdup (argv[++i]); server.nick3 = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-username") == 0) + if (ascii_strcasecmp (argv[i], "-username") == 0) { if (i == (argc - 1)) { @@ -2116,7 +2116,7 @@ weechat_cmd_server (int argc, char **argv) } server.username = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-realname") == 0) + if (ascii_strcasecmp (argv[i], "-realname") == 0) { if (i == (argc - 1)) { @@ -2129,7 +2129,7 @@ weechat_cmd_server (int argc, char **argv) } server.realname = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-command") == 0) + if (ascii_strcasecmp (argv[i], "-command") == 0) { if (i == (argc - 1)) { @@ -2142,7 +2142,7 @@ weechat_cmd_server (int argc, char **argv) } server.command = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-autojoin") == 0) + if (ascii_strcasecmp (argv[i], "-autojoin") == 0) { if (i == (argc - 1)) { @@ -2529,7 +2529,7 @@ weechat_cmd_window (int argc, char **argv) t_gui_window *ptr_win; int i; - if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) + if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0))) { /* list opened windows */ @@ -2558,29 +2558,29 @@ weechat_cmd_window (int argc, char **argv) } else { - if (strcasecmp (argv[0], "splith") == 0) + if (ascii_strcasecmp (argv[0], "splith") == 0) { /* split window horizontally */ gui_window_split_horiz (gui_current_window); } - else if (strcasecmp (argv[0], "splitv") == 0) + else if (ascii_strcasecmp (argv[0], "splitv") == 0) { /* split window vertically */ gui_window_split_vertic (gui_current_window); } - else if (strcasecmp (argv[0], "merge") == 0) + else if (ascii_strcasecmp (argv[0], "merge") == 0) { if (argc >= 2) { - if (strcasecmp (argv[1], "down") == 0) + if (ascii_strcasecmp (argv[1], "down") == 0) gui_window_merge_down (gui_current_window); - else if (strcasecmp (argv[1], "up") == 0) + else if (ascii_strcasecmp (argv[1], "up") == 0) gui_window_merge_up (gui_current_window); - else if (strcasecmp (argv[1], "left") == 0) + else if (ascii_strcasecmp (argv[1], "left") == 0) gui_window_merge_left (gui_current_window); - else if (strcasecmp (argv[1], "right") == 0) + else if (ascii_strcasecmp (argv[1], "right") == 0) gui_window_merge_right (gui_current_window); - else if (strcasecmp (argv[1], "all") == 0) + else if (ascii_strcasecmp (argv[1], "all") == 0) gui_window_merge_all (gui_current_window); else { @@ -2594,9 +2594,9 @@ weechat_cmd_window (int argc, char **argv) else gui_window_merge_auto (gui_current_window); } - else if (strcasecmp (argv[0], "-1") == 0) + else if (ascii_strcasecmp (argv[0], "-1") == 0) gui_switch_to_previous_window (); - else if (strcasecmp (argv[0], "+1") == 0) + else if (ascii_strcasecmp (argv[0], "+1") == 0) gui_switch_to_next_window (); else { diff --git a/src/common/completion.c b/src/common/completion.c index decfad2c8..41be8e894 100644 --- a/src/common/completion.c +++ b/src/common/completion.c @@ -111,13 +111,13 @@ completion_build_list (t_completion *completion, void *channel) /* WeeChat internal commands */ /* no completion for some commands */ - if ((strcasecmp (completion->base_command, "server") == 0) - || (strcasecmp (completion->base_command, "save") == 0)) + if ((ascii_strcasecmp (completion->base_command, "server") == 0) + || (ascii_strcasecmp (completion->base_command, "save") == 0)) { completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "alias") == 0) + if ((ascii_strcasecmp (completion->base_command, "alias") == 0) && (completion->base_command_arg == 1)) { for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist) @@ -128,7 +128,7 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if ((strcasecmp (completion->base_command, "buffer") == 0) + if ((ascii_strcasecmp (completion->base_command, "buffer") == 0) && (completion->base_command_arg == 1)) { weelist_add (&completion->completion_list, @@ -145,7 +145,7 @@ completion_build_list (t_completion *completion, void *channel) "notify"); return; } - if ((strcasecmp (completion->base_command, "clear") == 0) + if ((ascii_strcasecmp (completion->base_command, "clear") == 0) && (completion->base_command_arg == 1)) { weelist_add (&completion->completion_list, @@ -153,8 +153,8 @@ completion_build_list (t_completion *completion, void *channel) "-all"); return; } - if ((strcasecmp (completion->base_command, "connect") == 0) - || (strcasecmp (completion->base_command, "disconnect") == 0)) + if ((ascii_strcasecmp (completion->base_command, "connect") == 0) + || (ascii_strcasecmp (completion->base_command, "disconnect") == 0)) { if (completion->base_command_arg == 1) { @@ -173,7 +173,7 @@ completion_build_list (t_completion *completion, void *channel) return; } } - if (strcasecmp (completion->base_command, "debug") == 0) + if (ascii_strcasecmp (completion->base_command, "debug") == 0) { if (completion->base_command_arg == 1) weelist_add (&completion->completion_list, @@ -183,7 +183,7 @@ completion_build_list (t_completion *completion, void *channel) completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "help") == 0) + if ((ascii_strcasecmp (completion->base_command, "help") == 0) && (completion->base_command_arg == 1)) { for (i = 0; weechat_commands[i].command_name; i++) @@ -201,7 +201,7 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if (strcasecmp (completion->base_command, "key") == 0) + if (ascii_strcasecmp (completion->base_command, "key") == 0) { if (completion->base_command_arg == 1) { @@ -229,8 +229,8 @@ completion_build_list (t_completion *completion, void *channel) return; } } - if (((strcasecmp (completion->base_command, "perl") == 0) - || (strcasecmp (completion->base_command, "python") == 0)) + if (((ascii_strcasecmp (completion->base_command, "perl") == 0) + || (ascii_strcasecmp (completion->base_command, "python") == 0)) && (completion->base_command_arg == 1)) { weelist_add (&completion->completion_list, @@ -247,7 +247,7 @@ completion_build_list (t_completion *completion, void *channel) "unload"); return; } - if (strcasecmp (completion->base_command, "set") == 0) + if (ascii_strcasecmp (completion->base_command, "set") == 0) { if (completion->base_command_arg == 1) { @@ -340,7 +340,7 @@ completion_build_list (t_completion *completion, void *channel) completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "unalias") == 0) + if ((ascii_strcasecmp (completion->base_command, "unalias") == 0) && (completion->base_command_arg == 1)) { for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) @@ -351,7 +351,7 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if (strcasecmp (completion->base_command, "window") == 0) + if (ascii_strcasecmp (completion->base_command, "window") == 0) { if (completion->base_command_arg == 1) { @@ -397,33 +397,33 @@ completion_build_list (t_completion *completion, void *channel) /* IRC commands */ /* no completion for some commands */ - if ((strcasecmp (completion->base_command, "admin") == 0) - || (strcasecmp (completion->base_command, "die") == 0) - || (strcasecmp (completion->base_command, "info") == 0) - || (strcasecmp (completion->base_command, "join") == 0) - || (strcasecmp (completion->base_command, "links") == 0) - || (strcasecmp (completion->base_command, "list") == 0) - || (strcasecmp (completion->base_command, "lusers") == 0) - || (strcasecmp (completion->base_command, "motd") == 0) - || (strcasecmp (completion->base_command, "oper") == 0) - || (strcasecmp (completion->base_command, "rehash") == 0) - || (strcasecmp (completion->base_command, "restart") == 0) - || (strcasecmp (completion->base_command, "service") == 0) - || (strcasecmp (completion->base_command, "servlist") == 0) - || (strcasecmp (completion->base_command, "squery") == 0) - || (strcasecmp (completion->base_command, "squit") == 0) - || (strcasecmp (completion->base_command, "stats") == 0) - || (strcasecmp (completion->base_command, "summon") == 0) - || (strcasecmp (completion->base_command, "time") == 0) - || (strcasecmp (completion->base_command, "trace") == 0) - || (strcasecmp (completion->base_command, "users") == 0) - || (strcasecmp (completion->base_command, "wallops") == 0) - || (strcasecmp (completion->base_command, "who") == 0)) + if ((ascii_strcasecmp (completion->base_command, "admin") == 0) + || (ascii_strcasecmp (completion->base_command, "die") == 0) + || (ascii_strcasecmp (completion->base_command, "info") == 0) + || (ascii_strcasecmp (completion->base_command, "join") == 0) + || (ascii_strcasecmp (completion->base_command, "links") == 0) + || (ascii_strcasecmp (completion->base_command, "list") == 0) + || (ascii_strcasecmp (completion->base_command, "lusers") == 0) + || (ascii_strcasecmp (completion->base_command, "motd") == 0) + || (ascii_strcasecmp (completion->base_command, "oper") == 0) + || (ascii_strcasecmp (completion->base_command, "rehash") == 0) + || (ascii_strcasecmp (completion->base_command, "restart") == 0) + || (ascii_strcasecmp (completion->base_command, "service") == 0) + || (ascii_strcasecmp (completion->base_command, "servlist") == 0) + || (ascii_strcasecmp (completion->base_command, "squery") == 0) + || (ascii_strcasecmp (completion->base_command, "squit") == 0) + || (ascii_strcasecmp (completion->base_command, "stats") == 0) + || (ascii_strcasecmp (completion->base_command, "summon") == 0) + || (ascii_strcasecmp (completion->base_command, "time") == 0) + || (ascii_strcasecmp (completion->base_command, "trace") == 0) + || (ascii_strcasecmp (completion->base_command, "users") == 0) + || (ascii_strcasecmp (completion->base_command, "wallops") == 0) + || (ascii_strcasecmp (completion->base_command, "who") == 0)) { completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "away") == 0) + if ((ascii_strcasecmp (completion->base_command, "away") == 0) && (completion->base_command_arg == 1)) { if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) @@ -432,7 +432,7 @@ completion_build_list (t_completion *completion, void *channel) cfg_irc_default_msg_away); return; } - if ((strcasecmp (completion->base_command, "ctcp") == 0) + if ((ascii_strcasecmp (completion->base_command, "ctcp") == 0) && (completion->base_command_arg == 2)) { weelist_add (&completion->completion_list, @@ -446,7 +446,7 @@ completion_build_list (t_completion *completion, void *channel) "version"); return; } - if ((strcasecmp (completion->base_command, "dcc") == 0) + if ((ascii_strcasecmp (completion->base_command, "dcc") == 0) && (completion->base_command_arg == 1)) { weelist_add (&completion->completion_list, @@ -460,7 +460,7 @@ completion_build_list (t_completion *completion, void *channel) "close"); return; } - if (strcasecmp (completion->base_command, "invite") == 0) + if (ascii_strcasecmp (completion->base_command, "invite") == 0) { /* arg1: nickname */ if (completion->base_command_arg == 1) @@ -486,30 +486,30 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if (strcasecmp (completion->base_command, "kick") == 0) + if (ascii_strcasecmp (completion->base_command, "kick") == 0) { if (completion->base_command_arg != 1) completion_stop (completion); return; } - if (strcasecmp (completion->base_command, "kill") == 0) + if (ascii_strcasecmp (completion->base_command, "kill") == 0) { if (completion->base_command_arg != 1) completion_stop (completion); return; } - if (strcasecmp (completion->base_command, "me") == 0) + if (ascii_strcasecmp (completion->base_command, "me") == 0) { completion->context = COMPLETION_NICK; return; } - if (strcasecmp (completion->base_command, "notice") == 0) + if (ascii_strcasecmp (completion->base_command, "notice") == 0) { if (completion->base_command_arg != 1) completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "part") == 0) + if ((ascii_strcasecmp (completion->base_command, "part") == 0) && (completion->base_command_arg == 1)) { if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0]) @@ -518,13 +518,13 @@ completion_build_list (t_completion *completion, void *channel) cfg_irc_default_msg_part); return; } - if (strcasecmp (completion->base_command, "query") == 0) + if (ascii_strcasecmp (completion->base_command, "query") == 0) { if (completion->base_command_arg != 1) completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "quit") == 0) + if ((ascii_strcasecmp (completion->base_command, "quit") == 0) && (completion->base_command_arg == 1)) { if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) @@ -533,7 +533,7 @@ completion_build_list (t_completion *completion, void *channel) cfg_irc_default_msg_quit); return; } - if (strcasecmp (completion->base_command, "topic") == 0) + if (ascii_strcasecmp (completion->base_command, "topic") == 0) { if (completion->base_command_arg == 1) { @@ -717,7 +717,7 @@ completion_command (t_completion *completion) other_completion = 0; for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0) + if (ascii_strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0) { if ((!completion->word_found) || word_found_seen) { @@ -725,7 +725,7 @@ completion_command (t_completion *completion) for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; ptr_weelist2 = ptr_weelist2->next_weelist) { - if (strncasecmp (ptr_weelist2->data, + if (ascii_strncasecmp (ptr_weelist2->data, completion->base_word + 1, length) == 0) other_completion++; } @@ -739,7 +739,7 @@ completion_command (t_completion *completion) other_completion++; } if (completion->word_found && - (strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + (ascii_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) word_found_seen = 1; } if (completion->word_found) @@ -765,7 +765,7 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel) for (ptr_weelist = completion->completion_list; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) + if (ascii_strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) { if ((!completion->word_found) || word_found_seen) { @@ -773,7 +773,7 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel) for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; ptr_weelist2 = ptr_weelist2->next_weelist) { - if (strncasecmp (ptr_weelist2->data, + if (ascii_strncasecmp (ptr_weelist2->data, completion->base_word, length) == 0) other_completion++; } @@ -787,7 +787,7 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel) other_completion++; } if (completion->word_found && - (strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + (ascii_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) word_found_seen = 1; } if (completion->word_found) @@ -821,7 +821,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel) other_completion = 0; for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0) + if (ascii_strncasecmp (ptr_nick->nick, completion->base_word, length) == 0) { if ((!completion->word_found) || word_found_seen) { @@ -829,7 +829,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel) for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2; ptr_nick2 = ptr_nick2->next_nick) { - if (strncasecmp (ptr_nick2->nick, + if (ascii_strncasecmp (ptr_nick2->nick, completion->base_word, length) == 0) other_completion++; } @@ -843,7 +843,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel) other_completion++; } if (completion->word_found && - (strcasecmp (ptr_nick->nick, completion->word_found) == 0)) + (ascii_strcasecmp (ptr_nick->nick, completion->word_found) == 0)) word_found_seen = 1; } if (completion->word_found) diff --git a/src/common/weechat.c b/src/common/weechat.c index b8692da57..f0ed84597 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -83,6 +83,78 @@ gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */ #endif +/* + * ascii_strcasecmp: locale and case independent string comparison + */ + +int +ascii_strcasecmp (char *string1, char *string2) +{ + int c1, c2; + + if (!string1 || !string2) + return (string1) ? 1 : ((string2) ? -1 : 0); + + while (string1[0] && string2[0]) + { + c1 = (int)((unsigned char) string1[0]); + c2 = (int)((unsigned char) string2[0]); + + if ((c1 >= 'A') && (c1 <= 'Z')) + c1 += ('a' - 'A'); + + if ((c2 >= 'A') && (c2 <= 'Z')) + c2 += ('a' - 'A'); + + if ((c1 - c2) != 0) + return c1 - c2; + + string1++; + string2++; + } + + return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0); +} + +/* + * ascii_strncasecmp: locale and case independent string comparison + * with max length + */ + +int +ascii_strncasecmp (char *string1, char *string2, int max) +{ + int c1, c2, count; + + if (!string1 || !string2) + return (string1) ? 1 : ((string2) ? -1 : 0); + + count = 0; + while ((count < max) && string1[0] && string2[0]) + { + c1 = (int)((unsigned char) string1[0]); + c2 = (int)((unsigned char) string2[0]); + + if ((c1 >= 'A') && (c1 <= 'Z')) + c1 += ('a' - 'A'); + + if ((c2 >= 'A') && (c2 <= 'Z')) + c2 += ('a' - 'A'); + + if ((c1 - c2) != 0) + return c1 - c2; + + string1++; + string2++; + count++; + } + + if (count >= max) + return 0; + else + return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0); +} + /* * wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log) */ @@ -131,7 +203,7 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string) size_t inbytesleft, outbytesleft; if (from_code && from_code[0] && to_code && to_code[0] - && (strcasecmp(from_code, to_code) != 0)) + && (ascii_strcasecmp(from_code, to_code) != 0)) { cd = iconv_open (to_code, from_code); if (cd == (iconv_t)(-1)) @@ -418,7 +490,7 @@ wee_parse_args (int argc, char *argv[]) wee_display_commands (1, 0); wee_shutdown (EXIT_SUCCESS, 0); } - else if ((strncasecmp (argv[i], "irc", 3) == 0)) + else if ((ascii_strncasecmp (argv[i], "irc", 3) == 0)) { if (server_init_with_url (argv[i], &server_tmp) < 0) { diff --git a/src/common/weechat.h b/src/common/weechat.h index 9304671a8..80771d700 100644 --- a/src/common/weechat.h +++ b/src/common/weechat.h @@ -118,6 +118,8 @@ extern char *local_charset; extern gnutls_certificate_credentials gnutls_xcred; #endif +extern int ascii_strcasecmp (char *, char *); +extern int ascii_strncasecmp (char *, char *, int); extern void wee_log_printf (char *, ...); extern void wee_dump (int); extern char *weechat_convert_encoding (char *, char *, char *); diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c index 31bd94833..2b181d1ae 100644 --- a/src/common/weeconfig.c +++ b/src/common/weeconfig.c @@ -775,7 +775,7 @@ get_pos_array_values (char **array, char *string) i = 0; while (array[i]) { - if (strcasecmp (array[i], string) == 0) + if (ascii_strcasecmp (array[i], string) == 0) return i; i++; } @@ -926,9 +926,9 @@ config_option_set_value (t_config_option *option, char *value) switch (option->option_type) { case OPTION_TYPE_BOOLEAN: - if (strcasecmp (value, "on") == 0) + if (ascii_strcasecmp (value, "on") == 0) *(option->ptr_int) = BOOL_TRUE; - else if (strcasecmp (value, "off") == 0) + else if (ascii_strcasecmp (value, "off") == 0) *(option->ptr_int) = BOOL_FALSE; else return -1; @@ -965,43 +965,43 @@ config_option_set_value (t_config_option *option, char *value) void * config_get_server_option_ptr (t_irc_server *server, char *option_name) { - if (strcasecmp (option_name, "server_name") == 0) + if (ascii_strcasecmp (option_name, "server_name") == 0) return (void *)(&server->name); - if (strcasecmp (option_name, "server_autoconnect") == 0) + if (ascii_strcasecmp (option_name, "server_autoconnect") == 0) return (void *)(&server->autoconnect); - if (strcasecmp (option_name, "server_autoreconnect") == 0) + if (ascii_strcasecmp (option_name, "server_autoreconnect") == 0) return (void *)(&server->autoreconnect); - if (strcasecmp (option_name, "server_autoreconnect_delay") == 0) + if (ascii_strcasecmp (option_name, "server_autoreconnect_delay") == 0) return (void *)(&server->autoreconnect_delay); - if (strcasecmp (option_name, "server_address") == 0) + if (ascii_strcasecmp (option_name, "server_address") == 0) return (void *)(&server->address); - if (strcasecmp (option_name, "server_port") == 0) + if (ascii_strcasecmp (option_name, "server_port") == 0) return (void *)(&server->port); - if (strcasecmp (option_name, "server_ipv6") == 0) + if (ascii_strcasecmp (option_name, "server_ipv6") == 0) return (void *)(&server->ipv6); - if (strcasecmp (option_name, "server_ssl") == 0) + if (ascii_strcasecmp (option_name, "server_ssl") == 0) return (void *)(&server->ssl); - if (strcasecmp (option_name, "server_password") == 0) + if (ascii_strcasecmp (option_name, "server_password") == 0) return (void *)(&server->password); - if (strcasecmp (option_name, "server_nick1") == 0) + if (ascii_strcasecmp (option_name, "server_nick1") == 0) return (void *)(&server->nick1); - if (strcasecmp (option_name, "server_nick2") == 0) + if (ascii_strcasecmp (option_name, "server_nick2") == 0) return (void *)(&server->nick2); - if (strcasecmp (option_name, "server_nick3") == 0) + if (ascii_strcasecmp (option_name, "server_nick3") == 0) return (void *)(&server->nick3); - if (strcasecmp (option_name, "server_username") == 0) + if (ascii_strcasecmp (option_name, "server_username") == 0) return (void *)(&server->username); - if (strcasecmp (option_name, "server_realname") == 0) + if (ascii_strcasecmp (option_name, "server_realname") == 0) return (void *)(&server->realname); - if (strcasecmp (option_name, "server_command") == 0) + if (ascii_strcasecmp (option_name, "server_command") == 0) return (void *)(&server->command); - if (strcasecmp (option_name, "server_command_delay") == 0) + if (ascii_strcasecmp (option_name, "server_command_delay") == 0) return (void *)(&server->command_delay); - if (strcasecmp (option_name, "server_autojoin") == 0) + if (ascii_strcasecmp (option_name, "server_autojoin") == 0) return (void *)(&server->autojoin); - if (strcasecmp (option_name, "server_autorejoin") == 0) + if (ascii_strcasecmp (option_name, "server_autorejoin") == 0) return (void *)(&server->autorejoin); - if (strcasecmp (option_name, "server_notify_levels") == 0) + if (ascii_strcasecmp (option_name, "server_notify_levels") == 0) return (void *)(&server->notify_levels); /* option not found */ return NULL; @@ -1031,7 +1031,7 @@ config_set_server_value (t_irc_server *server, char *option_name, for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++) { /* if option found, return pointer */ - if (strcasecmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, option_name) == 0) + if (ascii_strcasecmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, option_name) == 0) { ptr_option = &weechat_options[CONFIG_SECTION_SERVER][i]; break; @@ -1043,9 +1043,9 @@ config_set_server_value (t_irc_server *server, char *option_name, switch (ptr_option->option_type) { case OPTION_TYPE_BOOLEAN: - if (strcasecmp (value, "on") == 0) + if (ascii_strcasecmp (value, "on") == 0) *((int *)(ptr_data)) = BOOL_TRUE; - else if (strcasecmp (value, "off") == 0) + else if (ascii_strcasecmp (value, "off") == 0) *((int *)(ptr_data)) = BOOL_FALSE; else return -2; @@ -1095,7 +1095,7 @@ config_option_search (char *option_name) for (j = 0; weechat_options[i][j].option_name; j++) { /* if option found, return pointer */ - if (strcasecmp (weechat_options[i][j].option_name, option_name) == 0) + if (ascii_strcasecmp (weechat_options[i][j].option_name, option_name) == 0) return &weechat_options[i][j]; } } diff --git a/src/common/weelist.c b/src/common/weelist.c index e4bf30ef9..2a34937e2 100644 --- a/src/common/weelist.c +++ b/src/common/weelist.c @@ -42,7 +42,7 @@ weelist_search (t_weelist *weelist, char *data) for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strcasecmp (data, ptr_weelist->data) == 0) + if (ascii_strcasecmp (data, ptr_weelist->data) == 0) return ptr_weelist; } /* word not found in list */ @@ -60,7 +60,7 @@ weelist_find_pos (t_weelist *weelist, char *data) for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strcasecmp (data, ptr_weelist->data) < 0) + if (ascii_strcasecmp (data, ptr_weelist->data) < 0) return ptr_weelist; } /* position not found, best position is at the end */ diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index 636752f90..d61284f1c 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -80,7 +80,7 @@ gui_assign_color (int *color, char *color_name) i = 0; while (gui_colors[i].name) { - if (strcasecmp (gui_colors[i].name, color_name) == 0) + if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0) { *color = gui_colors[i].color; return 1; @@ -105,7 +105,7 @@ gui_get_color_by_name (char *color_name) i = 0; while (gui_colors[i].name) { - if (strcasecmp (gui_colors[i].name, color_name) == 0) + if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0) return gui_colors[i].color; i++; } diff --git a/src/gui/gtk/gui-display.c b/src/gui/gtk/gui-display.c index 8835f9ad0..b519c9b73 100644 --- a/src/gui/gtk/gui-display.c +++ b/src/gui/gtk/gui-display.c @@ -89,7 +89,7 @@ gui_assign_color (int *color, char *color_name) i = 0; while (gui_colors[i].name) { - if (strcasecmp (gui_colors[i].name, color_name) == 0) + if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0) { *color = gui_colors[i].color; return 1; @@ -114,7 +114,7 @@ gui_get_color_by_name (char *color_name) i = 0; while (gui_colors[i].name) { - if (strcasecmp (gui_colors[i].name, color_name) == 0) + if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0) return gui_colors[i].color; i++; } diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c index 2443975fd..28c331db4 100644 --- a/src/gui/gui-keyboard.c +++ b/src/gui/gui-keyboard.c @@ -157,17 +157,17 @@ gui_key_get_internal_code (char *key) result[0] = '\0'; while (key[0]) { - if (strncasecmp (key, "meta2-", 6) == 0) + if (ascii_strncasecmp (key, "meta2-", 6) == 0) { strcat (result, "^[["); key += 6; } - if (strncasecmp (key, "meta-", 5) == 0) + if (ascii_strncasecmp (key, "meta-", 5) == 0) { strcat (result, "^["); key += 5; } - else if (strncasecmp (key, "ctrl-", 5) == 0) + else if (ascii_strncasecmp (key, "ctrl-", 5) == 0) { strcat (result, "^"); key += 5; @@ -200,12 +200,12 @@ gui_key_get_expanded_name (char *key) result[0] = '\0'; while (key[0]) { - if (strncasecmp (key, "^[[", 3) == 0) + if (ascii_strncasecmp (key, "^[[", 3) == 0) { strcat (result, "meta2-"); key += 3; } - if (strncasecmp (key, "^[", 2) == 0) + if (ascii_strncasecmp (key, "^[", 2) == 0) { strcat (result, "meta-"); key += 2; @@ -239,7 +239,7 @@ gui_key_find_pos (t_gui_key *key) for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) { - if (strcasecmp (key->key, ptr_key->key) < 0) + if (ascii_strcasecmp (key->key, ptr_key->key) < 0) return ptr_key; } return NULL; @@ -324,7 +324,7 @@ gui_key_search (char *key) for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) { - if (strcasecmp (ptr_key->key, key) == 0) + if (ascii_strcasecmp (ptr_key->key, key) == 0) return ptr_key; } @@ -381,7 +381,7 @@ gui_key_function_search_by_name (char *name) i = 0; while (gui_key_functions[i].function_name) { - if (strcasecmp (gui_key_functions[i].function_name, name) == 0) + if (ascii_strcasecmp (gui_key_functions[i].function_name, name) == 0) return gui_key_functions[i].function; i++; } @@ -504,7 +504,7 @@ gui_key_pressed (char *key_str) ptr_key = gui_key_search_part (gui_key_buffer); if (ptr_key) { - if (strcasecmp (ptr_key->key, gui_key_buffer) == 0) + if (ascii_strcasecmp (ptr_key->key, gui_key_buffer) == 0) { /* exact combo found => execute function or command */ gui_key_buffer[0] = '\0'; diff --git a/src/irc/irc-channel.c b/src/irc/irc-channel.c index 0323b7869..6aec9902f 100644 --- a/src/irc/irc-channel.c +++ b/src/irc/irc-channel.c @@ -147,7 +147,7 @@ channel_search (t_irc_server *server, char *channel_name) for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - if (strcasecmp (ptr_channel->name, channel_name) == 0) + if (ascii_strcasecmp (ptr_channel->name, channel_name) == 0) return ptr_channel; } return NULL; diff --git a/src/irc/irc-nick.c b/src/irc/irc-nick.c index af845e3f2..37d4aaf6c 100644 --- a/src/irc/irc-nick.c +++ b/src/irc/irc-nick.c @@ -33,7 +33,7 @@ /* - * nick_find_color: find a color for a nick (less used will be better!) + * nick_find_color: find a color for a nick (according to nick letters) */ int @@ -87,12 +87,11 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) score1 = nick_score_for_sort (nick1); score2 = nick_score_for_sort (nick2); - comp = strcasecmp(nick1->nick, nick2->nick); + comp = ascii_strcasecmp (nick1->nick, nick2->nick); if (comp > 0) score1++; - else - if (comp < 0) - score2++; + if (comp < 0) + score2++; /* nick1 > nick2 */ if (score1 > score2) @@ -202,7 +201,7 @@ nick_new (t_irc_channel *channel, char *nick_name, new_nick->is_halfop = is_halfop; new_nick->has_voice = has_voice; new_nick->is_away = 0; - if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0) + if (ascii_strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0) new_nick->color = COLOR_WIN_NICK_SELF; else new_nick->color = nick_find_color (new_nick); @@ -319,7 +318,7 @@ nick_search (t_irc_channel *channel, char *nickname) for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - if (strcasecmp (ptr_nick->nick, nickname) == 0) + if (ascii_strcasecmp (ptr_nick->nick, nickname) == 0) return ptr_nick; } return NULL; diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c index 781e0db9a..eecefc12d 100644 --- a/src/irc/irc-recv.c +++ b/src/irc/irc-recv.c @@ -150,7 +150,7 @@ irc_recv_command (t_irc_server *server, char *entire_line, cmd_found = -1; for (i = 0; irc_commands[i].command_name; i++) { - if (strcasecmp (irc_commands[i].command_name, command) == 0) + if (ascii_strcasecmp (irc_commands[i].command_name, command) == 0) { cmd_found = i; break; @@ -929,7 +929,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) if ((SERVER(ptr_buffer) == server) && BUFFER_IS_PRIVATE(ptr_buffer)) { if ((CHANNEL(ptr_buffer)->name) - && (strcasecmp (host, CHANNEL(ptr_buffer)->name) == 0)) + && (ascii_strcasecmp (host, CHANNEL(ptr_buffer)->name) == 0)) { free (CHANNEL(ptr_buffer)->name); CHANNEL(ptr_buffer)->name = strdup (arguments); @@ -1104,9 +1104,9 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments) gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": "); } gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", pos); - if ((host) && (strcasecmp (host, "nickserv") != 0) && - (strcasecmp (host, "chanserv") != 0) && - (strcasecmp (host, "memoserv") != 0)) + if ((host) && (ascii_strcasecmp (host, "nickserv") != 0) && + (ascii_strcasecmp (host, "chanserv") != 0) && + (ascii_strcasecmp (host, "memoserv") != 0)) { hotlist_add (HOTLIST_PRIVATE, server->buffer); gui_draw_buffer_status (gui_current_window->buffer, 1); @@ -1789,7 +1789,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments) while (pos_port[0] == ' ') pos_port++; - if (strcasecmp (pos_file, "chat") != 0) + if (ascii_strcasecmp (pos_file, "chat") != 0) { irc_display_prefix (server->buffer, PREFIX_ERROR); gui_printf_nolog (server->buffer, diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c index fa1a1bb92..854e73311 100644 --- a/src/irc/irc-send.c +++ b/src/irc/irc-send.c @@ -367,7 +367,7 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments) gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": "); gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_type); - if ((strcasecmp (pos_type, "ping") == 0) && (!pos_args)) + if ((ascii_strcasecmp (pos_type, "ping") == 0) && (!pos_args)) { gettimeofday (&tv, &tz); server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n", @@ -451,7 +451,7 @@ irc_cmd_send_dcc (t_irc_server *server, char *arguments) dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL); } - else if (strcasecmp (arguments, "close") == 0) + else if (ascii_strcasecmp (arguments, "close") == 0) { if (BUFFER_IS_PRIVATE(gui_current_window->buffer) && CHANNEL(gui_current_window->buffer)->dcc_chat) diff --git a/src/plugins/perl/wee-perl.c b/src/plugins/perl/wee-perl.c index 18dc7614f..010f72273 100644 --- a/src/plugins/perl/wee-perl.c +++ b/src/plugins/perl/wee-perl.c @@ -73,7 +73,7 @@ static XS (XS_IRC_register) for (ptr_perl_script = perl_scripts; ptr_perl_script; ptr_perl_script = ptr_perl_script->next_script) { - if (strcasecmp (ptr_perl_script->name, name) == 0) + if (ascii_strcasecmp (ptr_perl_script->name, name) == 0) { perl_script_found = ptr_perl_script; break; @@ -182,12 +182,12 @@ static XS (XS_IRC_print_with_channel) for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (!server || (strcasecmp (ptr_server->name, server)) == 0) + if (!server || (ascii_strcasecmp (ptr_server->name, server)) == 0) { for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - if (strcasecmp (ptr_channel->name, channel) == 0) + if (ascii_strcasecmp (ptr_channel->name, channel) == 0) { ptr_buffer = ptr_channel->buffer; break; @@ -260,7 +260,7 @@ static XS (XS_IRC_command) command = SvPV (ST (1), integer); for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (strcasecmp (ptr_server->name, server) == 0) + if (ascii_strcasecmp (ptr_server->name, server) == 0) break; } if (!ptr_server) @@ -383,30 +383,30 @@ static XS (XS_IRC_get_info) if (arg) { - if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) ) + if ( (ascii_strcasecmp (arg, "0") == 0) || (ascii_strcasecmp (arg, "version") == 0) ) { info = PACKAGE_STRING; } - else if ( ptr_server && ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "1") == 0) || (ascii_strcasecmp (arg, "nick") == 0) ) ) { if (ptr_server->nick) info = ptr_server->nick; } - else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) ) + else if ( (ascii_strcasecmp (arg, "2") == 0) || (ascii_strcasecmp (arg, "channel") == 0) ) { if (BUFFER_IS_CHANNEL (gui_current_window->buffer)) info = CHANNEL (gui_current_window->buffer)->name; } - else if ( ptr_server && ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "3") == 0) || (ascii_strcasecmp (arg, "server") == 0) ) ) { if (ptr_server->name) info = ptr_server->name; } - else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) ) + else if ( (ascii_strcasecmp (arg, "4") == 0) || (ascii_strcasecmp (arg, "weechatdir") == 0) ) { info = weechat_home; } - else if ( ptr_server && ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "5") == 0) || (ascii_strcasecmp (arg, "away") == 0) ) ) { XST_mIV (0, SERVER(gui_current_window->buffer)->is_away); XSRETURN (1); @@ -448,7 +448,7 @@ static XS (XS_weechat_register) for (ptr_perl_script = perl_scripts; ptr_perl_script; ptr_perl_script = ptr_perl_script->next_script) { - if (strcasecmp (ptr_perl_script->name, name) == 0) + if (ascii_strcasecmp (ptr_perl_script->name, name) == 0) { perl_script_found = ptr_perl_script; break; @@ -731,36 +731,36 @@ static XS (XS_weechat_get_info) arg = SvPV (ST (0), integer); if (arg) { - if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) ) + if ( (ascii_strcasecmp (arg, "0") == 0) || (ascii_strcasecmp (arg, "version") == 0) ) { info = PACKAGE_STRING; } - else if ( ptr_server && ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "1") == 0) || (ascii_strcasecmp (arg, "nick") == 0) ) ) { if (ptr_server->nick) info = ptr_server->nick; } - else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) ) + else if ( (ascii_strcasecmp (arg, "2") == 0) || (ascii_strcasecmp (arg, "channel") == 0) ) { if (BUFFER_IS_CHANNEL (gui_current_window->buffer)) info = CHANNEL (gui_current_window->buffer)->name; } - else if ( ptr_server && ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "3") == 0) || (ascii_strcasecmp (arg, "server") == 0) ) ) { if (ptr_server->name) info = ptr_server->name; } - else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) ) + else if ( (ascii_strcasecmp (arg, "4") == 0) || (ascii_strcasecmp (arg, "weechatdir") == 0) ) { info = weechat_home; } - else if ( ptr_server && ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "5") == 0) || (ascii_strcasecmp (arg, "away") == 0) ) ) { XST_mIV (0, SERVER(gui_current_window->buffer)->is_away); XSRETURN (1); return; } - else if ( (strcasecmp (arg, "100") == 0) || (strcasecmp (arg, "dccs") == 0) ) + else if ( (ascii_strcasecmp (arg, "100") == 0) || (ascii_strcasecmp (arg, "dccs") == 0) ) { int nItems = 0; t_irc_dcc *p = dcc_list; diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index 089b34191..8fc51a026 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -181,7 +181,7 @@ plugin_handler_search (t_plugin_handler *plugin_handlers, char *name) ptr_plugin_handler = ptr_plugin_handler->next_handler) { /* handler found */ - if (strcasecmp (ptr_plugin_handler->name, name) == 0) + if (ascii_strcasecmp (ptr_plugin_handler->name, name) == 0) return ptr_plugin_handler; } /* handler not found */ @@ -309,7 +309,7 @@ plugin_event_msg (char *irc_command, char *server, char *arguments) for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler; ptr_plugin_handler = ptr_plugin_handler->next_handler) { - if (strcasecmp (ptr_plugin_handler->name, irc_command) == 0) + if (ascii_strcasecmp (ptr_plugin_handler->name, irc_command) == 0) { #ifdef PLUGIN_PERL if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL) @@ -367,7 +367,7 @@ plugin_exec_command (char *user_command, char *server, char *arguments) for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler; ptr_plugin_handler = ptr_plugin_handler->next_handler) { - if (strcasecmp (ptr_plugin_handler->name, user_command) == 0) + if (ascii_strcasecmp (ptr_plugin_handler->name, user_command) == 0) { #ifdef PLUGIN_PERL if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL) diff --git a/src/plugins/python/wee-python.c b/src/plugins/python/wee-python.c index d1fd2d901..c3f5860be 100644 --- a/src/plugins/python/wee-python.c +++ b/src/plugins/python/wee-python.c @@ -66,7 +66,7 @@ wee_python_register (PyObject *self, PyObject *args) for (ptr_python_script = python_scripts; ptr_python_script; ptr_python_script = ptr_python_script->next_script) { - if (strcasecmp (ptr_python_script->name, name) == 0) + if (ascii_strcasecmp (ptr_python_script->name, name) == 0) { python_script_found = ptr_python_script; break; @@ -321,7 +321,7 @@ wee_python_get_info (PyObject *self, PyObject *args) { for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (strcasecmp (ptr_server->name, server) == 0) + if (ascii_strcasecmp (ptr_server->name, server) == 0) break; } if (!ptr_server) @@ -336,34 +336,34 @@ wee_python_get_info (PyObject *self, PyObject *args) if (ptr_server && arg) { - if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) ) + if ( (ascii_strcasecmp (arg, "0") == 0) || (ascii_strcasecmp (arg, "version") == 0) ) { info = PACKAGE_STRING; } - else if ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) ) + else if ( (ascii_strcasecmp (arg, "1") == 0) || (ascii_strcasecmp (arg, "nick") == 0) ) { if (ptr_server->nick) info = ptr_server->nick; } - else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) ) + else if ( (ascii_strcasecmp (arg, "2") == 0) || (ascii_strcasecmp (arg, "channel") == 0) ) { if (BUFFER_IS_CHANNEL (gui_current_window->buffer)) info = CHANNEL (gui_current_window->buffer)->name; } - else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) ) + else if ( (ascii_strcasecmp (arg, "3") == 0) || (ascii_strcasecmp (arg, "server") == 0) ) { if (ptr_server->name) info = ptr_server->name; } - else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) ) + else if ( (ascii_strcasecmp (arg, "4") == 0) || (ascii_strcasecmp (arg, "weechatdir") == 0) ) { info = weechat_home; } - else if ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) ) + else if ( (ascii_strcasecmp (arg, "5") == 0) || (ascii_strcasecmp (arg, "away") == 0) ) { return Py_BuildValue ("i", SERVER(gui_current_window->buffer)->is_away); } - else if ( (strcasecmp (arg, "100") == 0) || (strcasecmp (arg, "dccs") == 0) ) + else if ( (ascii_strcasecmp (arg, "100") == 0) || (ascii_strcasecmp (arg, "dccs") == 0) ) { t_irc_dcc *p = dcc_list; int nbdccs = 0; diff --git a/src/plugins/ruby/wee-ruby.c b/src/plugins/ruby/wee-ruby.c index 449b9b003..edf774926 100644 --- a/src/plugins/ruby/wee-ruby.c +++ b/src/plugins/ruby/wee-ruby.c @@ -74,7 +74,7 @@ wee_ruby_register (VALUE class, VALUE name, VALUE version, VALUE shutdown_func, for (ptr_ruby_script = ruby_scripts; ptr_ruby_script; ptr_ruby_script = ptr_ruby_script->next_script) { - if (strcasecmp (ptr_ruby_script->name, c_name) == 0) + if (ascii_strcasecmp (ptr_ruby_script->name, c_name) == 0) { ruby_script_found = ptr_ruby_script; break; @@ -357,7 +357,7 @@ wee_ruby_get_info (VALUE class, VALUE arg, VALUE server_name) { for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (strcasecmp (ptr_server->name, c_server_name) == 0) + if (ascii_strcasecmp (ptr_server->name, c_server_name) == 0) break; } if (!ptr_server) @@ -372,34 +372,34 @@ wee_ruby_get_info (VALUE class, VALUE arg, VALUE server_name) if (ptr_server && c_arg) { - if ( (strcasecmp (c_arg, "0") == 0) || (strcasecmp (c_arg, "version") == 0) ) + if ( (ascii_strcasecmp (c_arg, "0") == 0) || (ascii_strcasecmp (c_arg, "version") == 0) ) { info = PACKAGE_STRING; } - else if ( (strcasecmp (c_arg, "1") == 0) || (strcasecmp (c_arg, "nick") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "1") == 0) || (ascii_strcasecmp (c_arg, "nick") == 0) ) { if (ptr_server->nick) info = ptr_server->nick; } - else if ( (strcasecmp (c_arg, "2") == 0) || (strcasecmp (c_arg, "channel") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "2") == 0) || (ascii_strcasecmp (c_arg, "channel") == 0) ) { if (BUFFER_IS_CHANNEL (gui_current_window->buffer)) info = CHANNEL (gui_current_window->buffer)->name; } - else if ( (strcasecmp (c_arg, "3") == 0) || (strcasecmp (c_arg, "server") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "3") == 0) || (ascii_strcasecmp (c_arg, "server") == 0) ) { if (ptr_server->name) info = ptr_server->name; } - else if ( (strcasecmp (c_arg, "4") == 0) || (strcasecmp (c_arg, "weechatdir") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "4") == 0) || (ascii_strcasecmp (c_arg, "weechatdir") == 0) ) { info = weechat_home; } - else if ( (strcasecmp (c_arg, "5") == 0) || (strcasecmp (c_arg, "away") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "5") == 0) || (ascii_strcasecmp (c_arg, "away") == 0) ) { return INT2FIX (SERVER(gui_current_window->buffer)->is_away); } - else if ( (strcasecmp (c_arg, "100") == 0) || (strcasecmp (c_arg, "dccs") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "100") == 0) || (ascii_strcasecmp (c_arg, "dccs") == 0) ) { /* TODO: build dcc list */ } diff --git a/weechat/ChangeLog b/weechat/ChangeLog index cbd894b76..71729de09 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,10 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2005-09-02 +ChangeLog - 2005-09-03 Version 0.1.5 (under dev!): + * fixed bug with strings comparison (str[n]casecmp) and some locales + (like turkish), now using ASCII comparison (thanks to roktas) * signal SIGQUIT is now ignored * fixed refresh bug when one line is bigger than screen size * fixed look_nicklist_min_size and look_nicklist_max_size options diff --git a/weechat/po/fr.po b/weechat/po/fr.po index 677ab91cd..2bd279e77 100644 --- a/weechat/po/fr.po +++ b/weechat/po/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: WeeChat 0.1.5-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "POT-Creation-Date: 2005-08-21 14:31+0200\n" -"PO-Revision-Date: 2005-08-21 14:31+0200\n" +"PO-Revision-Date: 2005-09-03 13:24+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2673,7 +2673,7 @@ msgstr "%s l'alias ou la commande \"%s\" existe d #: src/common/command.c:282 #, c-format msgid "%s alias cannot run another alias!\n" -msgstr "%s l'alias ne peux pas lancer un autre alias !\n" +msgstr "%s l'alias ne peut pas lancer un autre alias !\n" #: src/common/command.c:289 #, c-format diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c index 0835cf192..073ed2a82 100644 --- a/weechat/src/common/command.c +++ b/weechat/src/common/command.c @@ -191,7 +191,7 @@ alias_search (char *alias_name) for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) { - if (strcasecmp (alias_name, ptr_alias->alias_name) == 0) + if (ascii_strcasecmp (alias_name, ptr_alias->alias_name) == 0) return ptr_alias; } return NULL; @@ -208,7 +208,7 @@ alias_find_pos (char *alias_name) for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) { - if (strcasecmp (alias_name, ptr_alias->alias_name) < 0) + if (ascii_strcasecmp (alias_name, ptr_alias->alias_name) < 0) return ptr_alias; } return NULL; @@ -484,7 +484,7 @@ exec_weechat_command (t_irc_server *server, char *string) for (i = 0; weechat_commands[i].command_name; i++) { - if (strcasecmp (weechat_commands[i].command_name, command + 1) == 0) + if (ascii_strcasecmp (weechat_commands[i].command_name, command + 1) == 0) { if ((argc < weechat_commands[i].min_arg) || (argc > weechat_commands[i].max_arg)) @@ -544,7 +544,7 @@ exec_weechat_command (t_irc_server *server, char *string) } for (i = 0; irc_commands[i].command_name; i++) { - if ((strcasecmp (irc_commands[i].command_name, command + 1) == 0) && + if ((ascii_strcasecmp (irc_commands[i].command_name, command + 1) == 0) && ((irc_commands[i].cmd_function_args) || (irc_commands[i].cmd_function_1arg))) { @@ -615,7 +615,7 @@ exec_weechat_command (t_irc_server *server, char *string) for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) { - if (strcasecmp (ptr_alias->alias_name, command + 1) == 0) + if (ascii_strcasecmp (ptr_alias->alias_name, command + 1) == 0) { if (ptr_args) { @@ -890,7 +890,7 @@ weechat_cmd_buffer (int argc, char **argv) char *error; int target_buffer; - if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) + if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0))) { /* list opened buffers */ @@ -908,7 +908,7 @@ weechat_cmd_buffer (int argc, char **argv) } else { - if (strcasecmp (argv[0], "move") == 0) + if (ascii_strcasecmp (argv[0], "move") == 0) { /* move buffer to another number in the list */ @@ -943,7 +943,7 @@ weechat_cmd_buffer (int argc, char **argv) return -1; } } - else if (strcasecmp (argv[0], "close") == 0) + else if (ascii_strcasecmp (argv[0], "close") == 0) { /* close buffer (server or channel/private) */ @@ -995,7 +995,7 @@ weechat_cmd_buffer (int argc, char **argv) } gui_draw_buffer_status (gui_current_window->buffer, 1); } - else if (strcasecmp (argv[0], "notify") == 0) + else if (ascii_strcasecmp (argv[0], "notify") == 0) { /* set notify level for buffer */ @@ -1114,7 +1114,7 @@ weechat_cmd_clear (int argc, char **argv) { if (argc == 1) { - if (strcasecmp (argv[0], "-all") == 0) + if (ascii_strcasecmp (argv[0], "-all") == 0) gui_buffer_clear_all (); else { @@ -1198,7 +1198,7 @@ weechat_cmd_debug (int argc, char **argv) return -1; } - if (strcasecmp (argv[0], "dump") == 0) + if (ascii_strcasecmp (argv[0], "dump") == 0) { wee_dump (0); } @@ -1294,7 +1294,7 @@ weechat_cmd_help (int argc, char **argv) { for (i = 0; weechat_commands[i].command_name; i++) { - if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0) + if (ascii_strcasecmp (weechat_commands[i].command_name, argv[0]) == 0) { gui_printf (NULL, "\n"); gui_printf (NULL, "[w]"); @@ -1319,7 +1319,7 @@ weechat_cmd_help (int argc, char **argv) } for (i = 0; irc_commands[i].command_name; i++) { - if ((strcasecmp (irc_commands[i].command_name, argv[0]) == 0) + if ((ascii_strcasecmp (irc_commands[i].command_name, argv[0]) == 0) && (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)) { gui_printf (NULL, "\n"); @@ -1402,7 +1402,7 @@ weechat_cmd_key (char *arguments) weechat_cmd_key_display (ptr_key, 0); } } - else if (strncasecmp (arguments, "unbind ", 7) == 0) + else if (ascii_strncasecmp (arguments, "unbind ", 7) == 0) { arguments += 7; while (arguments[0] == ' ') @@ -1418,7 +1418,7 @@ weechat_cmd_key (char *arguments) return -1; } } - else if (strcasecmp (arguments, "functions") == 0) + else if (ascii_strcasecmp (arguments, "functions") == 0) { gui_printf (NULL, "\n"); gui_printf (NULL, _("Internal key functions:\n")); @@ -1431,12 +1431,12 @@ weechat_cmd_key (char *arguments) i++; } } - else if (strncasecmp (arguments, "reset", 5) == 0) + else if (ascii_strncasecmp (arguments, "reset", 5) == 0) { arguments += 5; while (arguments[0] == ' ') arguments++; - if (strcasecmp (arguments, "-yes") == 0) + if (ascii_strcasecmp (arguments, "-yes") == 0) { gui_key_free_all (); gui_key_init (); @@ -1570,18 +1570,18 @@ weechat_cmd_perl (int argc, char **argv) break; case 1: - if (strcasecmp (argv[0], "autoload") == 0) + if (ascii_strcasecmp (argv[0], "autoload") == 0) plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload"); - else if (strcasecmp (argv[0], "reload") == 0) + else if (ascii_strcasecmp (argv[0], "reload") == 0) { plugin_unload (PLUGIN_TYPE_PERL, NULL); plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload"); } - else if (strcasecmp (argv[0], "unload") == 0) + else if (ascii_strcasecmp (argv[0], "unload") == 0) plugin_unload (PLUGIN_TYPE_PERL, NULL); break; case 2: - if (strcasecmp (argv[0], "load") == 0) + if (ascii_strcasecmp (argv[0], "load") == 0) { /* load Perl script */ if (strstr(argv[1], DIR_SEPARATOR)) @@ -1713,18 +1713,18 @@ weechat_cmd_python (int argc, char **argv) break; case 1: - if (strcasecmp (argv[0], "autoload") == 0) + if (ascii_strcasecmp (argv[0], "autoload") == 0) plugin_auto_load (PLUGIN_TYPE_PYTHON, "python/autoload"); - else if (strcasecmp (argv[0], "reload") == 0) + else if (ascii_strcasecmp (argv[0], "reload") == 0) { plugin_unload (PLUGIN_TYPE_PYTHON, NULL); plugin_auto_load (PLUGIN_TYPE_PYTHON, "python/autoload"); } - else if (strcasecmp (argv[0], "unload") == 0) + else if (ascii_strcasecmp (argv[0], "unload") == 0) plugin_unload (PLUGIN_TYPE_PYTHON, NULL); break; case 2: - if (strcasecmp (argv[0], "load") == 0) + if (ascii_strcasecmp (argv[0], "load") == 0) { /* load Python script */ if (strstr(argv[1], DIR_SEPARATOR)) @@ -1856,18 +1856,18 @@ weechat_cmd_ruby (int argc, char **argv) break; case 1: - if (strcasecmp (argv[0], "autoload") == 0) + if (ascii_strcasecmp (argv[0], "autoload") == 0) plugin_auto_load (PLUGIN_TYPE_RUBY, "ruby/autoload"); - else if (strcasecmp (argv[0], "reload") == 0) + else if (ascii_strcasecmp (argv[0], "reload") == 0) { plugin_unload (PLUGIN_TYPE_RUBY, NULL); plugin_auto_load (PLUGIN_TYPE_RUBY, "ruby/autoload"); } - else if (strcasecmp (argv[0], "unload") == 0) + else if (ascii_strcasecmp (argv[0], "unload") == 0) plugin_unload (PLUGIN_TYPE_RUBY, NULL); break; case 2: - if (strcasecmp (argv[0], "load") == 0) + if (ascii_strcasecmp (argv[0], "load") == 0) { /* load Ruby script */ if (strstr(argv[1], DIR_SEPARATOR)) @@ -1967,7 +1967,7 @@ weechat_cmd_server (int argc, char **argv) } else { - if (strcasecmp (argv[0], "del") == 0) + if (ascii_strcasecmp (argv[0], "del") == 0) { if (argc < 2) { @@ -2067,15 +2067,15 @@ weechat_cmd_server (int argc, char **argv) { if (argv[i][0] == '-') { - if (strcasecmp (argv[i], "-auto") == 0) + if (ascii_strcasecmp (argv[i], "-auto") == 0) server.autoconnect = 1; - if (strcasecmp (argv[i], "-noauto") == 0) + if (ascii_strcasecmp (argv[i], "-noauto") == 0) server.autoconnect = 0; - if (strcasecmp (argv[i], "-ipv6") == 0) + if (ascii_strcasecmp (argv[i], "-ipv6") == 0) server.ipv6 = 1; - if (strcasecmp (argv[i], "-ssl") == 0) + if (ascii_strcasecmp (argv[i], "-ssl") == 0) server.ssl = 1; - if (strcasecmp (argv[i], "-pwd") == 0) + if (ascii_strcasecmp (argv[i], "-pwd") == 0) { if (i == (argc - 1)) { @@ -2088,7 +2088,7 @@ weechat_cmd_server (int argc, char **argv) } server.password = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-nicks") == 0) + if (ascii_strcasecmp (argv[i], "-nicks") == 0) { if (i >= (argc - 3)) { @@ -2103,7 +2103,7 @@ weechat_cmd_server (int argc, char **argv) server.nick2 = strdup (argv[++i]); server.nick3 = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-username") == 0) + if (ascii_strcasecmp (argv[i], "-username") == 0) { if (i == (argc - 1)) { @@ -2116,7 +2116,7 @@ weechat_cmd_server (int argc, char **argv) } server.username = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-realname") == 0) + if (ascii_strcasecmp (argv[i], "-realname") == 0) { if (i == (argc - 1)) { @@ -2129,7 +2129,7 @@ weechat_cmd_server (int argc, char **argv) } server.realname = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-command") == 0) + if (ascii_strcasecmp (argv[i], "-command") == 0) { if (i == (argc - 1)) { @@ -2142,7 +2142,7 @@ weechat_cmd_server (int argc, char **argv) } server.command = strdup (argv[++i]); } - if (strcasecmp (argv[i], "-autojoin") == 0) + if (ascii_strcasecmp (argv[i], "-autojoin") == 0) { if (i == (argc - 1)) { @@ -2529,7 +2529,7 @@ weechat_cmd_window (int argc, char **argv) t_gui_window *ptr_win; int i; - if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) + if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0))) { /* list opened windows */ @@ -2558,29 +2558,29 @@ weechat_cmd_window (int argc, char **argv) } else { - if (strcasecmp (argv[0], "splith") == 0) + if (ascii_strcasecmp (argv[0], "splith") == 0) { /* split window horizontally */ gui_window_split_horiz (gui_current_window); } - else if (strcasecmp (argv[0], "splitv") == 0) + else if (ascii_strcasecmp (argv[0], "splitv") == 0) { /* split window vertically */ gui_window_split_vertic (gui_current_window); } - else if (strcasecmp (argv[0], "merge") == 0) + else if (ascii_strcasecmp (argv[0], "merge") == 0) { if (argc >= 2) { - if (strcasecmp (argv[1], "down") == 0) + if (ascii_strcasecmp (argv[1], "down") == 0) gui_window_merge_down (gui_current_window); - else if (strcasecmp (argv[1], "up") == 0) + else if (ascii_strcasecmp (argv[1], "up") == 0) gui_window_merge_up (gui_current_window); - else if (strcasecmp (argv[1], "left") == 0) + else if (ascii_strcasecmp (argv[1], "left") == 0) gui_window_merge_left (gui_current_window); - else if (strcasecmp (argv[1], "right") == 0) + else if (ascii_strcasecmp (argv[1], "right") == 0) gui_window_merge_right (gui_current_window); - else if (strcasecmp (argv[1], "all") == 0) + else if (ascii_strcasecmp (argv[1], "all") == 0) gui_window_merge_all (gui_current_window); else { @@ -2594,9 +2594,9 @@ weechat_cmd_window (int argc, char **argv) else gui_window_merge_auto (gui_current_window); } - else if (strcasecmp (argv[0], "-1") == 0) + else if (ascii_strcasecmp (argv[0], "-1") == 0) gui_switch_to_previous_window (); - else if (strcasecmp (argv[0], "+1") == 0) + else if (ascii_strcasecmp (argv[0], "+1") == 0) gui_switch_to_next_window (); else { diff --git a/weechat/src/common/completion.c b/weechat/src/common/completion.c index decfad2c8..41be8e894 100644 --- a/weechat/src/common/completion.c +++ b/weechat/src/common/completion.c @@ -111,13 +111,13 @@ completion_build_list (t_completion *completion, void *channel) /* WeeChat internal commands */ /* no completion for some commands */ - if ((strcasecmp (completion->base_command, "server") == 0) - || (strcasecmp (completion->base_command, "save") == 0)) + if ((ascii_strcasecmp (completion->base_command, "server") == 0) + || (ascii_strcasecmp (completion->base_command, "save") == 0)) { completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "alias") == 0) + if ((ascii_strcasecmp (completion->base_command, "alias") == 0) && (completion->base_command_arg == 1)) { for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist) @@ -128,7 +128,7 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if ((strcasecmp (completion->base_command, "buffer") == 0) + if ((ascii_strcasecmp (completion->base_command, "buffer") == 0) && (completion->base_command_arg == 1)) { weelist_add (&completion->completion_list, @@ -145,7 +145,7 @@ completion_build_list (t_completion *completion, void *channel) "notify"); return; } - if ((strcasecmp (completion->base_command, "clear") == 0) + if ((ascii_strcasecmp (completion->base_command, "clear") == 0) && (completion->base_command_arg == 1)) { weelist_add (&completion->completion_list, @@ -153,8 +153,8 @@ completion_build_list (t_completion *completion, void *channel) "-all"); return; } - if ((strcasecmp (completion->base_command, "connect") == 0) - || (strcasecmp (completion->base_command, "disconnect") == 0)) + if ((ascii_strcasecmp (completion->base_command, "connect") == 0) + || (ascii_strcasecmp (completion->base_command, "disconnect") == 0)) { if (completion->base_command_arg == 1) { @@ -173,7 +173,7 @@ completion_build_list (t_completion *completion, void *channel) return; } } - if (strcasecmp (completion->base_command, "debug") == 0) + if (ascii_strcasecmp (completion->base_command, "debug") == 0) { if (completion->base_command_arg == 1) weelist_add (&completion->completion_list, @@ -183,7 +183,7 @@ completion_build_list (t_completion *completion, void *channel) completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "help") == 0) + if ((ascii_strcasecmp (completion->base_command, "help") == 0) && (completion->base_command_arg == 1)) { for (i = 0; weechat_commands[i].command_name; i++) @@ -201,7 +201,7 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if (strcasecmp (completion->base_command, "key") == 0) + if (ascii_strcasecmp (completion->base_command, "key") == 0) { if (completion->base_command_arg == 1) { @@ -229,8 +229,8 @@ completion_build_list (t_completion *completion, void *channel) return; } } - if (((strcasecmp (completion->base_command, "perl") == 0) - || (strcasecmp (completion->base_command, "python") == 0)) + if (((ascii_strcasecmp (completion->base_command, "perl") == 0) + || (ascii_strcasecmp (completion->base_command, "python") == 0)) && (completion->base_command_arg == 1)) { weelist_add (&completion->completion_list, @@ -247,7 +247,7 @@ completion_build_list (t_completion *completion, void *channel) "unload"); return; } - if (strcasecmp (completion->base_command, "set") == 0) + if (ascii_strcasecmp (completion->base_command, "set") == 0) { if (completion->base_command_arg == 1) { @@ -340,7 +340,7 @@ completion_build_list (t_completion *completion, void *channel) completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "unalias") == 0) + if ((ascii_strcasecmp (completion->base_command, "unalias") == 0) && (completion->base_command_arg == 1)) { for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) @@ -351,7 +351,7 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if (strcasecmp (completion->base_command, "window") == 0) + if (ascii_strcasecmp (completion->base_command, "window") == 0) { if (completion->base_command_arg == 1) { @@ -397,33 +397,33 @@ completion_build_list (t_completion *completion, void *channel) /* IRC commands */ /* no completion for some commands */ - if ((strcasecmp (completion->base_command, "admin") == 0) - || (strcasecmp (completion->base_command, "die") == 0) - || (strcasecmp (completion->base_command, "info") == 0) - || (strcasecmp (completion->base_command, "join") == 0) - || (strcasecmp (completion->base_command, "links") == 0) - || (strcasecmp (completion->base_command, "list") == 0) - || (strcasecmp (completion->base_command, "lusers") == 0) - || (strcasecmp (completion->base_command, "motd") == 0) - || (strcasecmp (completion->base_command, "oper") == 0) - || (strcasecmp (completion->base_command, "rehash") == 0) - || (strcasecmp (completion->base_command, "restart") == 0) - || (strcasecmp (completion->base_command, "service") == 0) - || (strcasecmp (completion->base_command, "servlist") == 0) - || (strcasecmp (completion->base_command, "squery") == 0) - || (strcasecmp (completion->base_command, "squit") == 0) - || (strcasecmp (completion->base_command, "stats") == 0) - || (strcasecmp (completion->base_command, "summon") == 0) - || (strcasecmp (completion->base_command, "time") == 0) - || (strcasecmp (completion->base_command, "trace") == 0) - || (strcasecmp (completion->base_command, "users") == 0) - || (strcasecmp (completion->base_command, "wallops") == 0) - || (strcasecmp (completion->base_command, "who") == 0)) + if ((ascii_strcasecmp (completion->base_command, "admin") == 0) + || (ascii_strcasecmp (completion->base_command, "die") == 0) + || (ascii_strcasecmp (completion->base_command, "info") == 0) + || (ascii_strcasecmp (completion->base_command, "join") == 0) + || (ascii_strcasecmp (completion->base_command, "links") == 0) + || (ascii_strcasecmp (completion->base_command, "list") == 0) + || (ascii_strcasecmp (completion->base_command, "lusers") == 0) + || (ascii_strcasecmp (completion->base_command, "motd") == 0) + || (ascii_strcasecmp (completion->base_command, "oper") == 0) + || (ascii_strcasecmp (completion->base_command, "rehash") == 0) + || (ascii_strcasecmp (completion->base_command, "restart") == 0) + || (ascii_strcasecmp (completion->base_command, "service") == 0) + || (ascii_strcasecmp (completion->base_command, "servlist") == 0) + || (ascii_strcasecmp (completion->base_command, "squery") == 0) + || (ascii_strcasecmp (completion->base_command, "squit") == 0) + || (ascii_strcasecmp (completion->base_command, "stats") == 0) + || (ascii_strcasecmp (completion->base_command, "summon") == 0) + || (ascii_strcasecmp (completion->base_command, "time") == 0) + || (ascii_strcasecmp (completion->base_command, "trace") == 0) + || (ascii_strcasecmp (completion->base_command, "users") == 0) + || (ascii_strcasecmp (completion->base_command, "wallops") == 0) + || (ascii_strcasecmp (completion->base_command, "who") == 0)) { completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "away") == 0) + if ((ascii_strcasecmp (completion->base_command, "away") == 0) && (completion->base_command_arg == 1)) { if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) @@ -432,7 +432,7 @@ completion_build_list (t_completion *completion, void *channel) cfg_irc_default_msg_away); return; } - if ((strcasecmp (completion->base_command, "ctcp") == 0) + if ((ascii_strcasecmp (completion->base_command, "ctcp") == 0) && (completion->base_command_arg == 2)) { weelist_add (&completion->completion_list, @@ -446,7 +446,7 @@ completion_build_list (t_completion *completion, void *channel) "version"); return; } - if ((strcasecmp (completion->base_command, "dcc") == 0) + if ((ascii_strcasecmp (completion->base_command, "dcc") == 0) && (completion->base_command_arg == 1)) { weelist_add (&completion->completion_list, @@ -460,7 +460,7 @@ completion_build_list (t_completion *completion, void *channel) "close"); return; } - if (strcasecmp (completion->base_command, "invite") == 0) + if (ascii_strcasecmp (completion->base_command, "invite") == 0) { /* arg1: nickname */ if (completion->base_command_arg == 1) @@ -486,30 +486,30 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if (strcasecmp (completion->base_command, "kick") == 0) + if (ascii_strcasecmp (completion->base_command, "kick") == 0) { if (completion->base_command_arg != 1) completion_stop (completion); return; } - if (strcasecmp (completion->base_command, "kill") == 0) + if (ascii_strcasecmp (completion->base_command, "kill") == 0) { if (completion->base_command_arg != 1) completion_stop (completion); return; } - if (strcasecmp (completion->base_command, "me") == 0) + if (ascii_strcasecmp (completion->base_command, "me") == 0) { completion->context = COMPLETION_NICK; return; } - if (strcasecmp (completion->base_command, "notice") == 0) + if (ascii_strcasecmp (completion->base_command, "notice") == 0) { if (completion->base_command_arg != 1) completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "part") == 0) + if ((ascii_strcasecmp (completion->base_command, "part") == 0) && (completion->base_command_arg == 1)) { if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0]) @@ -518,13 +518,13 @@ completion_build_list (t_completion *completion, void *channel) cfg_irc_default_msg_part); return; } - if (strcasecmp (completion->base_command, "query") == 0) + if (ascii_strcasecmp (completion->base_command, "query") == 0) { if (completion->base_command_arg != 1) completion_stop (completion); return; } - if ((strcasecmp (completion->base_command, "quit") == 0) + if ((ascii_strcasecmp (completion->base_command, "quit") == 0) && (completion->base_command_arg == 1)) { if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) @@ -533,7 +533,7 @@ completion_build_list (t_completion *completion, void *channel) cfg_irc_default_msg_quit); return; } - if (strcasecmp (completion->base_command, "topic") == 0) + if (ascii_strcasecmp (completion->base_command, "topic") == 0) { if (completion->base_command_arg == 1) { @@ -717,7 +717,7 @@ completion_command (t_completion *completion) other_completion = 0; for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0) + if (ascii_strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0) { if ((!completion->word_found) || word_found_seen) { @@ -725,7 +725,7 @@ completion_command (t_completion *completion) for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; ptr_weelist2 = ptr_weelist2->next_weelist) { - if (strncasecmp (ptr_weelist2->data, + if (ascii_strncasecmp (ptr_weelist2->data, completion->base_word + 1, length) == 0) other_completion++; } @@ -739,7 +739,7 @@ completion_command (t_completion *completion) other_completion++; } if (completion->word_found && - (strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + (ascii_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) word_found_seen = 1; } if (completion->word_found) @@ -765,7 +765,7 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel) for (ptr_weelist = completion->completion_list; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) + if (ascii_strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) { if ((!completion->word_found) || word_found_seen) { @@ -773,7 +773,7 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel) for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; ptr_weelist2 = ptr_weelist2->next_weelist) { - if (strncasecmp (ptr_weelist2->data, + if (ascii_strncasecmp (ptr_weelist2->data, completion->base_word, length) == 0) other_completion++; } @@ -787,7 +787,7 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel) other_completion++; } if (completion->word_found && - (strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + (ascii_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) word_found_seen = 1; } if (completion->word_found) @@ -821,7 +821,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel) other_completion = 0; for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0) + if (ascii_strncasecmp (ptr_nick->nick, completion->base_word, length) == 0) { if ((!completion->word_found) || word_found_seen) { @@ -829,7 +829,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel) for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2; ptr_nick2 = ptr_nick2->next_nick) { - if (strncasecmp (ptr_nick2->nick, + if (ascii_strncasecmp (ptr_nick2->nick, completion->base_word, length) == 0) other_completion++; } @@ -843,7 +843,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel) other_completion++; } if (completion->word_found && - (strcasecmp (ptr_nick->nick, completion->word_found) == 0)) + (ascii_strcasecmp (ptr_nick->nick, completion->word_found) == 0)) word_found_seen = 1; } if (completion->word_found) diff --git a/weechat/src/common/weechat.c b/weechat/src/common/weechat.c index b8692da57..f0ed84597 100644 --- a/weechat/src/common/weechat.c +++ b/weechat/src/common/weechat.c @@ -83,6 +83,78 @@ gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */ #endif +/* + * ascii_strcasecmp: locale and case independent string comparison + */ + +int +ascii_strcasecmp (char *string1, char *string2) +{ + int c1, c2; + + if (!string1 || !string2) + return (string1) ? 1 : ((string2) ? -1 : 0); + + while (string1[0] && string2[0]) + { + c1 = (int)((unsigned char) string1[0]); + c2 = (int)((unsigned char) string2[0]); + + if ((c1 >= 'A') && (c1 <= 'Z')) + c1 += ('a' - 'A'); + + if ((c2 >= 'A') && (c2 <= 'Z')) + c2 += ('a' - 'A'); + + if ((c1 - c2) != 0) + return c1 - c2; + + string1++; + string2++; + } + + return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0); +} + +/* + * ascii_strncasecmp: locale and case independent string comparison + * with max length + */ + +int +ascii_strncasecmp (char *string1, char *string2, int max) +{ + int c1, c2, count; + + if (!string1 || !string2) + return (string1) ? 1 : ((string2) ? -1 : 0); + + count = 0; + while ((count < max) && string1[0] && string2[0]) + { + c1 = (int)((unsigned char) string1[0]); + c2 = (int)((unsigned char) string2[0]); + + if ((c1 >= 'A') && (c1 <= 'Z')) + c1 += ('a' - 'A'); + + if ((c2 >= 'A') && (c2 <= 'Z')) + c2 += ('a' - 'A'); + + if ((c1 - c2) != 0) + return c1 - c2; + + string1++; + string2++; + count++; + } + + if (count >= max) + return 0; + else + return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0); +} + /* * wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log) */ @@ -131,7 +203,7 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string) size_t inbytesleft, outbytesleft; if (from_code && from_code[0] && to_code && to_code[0] - && (strcasecmp(from_code, to_code) != 0)) + && (ascii_strcasecmp(from_code, to_code) != 0)) { cd = iconv_open (to_code, from_code); if (cd == (iconv_t)(-1)) @@ -418,7 +490,7 @@ wee_parse_args (int argc, char *argv[]) wee_display_commands (1, 0); wee_shutdown (EXIT_SUCCESS, 0); } - else if ((strncasecmp (argv[i], "irc", 3) == 0)) + else if ((ascii_strncasecmp (argv[i], "irc", 3) == 0)) { if (server_init_with_url (argv[i], &server_tmp) < 0) { diff --git a/weechat/src/common/weechat.h b/weechat/src/common/weechat.h index 9304671a8..80771d700 100644 --- a/weechat/src/common/weechat.h +++ b/weechat/src/common/weechat.h @@ -118,6 +118,8 @@ extern char *local_charset; extern gnutls_certificate_credentials gnutls_xcred; #endif +extern int ascii_strcasecmp (char *, char *); +extern int ascii_strncasecmp (char *, char *, int); extern void wee_log_printf (char *, ...); extern void wee_dump (int); extern char *weechat_convert_encoding (char *, char *, char *); diff --git a/weechat/src/common/weeconfig.c b/weechat/src/common/weeconfig.c index 31bd94833..2b181d1ae 100644 --- a/weechat/src/common/weeconfig.c +++ b/weechat/src/common/weeconfig.c @@ -775,7 +775,7 @@ get_pos_array_values (char **array, char *string) i = 0; while (array[i]) { - if (strcasecmp (array[i], string) == 0) + if (ascii_strcasecmp (array[i], string) == 0) return i; i++; } @@ -926,9 +926,9 @@ config_option_set_value (t_config_option *option, char *value) switch (option->option_type) { case OPTION_TYPE_BOOLEAN: - if (strcasecmp (value, "on") == 0) + if (ascii_strcasecmp (value, "on") == 0) *(option->ptr_int) = BOOL_TRUE; - else if (strcasecmp (value, "off") == 0) + else if (ascii_strcasecmp (value, "off") == 0) *(option->ptr_int) = BOOL_FALSE; else return -1; @@ -965,43 +965,43 @@ config_option_set_value (t_config_option *option, char *value) void * config_get_server_option_ptr (t_irc_server *server, char *option_name) { - if (strcasecmp (option_name, "server_name") == 0) + if (ascii_strcasecmp (option_name, "server_name") == 0) return (void *)(&server->name); - if (strcasecmp (option_name, "server_autoconnect") == 0) + if (ascii_strcasecmp (option_name, "server_autoconnect") == 0) return (void *)(&server->autoconnect); - if (strcasecmp (option_name, "server_autoreconnect") == 0) + if (ascii_strcasecmp (option_name, "server_autoreconnect") == 0) return (void *)(&server->autoreconnect); - if (strcasecmp (option_name, "server_autoreconnect_delay") == 0) + if (ascii_strcasecmp (option_name, "server_autoreconnect_delay") == 0) return (void *)(&server->autoreconnect_delay); - if (strcasecmp (option_name, "server_address") == 0) + if (ascii_strcasecmp (option_name, "server_address") == 0) return (void *)(&server->address); - if (strcasecmp (option_name, "server_port") == 0) + if (ascii_strcasecmp (option_name, "server_port") == 0) return (void *)(&server->port); - if (strcasecmp (option_name, "server_ipv6") == 0) + if (ascii_strcasecmp (option_name, "server_ipv6") == 0) return (void *)(&server->ipv6); - if (strcasecmp (option_name, "server_ssl") == 0) + if (ascii_strcasecmp (option_name, "server_ssl") == 0) return (void *)(&server->ssl); - if (strcasecmp (option_name, "server_password") == 0) + if (ascii_strcasecmp (option_name, "server_password") == 0) return (void *)(&server->password); - if (strcasecmp (option_name, "server_nick1") == 0) + if (ascii_strcasecmp (option_name, "server_nick1") == 0) return (void *)(&server->nick1); - if (strcasecmp (option_name, "server_nick2") == 0) + if (ascii_strcasecmp (option_name, "server_nick2") == 0) return (void *)(&server->nick2); - if (strcasecmp (option_name, "server_nick3") == 0) + if (ascii_strcasecmp (option_name, "server_nick3") == 0) return (void *)(&server->nick3); - if (strcasecmp (option_name, "server_username") == 0) + if (ascii_strcasecmp (option_name, "server_username") == 0) return (void *)(&server->username); - if (strcasecmp (option_name, "server_realname") == 0) + if (ascii_strcasecmp (option_name, "server_realname") == 0) return (void *)(&server->realname); - if (strcasecmp (option_name, "server_command") == 0) + if (ascii_strcasecmp (option_name, "server_command") == 0) return (void *)(&server->command); - if (strcasecmp (option_name, "server_command_delay") == 0) + if (ascii_strcasecmp (option_name, "server_command_delay") == 0) return (void *)(&server->command_delay); - if (strcasecmp (option_name, "server_autojoin") == 0) + if (ascii_strcasecmp (option_name, "server_autojoin") == 0) return (void *)(&server->autojoin); - if (strcasecmp (option_name, "server_autorejoin") == 0) + if (ascii_strcasecmp (option_name, "server_autorejoin") == 0) return (void *)(&server->autorejoin); - if (strcasecmp (option_name, "server_notify_levels") == 0) + if (ascii_strcasecmp (option_name, "server_notify_levels") == 0) return (void *)(&server->notify_levels); /* option not found */ return NULL; @@ -1031,7 +1031,7 @@ config_set_server_value (t_irc_server *server, char *option_name, for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++) { /* if option found, return pointer */ - if (strcasecmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, option_name) == 0) + if (ascii_strcasecmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, option_name) == 0) { ptr_option = &weechat_options[CONFIG_SECTION_SERVER][i]; break; @@ -1043,9 +1043,9 @@ config_set_server_value (t_irc_server *server, char *option_name, switch (ptr_option->option_type) { case OPTION_TYPE_BOOLEAN: - if (strcasecmp (value, "on") == 0) + if (ascii_strcasecmp (value, "on") == 0) *((int *)(ptr_data)) = BOOL_TRUE; - else if (strcasecmp (value, "off") == 0) + else if (ascii_strcasecmp (value, "off") == 0) *((int *)(ptr_data)) = BOOL_FALSE; else return -2; @@ -1095,7 +1095,7 @@ config_option_search (char *option_name) for (j = 0; weechat_options[i][j].option_name; j++) { /* if option found, return pointer */ - if (strcasecmp (weechat_options[i][j].option_name, option_name) == 0) + if (ascii_strcasecmp (weechat_options[i][j].option_name, option_name) == 0) return &weechat_options[i][j]; } } diff --git a/weechat/src/common/weelist.c b/weechat/src/common/weelist.c index e4bf30ef9..2a34937e2 100644 --- a/weechat/src/common/weelist.c +++ b/weechat/src/common/weelist.c @@ -42,7 +42,7 @@ weelist_search (t_weelist *weelist, char *data) for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strcasecmp (data, ptr_weelist->data) == 0) + if (ascii_strcasecmp (data, ptr_weelist->data) == 0) return ptr_weelist; } /* word not found in list */ @@ -60,7 +60,7 @@ weelist_find_pos (t_weelist *weelist, char *data) for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strcasecmp (data, ptr_weelist->data) < 0) + if (ascii_strcasecmp (data, ptr_weelist->data) < 0) return ptr_weelist; } /* position not found, best position is at the end */ diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c index 636752f90..d61284f1c 100644 --- a/weechat/src/gui/curses/gui-display.c +++ b/weechat/src/gui/curses/gui-display.c @@ -80,7 +80,7 @@ gui_assign_color (int *color, char *color_name) i = 0; while (gui_colors[i].name) { - if (strcasecmp (gui_colors[i].name, color_name) == 0) + if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0) { *color = gui_colors[i].color; return 1; @@ -105,7 +105,7 @@ gui_get_color_by_name (char *color_name) i = 0; while (gui_colors[i].name) { - if (strcasecmp (gui_colors[i].name, color_name) == 0) + if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0) return gui_colors[i].color; i++; } diff --git a/weechat/src/gui/gtk/gui-display.c b/weechat/src/gui/gtk/gui-display.c index 8835f9ad0..b519c9b73 100644 --- a/weechat/src/gui/gtk/gui-display.c +++ b/weechat/src/gui/gtk/gui-display.c @@ -89,7 +89,7 @@ gui_assign_color (int *color, char *color_name) i = 0; while (gui_colors[i].name) { - if (strcasecmp (gui_colors[i].name, color_name) == 0) + if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0) { *color = gui_colors[i].color; return 1; @@ -114,7 +114,7 @@ gui_get_color_by_name (char *color_name) i = 0; while (gui_colors[i].name) { - if (strcasecmp (gui_colors[i].name, color_name) == 0) + if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0) return gui_colors[i].color; i++; } diff --git a/weechat/src/gui/gui-keyboard.c b/weechat/src/gui/gui-keyboard.c index 2443975fd..28c331db4 100644 --- a/weechat/src/gui/gui-keyboard.c +++ b/weechat/src/gui/gui-keyboard.c @@ -157,17 +157,17 @@ gui_key_get_internal_code (char *key) result[0] = '\0'; while (key[0]) { - if (strncasecmp (key, "meta2-", 6) == 0) + if (ascii_strncasecmp (key, "meta2-", 6) == 0) { strcat (result, "^[["); key += 6; } - if (strncasecmp (key, "meta-", 5) == 0) + if (ascii_strncasecmp (key, "meta-", 5) == 0) { strcat (result, "^["); key += 5; } - else if (strncasecmp (key, "ctrl-", 5) == 0) + else if (ascii_strncasecmp (key, "ctrl-", 5) == 0) { strcat (result, "^"); key += 5; @@ -200,12 +200,12 @@ gui_key_get_expanded_name (char *key) result[0] = '\0'; while (key[0]) { - if (strncasecmp (key, "^[[", 3) == 0) + if (ascii_strncasecmp (key, "^[[", 3) == 0) { strcat (result, "meta2-"); key += 3; } - if (strncasecmp (key, "^[", 2) == 0) + if (ascii_strncasecmp (key, "^[", 2) == 0) { strcat (result, "meta-"); key += 2; @@ -239,7 +239,7 @@ gui_key_find_pos (t_gui_key *key) for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) { - if (strcasecmp (key->key, ptr_key->key) < 0) + if (ascii_strcasecmp (key->key, ptr_key->key) < 0) return ptr_key; } return NULL; @@ -324,7 +324,7 @@ gui_key_search (char *key) for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) { - if (strcasecmp (ptr_key->key, key) == 0) + if (ascii_strcasecmp (ptr_key->key, key) == 0) return ptr_key; } @@ -381,7 +381,7 @@ gui_key_function_search_by_name (char *name) i = 0; while (gui_key_functions[i].function_name) { - if (strcasecmp (gui_key_functions[i].function_name, name) == 0) + if (ascii_strcasecmp (gui_key_functions[i].function_name, name) == 0) return gui_key_functions[i].function; i++; } @@ -504,7 +504,7 @@ gui_key_pressed (char *key_str) ptr_key = gui_key_search_part (gui_key_buffer); if (ptr_key) { - if (strcasecmp (ptr_key->key, gui_key_buffer) == 0) + if (ascii_strcasecmp (ptr_key->key, gui_key_buffer) == 0) { /* exact combo found => execute function or command */ gui_key_buffer[0] = '\0'; diff --git a/weechat/src/irc/irc-channel.c b/weechat/src/irc/irc-channel.c index 0323b7869..6aec9902f 100644 --- a/weechat/src/irc/irc-channel.c +++ b/weechat/src/irc/irc-channel.c @@ -147,7 +147,7 @@ channel_search (t_irc_server *server, char *channel_name) for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - if (strcasecmp (ptr_channel->name, channel_name) == 0) + if (ascii_strcasecmp (ptr_channel->name, channel_name) == 0) return ptr_channel; } return NULL; diff --git a/weechat/src/irc/irc-nick.c b/weechat/src/irc/irc-nick.c index af845e3f2..37d4aaf6c 100644 --- a/weechat/src/irc/irc-nick.c +++ b/weechat/src/irc/irc-nick.c @@ -33,7 +33,7 @@ /* - * nick_find_color: find a color for a nick (less used will be better!) + * nick_find_color: find a color for a nick (according to nick letters) */ int @@ -87,12 +87,11 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) score1 = nick_score_for_sort (nick1); score2 = nick_score_for_sort (nick2); - comp = strcasecmp(nick1->nick, nick2->nick); + comp = ascii_strcasecmp (nick1->nick, nick2->nick); if (comp > 0) score1++; - else - if (comp < 0) - score2++; + if (comp < 0) + score2++; /* nick1 > nick2 */ if (score1 > score2) @@ -202,7 +201,7 @@ nick_new (t_irc_channel *channel, char *nick_name, new_nick->is_halfop = is_halfop; new_nick->has_voice = has_voice; new_nick->is_away = 0; - if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0) + if (ascii_strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0) new_nick->color = COLOR_WIN_NICK_SELF; else new_nick->color = nick_find_color (new_nick); @@ -319,7 +318,7 @@ nick_search (t_irc_channel *channel, char *nickname) for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - if (strcasecmp (ptr_nick->nick, nickname) == 0) + if (ascii_strcasecmp (ptr_nick->nick, nickname) == 0) return ptr_nick; } return NULL; diff --git a/weechat/src/irc/irc-recv.c b/weechat/src/irc/irc-recv.c index 781e0db9a..eecefc12d 100644 --- a/weechat/src/irc/irc-recv.c +++ b/weechat/src/irc/irc-recv.c @@ -150,7 +150,7 @@ irc_recv_command (t_irc_server *server, char *entire_line, cmd_found = -1; for (i = 0; irc_commands[i].command_name; i++) { - if (strcasecmp (irc_commands[i].command_name, command) == 0) + if (ascii_strcasecmp (irc_commands[i].command_name, command) == 0) { cmd_found = i; break; @@ -929,7 +929,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments) if ((SERVER(ptr_buffer) == server) && BUFFER_IS_PRIVATE(ptr_buffer)) { if ((CHANNEL(ptr_buffer)->name) - && (strcasecmp (host, CHANNEL(ptr_buffer)->name) == 0)) + && (ascii_strcasecmp (host, CHANNEL(ptr_buffer)->name) == 0)) { free (CHANNEL(ptr_buffer)->name); CHANNEL(ptr_buffer)->name = strdup (arguments); @@ -1104,9 +1104,9 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments) gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": "); } gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", pos); - if ((host) && (strcasecmp (host, "nickserv") != 0) && - (strcasecmp (host, "chanserv") != 0) && - (strcasecmp (host, "memoserv") != 0)) + if ((host) && (ascii_strcasecmp (host, "nickserv") != 0) && + (ascii_strcasecmp (host, "chanserv") != 0) && + (ascii_strcasecmp (host, "memoserv") != 0)) { hotlist_add (HOTLIST_PRIVATE, server->buffer); gui_draw_buffer_status (gui_current_window->buffer, 1); @@ -1789,7 +1789,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments) while (pos_port[0] == ' ') pos_port++; - if (strcasecmp (pos_file, "chat") != 0) + if (ascii_strcasecmp (pos_file, "chat") != 0) { irc_display_prefix (server->buffer, PREFIX_ERROR); gui_printf_nolog (server->buffer, diff --git a/weechat/src/irc/irc-send.c b/weechat/src/irc/irc-send.c index fa1a1bb92..854e73311 100644 --- a/weechat/src/irc/irc-send.c +++ b/weechat/src/irc/irc-send.c @@ -367,7 +367,7 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments) gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": "); gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_type); - if ((strcasecmp (pos_type, "ping") == 0) && (!pos_args)) + if ((ascii_strcasecmp (pos_type, "ping") == 0) && (!pos_args)) { gettimeofday (&tv, &tz); server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n", @@ -451,7 +451,7 @@ irc_cmd_send_dcc (t_irc_server *server, char *arguments) dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL); } - else if (strcasecmp (arguments, "close") == 0) + else if (ascii_strcasecmp (arguments, "close") == 0) { if (BUFFER_IS_PRIVATE(gui_current_window->buffer) && CHANNEL(gui_current_window->buffer)->dcc_chat) diff --git a/weechat/src/plugins/perl/wee-perl.c b/weechat/src/plugins/perl/wee-perl.c index 18dc7614f..010f72273 100644 --- a/weechat/src/plugins/perl/wee-perl.c +++ b/weechat/src/plugins/perl/wee-perl.c @@ -73,7 +73,7 @@ static XS (XS_IRC_register) for (ptr_perl_script = perl_scripts; ptr_perl_script; ptr_perl_script = ptr_perl_script->next_script) { - if (strcasecmp (ptr_perl_script->name, name) == 0) + if (ascii_strcasecmp (ptr_perl_script->name, name) == 0) { perl_script_found = ptr_perl_script; break; @@ -182,12 +182,12 @@ static XS (XS_IRC_print_with_channel) for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (!server || (strcasecmp (ptr_server->name, server)) == 0) + if (!server || (ascii_strcasecmp (ptr_server->name, server)) == 0) { for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - if (strcasecmp (ptr_channel->name, channel) == 0) + if (ascii_strcasecmp (ptr_channel->name, channel) == 0) { ptr_buffer = ptr_channel->buffer; break; @@ -260,7 +260,7 @@ static XS (XS_IRC_command) command = SvPV (ST (1), integer); for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (strcasecmp (ptr_server->name, server) == 0) + if (ascii_strcasecmp (ptr_server->name, server) == 0) break; } if (!ptr_server) @@ -383,30 +383,30 @@ static XS (XS_IRC_get_info) if (arg) { - if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) ) + if ( (ascii_strcasecmp (arg, "0") == 0) || (ascii_strcasecmp (arg, "version") == 0) ) { info = PACKAGE_STRING; } - else if ( ptr_server && ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "1") == 0) || (ascii_strcasecmp (arg, "nick") == 0) ) ) { if (ptr_server->nick) info = ptr_server->nick; } - else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) ) + else if ( (ascii_strcasecmp (arg, "2") == 0) || (ascii_strcasecmp (arg, "channel") == 0) ) { if (BUFFER_IS_CHANNEL (gui_current_window->buffer)) info = CHANNEL (gui_current_window->buffer)->name; } - else if ( ptr_server && ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "3") == 0) || (ascii_strcasecmp (arg, "server") == 0) ) ) { if (ptr_server->name) info = ptr_server->name; } - else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) ) + else if ( (ascii_strcasecmp (arg, "4") == 0) || (ascii_strcasecmp (arg, "weechatdir") == 0) ) { info = weechat_home; } - else if ( ptr_server && ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "5") == 0) || (ascii_strcasecmp (arg, "away") == 0) ) ) { XST_mIV (0, SERVER(gui_current_window->buffer)->is_away); XSRETURN (1); @@ -448,7 +448,7 @@ static XS (XS_weechat_register) for (ptr_perl_script = perl_scripts; ptr_perl_script; ptr_perl_script = ptr_perl_script->next_script) { - if (strcasecmp (ptr_perl_script->name, name) == 0) + if (ascii_strcasecmp (ptr_perl_script->name, name) == 0) { perl_script_found = ptr_perl_script; break; @@ -731,36 +731,36 @@ static XS (XS_weechat_get_info) arg = SvPV (ST (0), integer); if (arg) { - if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) ) + if ( (ascii_strcasecmp (arg, "0") == 0) || (ascii_strcasecmp (arg, "version") == 0) ) { info = PACKAGE_STRING; } - else if ( ptr_server && ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "1") == 0) || (ascii_strcasecmp (arg, "nick") == 0) ) ) { if (ptr_server->nick) info = ptr_server->nick; } - else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) ) + else if ( (ascii_strcasecmp (arg, "2") == 0) || (ascii_strcasecmp (arg, "channel") == 0) ) { if (BUFFER_IS_CHANNEL (gui_current_window->buffer)) info = CHANNEL (gui_current_window->buffer)->name; } - else if ( ptr_server && ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "3") == 0) || (ascii_strcasecmp (arg, "server") == 0) ) ) { if (ptr_server->name) info = ptr_server->name; } - else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) ) + else if ( (ascii_strcasecmp (arg, "4") == 0) || (ascii_strcasecmp (arg, "weechatdir") == 0) ) { info = weechat_home; } - else if ( ptr_server && ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) ) ) + else if ( ptr_server && ( (ascii_strcasecmp (arg, "5") == 0) || (ascii_strcasecmp (arg, "away") == 0) ) ) { XST_mIV (0, SERVER(gui_current_window->buffer)->is_away); XSRETURN (1); return; } - else if ( (strcasecmp (arg, "100") == 0) || (strcasecmp (arg, "dccs") == 0) ) + else if ( (ascii_strcasecmp (arg, "100") == 0) || (ascii_strcasecmp (arg, "dccs") == 0) ) { int nItems = 0; t_irc_dcc *p = dcc_list; diff --git a/weechat/src/plugins/plugins.c b/weechat/src/plugins/plugins.c index 089b34191..8fc51a026 100644 --- a/weechat/src/plugins/plugins.c +++ b/weechat/src/plugins/plugins.c @@ -181,7 +181,7 @@ plugin_handler_search (t_plugin_handler *plugin_handlers, char *name) ptr_plugin_handler = ptr_plugin_handler->next_handler) { /* handler found */ - if (strcasecmp (ptr_plugin_handler->name, name) == 0) + if (ascii_strcasecmp (ptr_plugin_handler->name, name) == 0) return ptr_plugin_handler; } /* handler not found */ @@ -309,7 +309,7 @@ plugin_event_msg (char *irc_command, char *server, char *arguments) for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler; ptr_plugin_handler = ptr_plugin_handler->next_handler) { - if (strcasecmp (ptr_plugin_handler->name, irc_command) == 0) + if (ascii_strcasecmp (ptr_plugin_handler->name, irc_command) == 0) { #ifdef PLUGIN_PERL if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL) @@ -367,7 +367,7 @@ plugin_exec_command (char *user_command, char *server, char *arguments) for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler; ptr_plugin_handler = ptr_plugin_handler->next_handler) { - if (strcasecmp (ptr_plugin_handler->name, user_command) == 0) + if (ascii_strcasecmp (ptr_plugin_handler->name, user_command) == 0) { #ifdef PLUGIN_PERL if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL) diff --git a/weechat/src/plugins/python/wee-python.c b/weechat/src/plugins/python/wee-python.c index d1fd2d901..c3f5860be 100644 --- a/weechat/src/plugins/python/wee-python.c +++ b/weechat/src/plugins/python/wee-python.c @@ -66,7 +66,7 @@ wee_python_register (PyObject *self, PyObject *args) for (ptr_python_script = python_scripts; ptr_python_script; ptr_python_script = ptr_python_script->next_script) { - if (strcasecmp (ptr_python_script->name, name) == 0) + if (ascii_strcasecmp (ptr_python_script->name, name) == 0) { python_script_found = ptr_python_script; break; @@ -321,7 +321,7 @@ wee_python_get_info (PyObject *self, PyObject *args) { for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (strcasecmp (ptr_server->name, server) == 0) + if (ascii_strcasecmp (ptr_server->name, server) == 0) break; } if (!ptr_server) @@ -336,34 +336,34 @@ wee_python_get_info (PyObject *self, PyObject *args) if (ptr_server && arg) { - if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) ) + if ( (ascii_strcasecmp (arg, "0") == 0) || (ascii_strcasecmp (arg, "version") == 0) ) { info = PACKAGE_STRING; } - else if ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) ) + else if ( (ascii_strcasecmp (arg, "1") == 0) || (ascii_strcasecmp (arg, "nick") == 0) ) { if (ptr_server->nick) info = ptr_server->nick; } - else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) ) + else if ( (ascii_strcasecmp (arg, "2") == 0) || (ascii_strcasecmp (arg, "channel") == 0) ) { if (BUFFER_IS_CHANNEL (gui_current_window->buffer)) info = CHANNEL (gui_current_window->buffer)->name; } - else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) ) + else if ( (ascii_strcasecmp (arg, "3") == 0) || (ascii_strcasecmp (arg, "server") == 0) ) { if (ptr_server->name) info = ptr_server->name; } - else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) ) + else if ( (ascii_strcasecmp (arg, "4") == 0) || (ascii_strcasecmp (arg, "weechatdir") == 0) ) { info = weechat_home; } - else if ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) ) + else if ( (ascii_strcasecmp (arg, "5") == 0) || (ascii_strcasecmp (arg, "away") == 0) ) { return Py_BuildValue ("i", SERVER(gui_current_window->buffer)->is_away); } - else if ( (strcasecmp (arg, "100") == 0) || (strcasecmp (arg, "dccs") == 0) ) + else if ( (ascii_strcasecmp (arg, "100") == 0) || (ascii_strcasecmp (arg, "dccs") == 0) ) { t_irc_dcc *p = dcc_list; int nbdccs = 0; diff --git a/weechat/src/plugins/ruby/wee-ruby.c b/weechat/src/plugins/ruby/wee-ruby.c index 449b9b003..edf774926 100644 --- a/weechat/src/plugins/ruby/wee-ruby.c +++ b/weechat/src/plugins/ruby/wee-ruby.c @@ -74,7 +74,7 @@ wee_ruby_register (VALUE class, VALUE name, VALUE version, VALUE shutdown_func, for (ptr_ruby_script = ruby_scripts; ptr_ruby_script; ptr_ruby_script = ptr_ruby_script->next_script) { - if (strcasecmp (ptr_ruby_script->name, c_name) == 0) + if (ascii_strcasecmp (ptr_ruby_script->name, c_name) == 0) { ruby_script_found = ptr_ruby_script; break; @@ -357,7 +357,7 @@ wee_ruby_get_info (VALUE class, VALUE arg, VALUE server_name) { for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (strcasecmp (ptr_server->name, c_server_name) == 0) + if (ascii_strcasecmp (ptr_server->name, c_server_name) == 0) break; } if (!ptr_server) @@ -372,34 +372,34 @@ wee_ruby_get_info (VALUE class, VALUE arg, VALUE server_name) if (ptr_server && c_arg) { - if ( (strcasecmp (c_arg, "0") == 0) || (strcasecmp (c_arg, "version") == 0) ) + if ( (ascii_strcasecmp (c_arg, "0") == 0) || (ascii_strcasecmp (c_arg, "version") == 0) ) { info = PACKAGE_STRING; } - else if ( (strcasecmp (c_arg, "1") == 0) || (strcasecmp (c_arg, "nick") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "1") == 0) || (ascii_strcasecmp (c_arg, "nick") == 0) ) { if (ptr_server->nick) info = ptr_server->nick; } - else if ( (strcasecmp (c_arg, "2") == 0) || (strcasecmp (c_arg, "channel") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "2") == 0) || (ascii_strcasecmp (c_arg, "channel") == 0) ) { if (BUFFER_IS_CHANNEL (gui_current_window->buffer)) info = CHANNEL (gui_current_window->buffer)->name; } - else if ( (strcasecmp (c_arg, "3") == 0) || (strcasecmp (c_arg, "server") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "3") == 0) || (ascii_strcasecmp (c_arg, "server") == 0) ) { if (ptr_server->name) info = ptr_server->name; } - else if ( (strcasecmp (c_arg, "4") == 0) || (strcasecmp (c_arg, "weechatdir") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "4") == 0) || (ascii_strcasecmp (c_arg, "weechatdir") == 0) ) { info = weechat_home; } - else if ( (strcasecmp (c_arg, "5") == 0) || (strcasecmp (c_arg, "away") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "5") == 0) || (ascii_strcasecmp (c_arg, "away") == 0) ) { return INT2FIX (SERVER(gui_current_window->buffer)->is_away); } - else if ( (strcasecmp (c_arg, "100") == 0) || (strcasecmp (c_arg, "dccs") == 0) ) + else if ( (ascii_strcasecmp (c_arg, "100") == 0) || (ascii_strcasecmp (c_arg, "dccs") == 0) ) { /* TODO: build dcc list */ }