Fixed bug 3883 - SDL_assert / SDL_PromptAssertion in TTY mode does not accept options ("abriA")
authorSam Lantinga <slouken@libsdl.org>
Sun, 15 Oct 2017 21:21:19 -0700
changeset 116262eaf345a2a30
parent 11625 6a676d8b788f
child 11627 97bc026b46de
Fixed bug 3883 - SDL_assert / SDL_PromptAssertion in TTY mode does not accept options ("abriA")

shoerbaffen

fgets can read a newline and SDL_strcmp will never return zero.
src/SDL_assert.c
     1.1 --- a/src/SDL_assert.c	Sun Oct 15 21:07:01 2017 -0700
     1.2 +++ b/src/SDL_assert.c	Sun Oct 15 21:21:19 2017 -0700
     1.3 @@ -278,19 +278,19 @@
     1.4                  break;
     1.5              }
     1.6  
     1.7 -            if (SDL_strcmp(buf, "a") == 0) {
     1.8 +            if (SDL_strncmp(buf, "a", 1) == 0) {
     1.9                  state = SDL_ASSERTION_ABORT;
    1.10                  break;
    1.11 -            } else if (SDL_strcmp(buf, "b") == 0) {
    1.12 +            } else if (SDL_strncmp(buf, "b", 1) == 0) {
    1.13                  state = SDL_ASSERTION_BREAK;
    1.14                  break;
    1.15 -            } else if (SDL_strcmp(buf, "r") == 0) {
    1.16 +            } else if (SDL_strncmp(buf, "r", 1) == 0) {
    1.17                  state = SDL_ASSERTION_RETRY;
    1.18                  break;
    1.19 -            } else if (SDL_strcmp(buf, "i") == 0) {
    1.20 +            } else if (SDL_strncmp(buf, "i", 1) == 0) {
    1.21                  state = SDL_ASSERTION_IGNORE;
    1.22                  break;
    1.23 -            } else if (SDL_strcmp(buf, "A") == 0) {
    1.24 +            } else if (SDL_strncmp(buf, "A", 1) == 0) {
    1.25                  state = SDL_ASSERTION_ALWAYS_IGNORE;
    1.26                  break;
    1.27              }