summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/include/ctype.h9
-rw-r--r--lib/libc/src/stdio/fopen.c2
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/libc/include/ctype.h b/lib/libc/include/ctype.h
index 0ff9a43..2a827e3 100644
--- a/lib/libc/include/ctype.h
+++ b/lib/libc/include/ctype.h
@@ -36,6 +36,12 @@
__BEGIN_DECLS
__always_inline static inline int
+__isascii(int c)
+{
+ return c >= 0 && c <= 127;
+}
+
+__always_inline static inline int
__tolower(int c)
{
return c | 0x20;
@@ -92,4 +98,7 @@ __END_DECLS
/* Is a space? */
#define isspace(C) __isspace((C))
+/* Is ascii? */
+#define isascii(C) __isascii((C))
+
#endif /* _CTYPE_H */
diff --git a/lib/libc/src/stdio/fopen.c b/lib/libc/src/stdio/fopen.c
index c15dace..efeb577 100644
--- a/lib/libc/src/stdio/fopen.c
+++ b/lib/libc/src/stdio/fopen.c
@@ -51,6 +51,8 @@ fopen(const char *__restrict path, const char *__restrict mode)
seal |= (O_WRONLY | O_CREAT);
} else if (strcmp(mode, "r+") == 0) {
seal |= O_RDWR;
+ } else if (strcmp(mode, "rb") == 0) {
+ seal |= O_RDONLY;
} else {
return NULL;
}