diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-11 00:44:04 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-11 00:44:04 +0100 |
commit | 7cc4caee4f879efd12a079a206b00a689a254609 (patch) | |
tree | 03d885b2114990a6bfee17761a240b27a652029c | |
parent | 3b2f172d481f33ca9c50e2b76909a4ecf46d5f03 (diff) | |
download | serenity-7cc4caee4f879efd12a079a206b00a689a254609.zip |
Add ispunct() to LibC + some minor cleanups.
-rwxr-xr-x | Kernel/sync.sh | 1 | ||||
-rw-r--r-- | LibC/Makefile | 1 | ||||
-rw-r--r-- | LibC/ctype.cpp | 8 | ||||
-rw-r--r-- | LibC/ctype.h | 6 | ||||
-rw-r--r-- | LibC/setjmp.cpp | 2 |
5 files changed, 16 insertions, 2 deletions
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 <ctype.h> +#include <string.h> + +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 <sys/cdefs.h> +__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); } |