ref: d7511b681b42b4367cb5818a5d949010c5910980
parent: 08c48f8d3da19e4f1a70e8da9bdef305002666de
author: Quentin Rameau <quinq@fifth.space>
date: Fri Dec 28 18:52:44 EST 2018
[libc] Add toascii We already have isascii() and to* is reserved namespace so let's add it.
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -41,5 +41,6 @@
#define isxdigit(c) ((__ctype+1)[c] & (_D|_X))
#define isascii(c) ((unsigned)(c)<=0x7f)
+#define toascii(c) ((unsigned)(c)&0x7f)
#endif
--- a/src/libc/ctype/Makefile
+++ b/src/libc/ctype/Makefile
@@ -17,6 +17,7 @@
isspace.o\
isupper.o\
isxdigit.o\
+ toascii.o\
tolower.o\
toupper.o\
--- /dev/null
+++ b/src/libc/ctype/toascii.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef toascii
+
+int
+toascii(int c)
+{
+ return c & 0x7f;
+}