From: Sascha Wildner Date: Thu, 7 Feb 2013 19:05:52 +0000 (+0100) Subject: games/atc: Fix a logic bug. X-Git-Tag: v3.4.0rc~378 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/a33bbb6c241cbfacccc550489091097ccf58eb41 games/atc: Fix a logic bug. The original logic should have really been: if ((l < 'a' && l > 'z') || (l < 'A' && l > 'Z')) But using islower()/isupper() is simpler and more readable. Taken-from: NetBSD --- diff --git a/games/atc/update.c b/games/atc/update.c index 6ef0425fdc..6ecf5723e2 100644 --- a/games/atc/update.c +++ b/games/atc/update.c @@ -31,7 +31,6 @@ * * @(#)update.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/atc/update.c,v 1.6 1999/11/30 03:48:21 billf Exp $ - * $DragonFly: src/games/atc/update.c,v 1.3 2006/08/08 15:03:02 pavalos Exp $ */ /* @@ -253,12 +252,12 @@ name(const PLANE *p) char number(char l) { - if (l < 'a' && l > 'z' && l < 'A' && l > 'Z') - return (-1); - else if (l >= 'a' && l <= 'z') + if (islower(l)) return (l - 'a'); - else + else if (isupper(l)) return (l - 'A'); + else + return (-1); } static int