From: Jason S. Ninneman Date: Sun, 18 Jun 2017 21:14:13 +0000 (-0700) Subject: Fix bug that made YES() case-sensitive. X-Git-Tag: 1.1~243 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=65e2e472dd604e93d566206c2267738767ca726b;p=open-adventure.git Fix bug that made YES() case-sensitive. Also fix a related memory leak. --- diff --git a/misc.c b/misc.c index aa4286b..fc7ac5f 100644 --- a/misc.c +++ b/misc.c @@ -271,10 +271,12 @@ bool YES(vocab_t question, vocab_t yes_response, vocab_t no_response) for (int i = 0; i < strlen(firstword); ++i) firstword[i] = tolower(firstword[i]); - int yes = strncmp("yes", reply, sizeof("yes") - 1); - int y = strncmp("y", reply, sizeof("y") - 1); - int no = strncmp("no", reply, sizeof("no") - 1); - int n = strncmp("n", reply, sizeof("n") - 1); + int yes = strncmp("yes", firstword, sizeof("yes") - 1); + int y = strncmp("y", firstword, sizeof("y") - 1); + int no = strncmp("no", firstword, sizeof("no") - 1); + int n = strncmp("n", firstword, sizeof("n") - 1); + + free(firstword); if (yes == 0 || y == 0) { RSPEAK(yes_response);