From owner-svn-src-head@FreeBSD.ORG Fri Sep 4 07:42:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B9A01065679; Fri, 4 Sep 2009 07:42:14 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 319B98FC17; Fri, 4 Sep 2009 07:42:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n847gDeq058269; Fri, 4 Sep 2009 07:42:13 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n847gD62058267; Fri, 4 Sep 2009 07:42:13 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <200909040742.n847gD62058267@svn.freebsd.org> From: "Andrey A. Chernov" Date: Fri, 4 Sep 2009 07:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196818 - head/contrib/ee X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2009 07:42:14 -0000 Author: ache Date: Fri Sep 4 07:42:13 2009 New Revision: 196818 URL: http://svn.freebsd.org/changeset/base/196818 Log: 1) Remove single occurance of HAS_CTYPE ifdef, ctype functions used here for a long time and needs their header in anycase. 2) Add (unsigned char) casts to more ctype macros. 3) Simplify menu input handling using ctype instead of range unguarded hardcoded tricks. Modified: head/contrib/ee/ee.c Modified: head/contrib/ee/ee.c ============================================================================== --- head/contrib/ee/ee.c Fri Sep 4 07:33:17 2009 (r196817) +++ head/contrib/ee/ee.c Fri Sep 4 07:42:13 2009 (r196818) @@ -72,10 +72,7 @@ char *version = "@(#) ee, version " EE_ #include #endif -#ifdef HAS_CTYPE #include -#endif - #include #include #include @@ -1973,7 +1970,7 @@ int sensitive; } else { - if (toupper(*strng1) != toupper(*strng2)) + if (toupper((unsigned char)*strng1) != toupper((unsigned char)*strng2)) equal = FALSE; } strng1++; @@ -2445,7 +2442,7 @@ int noverify; if ((text_changes) && (!noverify)) { ans = get_string(changes_made_prompt, TRUE); - if (toupper(*ans) == toupper(*yes_char)) + if (toupper((unsigned char)*ans) == toupper((unsigned char)*yes_char)) text_changes = FALSE; else return(0); @@ -2522,7 +2519,7 @@ int warn_if_exists; if ((temp_fp = fopen(file_name, "r"))) { tmp_point = get_string(file_exists_prompt, TRUE); - if (toupper(*tmp_point) == toupper(*yes_char)) + if (toupper((unsigned char)*tmp_point) == toupper((unsigned char)*yes_char)) write_flag = TRUE; else write_flag = FALSE; @@ -3437,14 +3434,13 @@ struct menu_entries menu_list[]; if (input == -1) exit(0); - if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) || - ((input >= '0') && (input <= '9'))) + if (isascii(input) && isalnum(input)) { - if ((tolower(input) >= 'a') && (tolower(input) <= 'z')) + if (isalpha(input)) { temp = 1 + tolower(input) - 'a'; } - else if ((input >= '0') && (input <= '9')) + else if (isdigit(input)) { temp = (2 + 'z' - 'a') + (input - '0'); }