From a33bbb6c241cbfacccc550489091097ccf58eb41 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 7 Feb 2013 20:05:52 +0100 Subject: [PATCH] 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 --- games/atc/update.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 -- 2.41.0