diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/commands.c | 4 | ||||
-rw-r--r-- | src/core/misc.c | 18 | ||||
-rw-r--r-- | src/core/misc.h | 3 |
3 files changed, 23 insertions, 2 deletions
diff --git a/src/core/commands.c b/src/core/commands.c index f1c86fc7..1b811bc4 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -325,7 +325,7 @@ void command_runsub(const char *cmd, const char *data, subcmd = g_strconcat("command ", newcmd, NULL); - g_strdown(subcmd); + ascii_strdown(subcmd); if (!signal_emit(subcmd, 3, args, server, item)) { defcmd = g_strdup_printf("default command %s", cmd); if (!signal_emit(defcmd, 3, data, server, item)) { @@ -891,7 +891,7 @@ static void parse_command(const char *command, int expand_aliases, } cmd = g_strconcat("command ", newcmd, NULL); - g_strdown(cmd); + ascii_strdown(cmd); oldcmd = current_command; current_command = cmd+8; diff --git a/src/core/misc.c b/src/core/misc.c index e0df07e5..986e10f3 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -943,3 +943,21 @@ int parse_size(const char *size, int *bytes) return TRUE; } + +char *ascii_strup(char *str) +{ + char *s; + + for (s = str; *s; s++) + *s = g_ascii_toupper (*s); + return str; +} + +char *ascii_strdown(char *str) +{ + char *s; + + for (s = str; *s; s++) + *s = g_ascii_tolower (*s); + return str; +} diff --git a/src/core/misc.h b/src/core/misc.h index 72a48e5f..2cb8e66a 100644 --- a/src/core/misc.h +++ b/src/core/misc.h @@ -92,6 +92,9 @@ char *stristr(const char *data, const char *key); char *strstr_full(const char *data, const char *key); char *stristr_full(const char *data, const char *key); +char *ascii_strup(char *str); +char *ascii_strdown(char *str); + /* Escape all '"', "'" and '\' chars with '\' */ char *escape_string(const char *str); |