summaryrefslogtreecommitdiffstats
path: root/contrib/ee
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2009-09-04 07:42:13 +0000
committerache <ache@FreeBSD.org>2009-09-04 07:42:13 +0000
commitfe4cbf528e20e682402cc9085425289a0062ea3d (patch)
tree5cf0cda67d1f12aa7097093c76815ee7bd910115 /contrib/ee
parent48d3390a19c49a8258256d213ae334ac9bf5c935 (diff)
downloadFreeBSD-src-fe4cbf528e20e682402cc9085425289a0062ea3d.zip
FreeBSD-src-fe4cbf528e20e682402cc9085425289a0062ea3d.tar.gz
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.
Diffstat (limited to 'contrib/ee')
-rwxr-xr-xcontrib/ee/ee.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/contrib/ee/ee.c b/contrib/ee/ee.c
index 4c95ac9..a603756 100755
--- a/contrib/ee/ee.c
+++ b/contrib/ee/ee.c
@@ -72,10 +72,7 @@ char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.102 $";
#include <curses.h>
#endif
-#ifdef HAS_CTYPE
#include <ctype.h>
-#endif
-
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
@@ -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');
}
OpenPOWER on IntegriCloud