From: Axel Wagner Date: Sat, 4 Nov 2017 15:52:33 +0000 (+0100) Subject: compare nicknames ignoring case (#34) X-Git-Tag: rgb2rv17~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1a14849a9400797666ebe0dc5b7137d515fc99f0;p=c128-kasse compare nicknames ignoring case (#34) Fixes #21 #22 --- diff --git a/src/credit_manager.c b/src/credit_manager.c index 37dd0b6..8530346 100644 --- a/src/credit_manager.c +++ b/src/credit_manager.c @@ -38,7 +38,7 @@ static void credit_print_screen(void) { i < ((current_credits_page + 1) * CREDITS_PER_PAGE); i++) { if (filter == NULL || - strncmp(credits.credits[i].nickname, filter, filter_len) == 0) { + strncasecmp(credits.credits[i].nickname, filter, filter_len) == 0) { if (format_euro(buffer, sizeof(buffer), credits.credits[i].credit) != buffer) { cprintf("Error: Could not format credit %d\r\n", @@ -56,7 +56,8 @@ static void credit_print_screen(void) { static int8_t find_credit_idx(char *name) { int8_t i; for (i = 0; i < credits.num_items; ++i) { - if (strncmp(name, credits.credits[i].nickname, NICKNAME_MAX_LEN + 1) == 0) { + if (strncasecmp(name, credits.credits[i].nickname, NICKNAME_MAX_LEN + 1) == + 0) { return i; } } diff --git a/src/general.c b/src/general.c index a036603..537c833 100644 --- a/src/general.c +++ b/src/general.c @@ -153,8 +153,8 @@ uint8_t cget_nickname(char *nickname, uint8_t length) { matches = 0; uniquematch = NULL; for (i = 0; i < credits.num_items; i++) { - if (strncmp(nickname, credits.credits[i].nickname, strlen(nickname)) != - 0) { + if (strncasecmp(nickname, credits.credits[i].nickname, + strlen(nickname)) != 0) { continue; } matches++; @@ -179,7 +179,7 @@ uint8_t cget_nickname(char *nickname, uint8_t length) { cprintf("\r\nCompletion:\r\n"); matches = 0; for (i = 0; i < credits.num_items; i++) { - if (strncmp(nickname, credits.credits[i].nickname, len) != 0) { + if (strncasecmp(nickname, credits.credits[i].nickname, len) != 0) { continue; } if (++matches == 5) {