1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

Add ispunct() to LibC + some minor cleanups.

This commit is contained in:
Andreas Kling 2018-11-11 00:44:04 +01:00
parent 3b2f172d48
commit 7cc4caee4f
5 changed files with 16 additions and 2 deletions

View file

@ -8,7 +8,6 @@ cp -v ../Userland/sh mnt/bin/sh
cp -v ../Userland/id mnt/bin/id cp -v ../Userland/id mnt/bin/id
cp -v ../Userland/ps mnt/bin/ps cp -v ../Userland/ps mnt/bin/ps
cp -v ../Userland/ls mnt/bin/ls cp -v ../Userland/ls mnt/bin/ls
cp -v ../Userland/pwd mnt/bin/pwd
cp -v ../Userland/sleep mnt/bin/sleep cp -v ../Userland/sleep mnt/bin/sleep
cp -v ../Userland/date mnt/bin/date cp -v ../Userland/date mnt/bin/date
cp -v ../Userland/true mnt/bin/true cp -v ../Userland/true mnt/bin/true

View file

@ -25,6 +25,7 @@ LIBC_OBJS = \
setjmp.o \ setjmp.o \
stat.o \ stat.o \
mntent.o \ mntent.o \
ctype.o \
entry.o entry.o
OBJS = $(AK_OBJS) $(LIBC_OBJS) OBJS = $(AK_OBJS) $(LIBC_OBJS)

8
LibC/ctype.cpp Normal file
View file

@ -0,0 +1,8 @@
#include <ctype.h>
#include <string.h>
int ispunct(int c)
{
const char* punctuation_characters = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
return !!strchr(punctuation_characters, c);
}

View file

@ -2,6 +2,8 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__BEGIN_DECLS
ALWAYS_INLINE int isascii(int ch) ALWAYS_INLINE int isascii(int ch)
{ {
return (ch & ~0x7f) == 0; return (ch & ~0x7f) == 0;
@ -40,3 +42,7 @@ ALWAYS_INLINE int isdigit(int c)
{ {
return c >= '0' && c <= '9'; return c >= '0' && c <= '9';
} }
int ispunct(int c);
__END_DECLS

View file

@ -7,7 +7,7 @@ int setjmp(jmp_buf)
assert(false); assert(false);
} }
void longjmp(jmp_buf, int val) void longjmp(jmp_buf, int)
{ {
assert(false); assert(false);
} }