summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-10-08 17:42:45 +0000
committerache <ache@FreeBSD.org>1994-10-08 17:42:45 +0000
commit078887695c043f85d060c48408aa999537bf3147 (patch)
treec23ec9c141e634f927d4421c51a840aaa9b4dbae /lib/libc
parentdcc191d798389eff4df036b2c92800febf349a22 (diff)
downloadFreeBSD-src-078887695c043f85d060c48408aa999537bf3147.zip
FreeBSD-src-078887695c043f85d060c48408aa999537bf3147.tar.gz
Sync with ctype.h (EOF, sign extention fixes)
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/nomacros.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/libc/locale/nomacros.c b/lib/libc/locale/nomacros.c
index 32ee404..90d1fe9 100644
--- a/lib/libc/locale/nomacros.c
+++ b/lib/libc/locale/nomacros.c
@@ -1,3 +1,4 @@
+#include <stdio.h>
#include <ctype.h>
#include <rune.h>
@@ -10,6 +11,10 @@ __istype(c, f)
_BSD_RUNE_T_ c;
unsigned long f;
{
+ if (c == EOF)
+ return 0;
+ if (c < 0)
+ c = (unsigned char) c;
return ((((c & _CRMASK) ? ___runetype(c)
: _CurrentRuneLocale->runetype[c]) & f) ? 1 : 0);
}
@@ -19,6 +24,10 @@ __isctype(_BSD_RUNE_T_ c, unsigned long f)
_BSD_RUNE_T_ c;
unsigned long f;
{
+ if (c == EOF)
+ return 0;
+ if (c < 0)
+ c = (unsigned char) c;
return ((((c & _CRMASK) ? 0
: _DefaultRuneLocale.runetype[c]) & f) ? 1 : 0);
}
@@ -27,6 +36,10 @@ _BSD_RUNE_T_
toupper(c)
_BSD_RUNE_T_ c;
{
+ if (c == EOF)
+ return EOF;
+ if (c < 0)
+ c = (unsigned char) c;
return ((c & _CRMASK) ?
___toupper(c) : _CurrentRuneLocale->mapupper[c]);
}
@@ -35,6 +48,10 @@ _BSD_RUNE_T_
tolower(c)
_BSD_RUNE_T_ c;
{
+ if (c == EOF)
+ return EOF;
+ if (c < 0)
+ c = (unsigned char) c;
return ((c & _CRMASK) ?
___tolower(c) : _CurrentRuneLocale->maplower[c]);
}
OpenPOWER on IntegriCloud