hangman(6): Ignore case in the word list.
authorSascha Wildner <saw@online.de>
Thu, 24 Jun 2010 08:53:10 +0000 (10:53 +0200)
committerSascha Wildner <saw@online.de>
Thu, 24 Jun 2010 08:53:10 +0000 (10:53 +0200)
Reported-by: Tim Darby <t+dfbsd@timdarby.net>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1787>

games/hangman/getguess.c

index b5b60c0..c399029 100644 (file)
@@ -42,7 +42,7 @@ void
 getguess(void)
 {
        int i;
-       int ch;
+       int ch, uch;
        bool correct;
 
        leaveok(stdscr, FALSE);
@@ -70,10 +70,14 @@ getguess(void)
 
        Guessed[ch - 'a'] = TRUE;
        correct = FALSE;
+       uch = toupper(ch);
        for (i = 0; Word[i] != '\0'; i++) {
                if (Word[i] == ch) {
                        Known[i] = ch;
                        correct = TRUE;
+               } else if (Word[i] == uch) {
+                       Known[i] = uch;
+                       correct = TRUE;
                }
        }
        if (!correct)