summaryrefslogtreecommitdiff
path: root/lib/libc/gen/tolower_.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>2001-06-27 07:17:10 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>2001-06-27 07:17:10 +0000
commitf8eaad01d46087ea25b14a0b5ef52c92806347bc (patch)
treeb33441a1cb79c5c2efe25123062059d5a8bdbbe4 /lib/libc/gen/tolower_.c
parentb398d24628b1f394267fd1f18e7fa0d865ed4abb (diff)
Make the functions (which get linked in if <ctype.h> isn't #included) behave
correctly. Also, don't let them segfault.
Diffstat (limited to 'lib/libc/gen/tolower_.c')
-rw-r--r--lib/libc/gen/tolower_.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/gen/tolower_.c b/lib/libc/gen/tolower_.c
index eab1ed3fd73..b145fc46e41 100644
--- a/lib/libc/gen/tolower_.c
+++ b/lib/libc/gen/tolower_.c
@@ -4,16 +4,12 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: tolower_.c,v 1.2 1996/08/19 08:26:52 tholo Exp $";
+static char rcsid[] = "$OpenBSD: tolower_.c,v 1.3 2001/06/27 07:17:08 pjanzen Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <ctype.h>
-#if EOF != -1
-#error "EOF != -1"
-#endif
-
const short _C_tolower_[1 + 256] = {
EOF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
@@ -57,5 +53,7 @@ int
tolower(c)
int c;
{
+ if (c != (unsigned char) c)
+ return(c);
return((_tolower_tab_ + 1)[c]);
}