Fix bug that made YES() case-sensitive.
Also fix a related memory leak.
This commit is contained in:
parent
550734fd3f
commit
65e2e472dd
1 changed files with 6 additions and 4 deletions
10
misc.c
10
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue