From 7cc4caee4f879efd12a079a206b00a689a254609 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 11 Nov 2018 00:44:04 +0100 Subject: Add ispunct() to LibC + some minor cleanups. --- Kernel/sync.sh | 1 - LibC/Makefile | 1 + LibC/ctype.cpp | 8 ++++++++ LibC/ctype.h | 6 ++++++ LibC/setjmp.cpp | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 LibC/ctype.cpp diff --git a/Kernel/sync.sh b/Kernel/sync.sh index c89133219f..c02ce4cbeb 100755 --- a/Kernel/sync.sh +++ b/Kernel/sync.sh @@ -8,7 +8,6 @@ cp -v ../Userland/sh mnt/bin/sh cp -v ../Userland/id mnt/bin/id cp -v ../Userland/ps mnt/bin/ps cp -v ../Userland/ls mnt/bin/ls -cp -v ../Userland/pwd mnt/bin/pwd cp -v ../Userland/sleep mnt/bin/sleep cp -v ../Userland/date mnt/bin/date cp -v ../Userland/true mnt/bin/true diff --git a/LibC/Makefile b/LibC/Makefile index fa584a4c6f..920b48395c 100644 --- a/LibC/Makefile +++ b/LibC/Makefile @@ -25,6 +25,7 @@ LIBC_OBJS = \ setjmp.o \ stat.o \ mntent.o \ + ctype.o \ entry.o OBJS = $(AK_OBJS) $(LIBC_OBJS) diff --git a/LibC/ctype.cpp b/LibC/ctype.cpp new file mode 100644 index 0000000000..6f20aa64e4 --- /dev/null +++ b/LibC/ctype.cpp @@ -0,0 +1,8 @@ +#include +#include + +int ispunct(int c) +{ + const char* punctuation_characters = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; + return !!strchr(punctuation_characters, c); +} diff --git a/LibC/ctype.h b/LibC/ctype.h index 0d067f33b8..9faba5db64 100644 --- a/LibC/ctype.h +++ b/LibC/ctype.h @@ -2,6 +2,8 @@ #include +__BEGIN_DECLS + ALWAYS_INLINE int isascii(int ch) { return (ch & ~0x7f) == 0; @@ -40,3 +42,7 @@ ALWAYS_INLINE int isdigit(int c) { return c >= '0' && c <= '9'; } + +int ispunct(int c); + +__END_DECLS diff --git a/LibC/setjmp.cpp b/LibC/setjmp.cpp index b7378d1f4a..536e543a6e 100644 --- a/LibC/setjmp.cpp +++ b/LibC/setjmp.cpp @@ -7,7 +7,7 @@ int setjmp(jmp_buf) assert(false); } -void longjmp(jmp_buf, int val) +void longjmp(jmp_buf, int) { assert(false); } -- cgit v1.2.3