diff options
Diffstat (limited to 'src/ctype')
| -rw-r--r-- | src/ctype/iscntrl.c | 2 | ||||
| -rw-r--r-- | src/ctype/isgraph.c | 2 | ||||
| -rw-r--r-- | src/ctype/isprint.c | 2 | ||||
| -rw-r--r-- | src/ctype/tolower.c | 5 | ||||
| -rw-r--r-- | src/ctype/toupper.c | 6 |
5 files changed, 14 insertions, 3 deletions
diff --git a/src/ctype/iscntrl.c b/src/ctype/iscntrl.c index eead7f5f..9d295d26 100644 --- a/src/ctype/iscntrl.c +++ b/src/ctype/iscntrl.c @@ -14,7 +14,7 @@ int iscntrl(int c) RETURN(0, ARGUMENT(c) is not a control character); */ - return map[c] == 0 || (map[c] == CT_SPACE && c != ' '); + return map[c] & CT_CNTRL; } /*** diff --git a/src/ctype/isgraph.c b/src/ctype/isgraph.c index 206a09b7..ecf88a34 100644 --- a/src/ctype/isgraph.c +++ b/src/ctype/isgraph.c @@ -14,7 +14,7 @@ int isgraph(int c) RETURN(0, ARGUMENT(c) is not a graphic character); */ - return map[c] & ~CT_SPACE; + return map[c] & CT_GRAPH; } /*** diff --git a/src/ctype/isprint.c b/src/ctype/isprint.c index 19847118..41ed6bcf 100644 --- a/src/ctype/isprint.c +++ b/src/ctype/isprint.c @@ -14,7 +14,7 @@ int isprint(int c) RETURN(0, ARGUMENT(c) is not a printable character); */ - return map[c] & ~CT_SPACE || c == ' '; + return map[c] & CT_PRINT; } /*** diff --git a/src/ctype/tolower.c b/src/ctype/tolower.c index 793de6bb..7ef5057a 100644 --- a/src/ctype/tolower.c +++ b/src/ctype/tolower.c @@ -1,4 +1,5 @@ #include <ctype.h> +#include "stdio.h" #include "limits.h" #include "nonstd/assert.h" #include "nonstd/ctype.h" @@ -14,6 +15,10 @@ int tolower(int c) RETURN_FAILURE(ARGUMENT(c), ARGUMENT(c) was not an uppercase letter or it has no equivalent lowercase letter); */ + if (c == EOF) { + return EOF; + } + return map[c]; } diff --git a/src/ctype/toupper.c b/src/ctype/toupper.c index 35b7c9e2..4844a702 100644 --- a/src/ctype/toupper.c +++ b/src/ctype/toupper.c @@ -1,4 +1,5 @@ #include <ctype.h> +#include "stdio.h" #include "limits.h" #include "nonstd/assert.h" #include "nonstd/ctype.h" @@ -13,6 +14,11 @@ int toupper(int c) RETURN_SUCCESS(ARGUMENT(c) converted to uppercase); RETURN_FAILURE(ARGUMENT(c), ARGUMENT(c) was not a lowercase letter or it has no equivalent upercase letter); */ + + if (c == EOF) { + return EOF; + } + return map[c]; } |
