summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/drivers/net/mlx_ipoib/mt23108.c9
-rw-r--r--src/drivers/net/mlx_ipoib/mt25218.c9
-rw-r--r--src/include/ctype.h7
3 files changed, 9 insertions, 16 deletions
diff --git a/src/drivers/net/mlx_ipoib/mt23108.c b/src/drivers/net/mlx_ipoib/mt23108.c
index 492bc901..e1f61db6 100644
--- a/src/drivers/net/mlx_ipoib/mt23108.c
+++ b/src/drivers/net/mlx_ipoib/mt23108.c
@@ -10,6 +10,8 @@ Skeleton NIC driver for Etherboot
* your option) any later version.
*/
+/* to get toupper() */
+#include <ctype.h>
/* to get some global routines like printf */
#include "etherboot.h"
/* to get the interface to the body of the program */
@@ -31,12 +33,7 @@ int prompt_key(int secs, unsigned char *ch_p)
for (tmo = currticks() + secs * TICKS_PER_SEC; currticks() < tmo;) {
if (iskey()) {
- ch = getchar();
- /* toupper does not work ... */
- if (ch == 'v')
- ch = 'V';
- if (ch == 'i')
- ch = 'I';
+ ch = toupper(getchar());
if ((ch=='V') || (ch=='I')) {
*ch_p = ch;
return 1;
diff --git a/src/drivers/net/mlx_ipoib/mt25218.c b/src/drivers/net/mlx_ipoib/mt25218.c
index a603cdeb..8a252eae 100644
--- a/src/drivers/net/mlx_ipoib/mt25218.c
+++ b/src/drivers/net/mlx_ipoib/mt25218.c
@@ -10,6 +10,8 @@ Skeleton NIC driver for Etherboot
* your option) any later version.
*/
+/* to get toupper() */
+#include <ctype.h>
/* to get some global routines like printf */
#include "etherboot.h"
/* to get the interface to the body of the program */
@@ -31,12 +33,7 @@ int prompt_key(int secs, unsigned char *ch_p)
for (tmo = currticks() + secs * TICKS_PER_SEC; currticks() < tmo;) {
if (iskey()) {
- ch = getchar();
- /* toupper does not work ... */
- if (ch == 'v')
- ch = 'V';
- if (ch == 'i')
- ch = 'I';
+ ch = toupper(getchar());
if ((ch=='V') || (ch=='I')) {
*ch_p = ch;
return 1;
diff --git a/src/include/ctype.h b/src/include/ctype.h
index a79395d2..7740443d 100644
--- a/src/include/ctype.h
+++ b/src/include/ctype.h
@@ -6,10 +6,9 @@
* Character types
*/
-#define isdigit(c) ((c & 0x04) != 0)
-#define islower(c) ((c & 0x02) != 0)
-//#define isspace(c) ((c & 0x20) != 0)
-#define isupper(c) ((c & 0x01) != 0)
+#define isdigit(c) ((c) >= '0' && (c) <= '9')
+#define islower(c) ((c) >= 'a' && (c) <= 'z')
+#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
static inline unsigned char tolower(unsigned char c)
{