mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +00:00
Get nyancat nyanning in Serenity.
I found a cute program that renders an animated nyancat in the terminal. This patch adds enough hackery to get it working correctly. :^)
This commit is contained in:
parent
3944c00f23
commit
dddd0e7b03
15 changed files with 341 additions and 64 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -60,6 +61,15 @@ char* strdup(const char* str)
|
|||
return new_str;
|
||||
}
|
||||
|
||||
char* strndup(const char* str, size_t maxlen)
|
||||
{
|
||||
size_t len = min(strlen(str), maxlen);
|
||||
char* new_str = (char*)malloc(len + 1);
|
||||
memcpy(new_str, str, len);
|
||||
new_str[len] = 0;
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int strcmp(const char* s1, const char* s2)
|
||||
{
|
||||
while (*s1 == *s2++)
|
||||
|
|
|
@ -15,6 +15,8 @@ void* memchr(const void*, int c, size_t);
|
|||
void bzero(void*, size_t);
|
||||
void bcopy(const void*, void*, size_t);
|
||||
void* memset(void*, int, size_t);
|
||||
char* strdup(const char*);
|
||||
char* strndup(const char*, size_t);
|
||||
char* strcpy(char* dest, const char* src);
|
||||
char* strncpy(char* dest, const char* src, size_t);
|
||||
char* strchr(const char*, int c);
|
||||
|
|
|
@ -29,6 +29,7 @@ typedef uint32_t nlink_t;
|
|||
typedef uint32_t blksize_t;
|
||||
typedef uint32_t blkcnt_t;
|
||||
typedef uint32_t time_t;
|
||||
typedef uint32_t useconds_t;
|
||||
typedef uint32_t suseconds_t;
|
||||
typedef uint32_t clock_t;
|
||||
typedef uint32_t socklen_t;
|
||||
|
|
|
@ -30,5 +30,7 @@ time_t time(time_t*);
|
|||
char* ctime(const time_t*);
|
||||
void tzset();
|
||||
|
||||
#define difftime(t1,t0) (double)(t1 - t0)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -201,6 +201,11 @@ int sleep(unsigned seconds)
|
|||
return syscall(SC_sleep, seconds);
|
||||
}
|
||||
|
||||
int usleep(useconds_t usec)
|
||||
{
|
||||
return syscall(SC_usleep, usec);
|
||||
}
|
||||
|
||||
int gethostname(char* buffer, size_t size)
|
||||
{
|
||||
int rc = syscall(SC_gethostname, buffer, size);
|
||||
|
|
|
@ -42,6 +42,7 @@ int fstat(int fd, struct stat* statbuf);
|
|||
int lstat(const char* path, struct stat* statbuf);
|
||||
int stat(const char* path, struct stat* statbuf);
|
||||
int sleep(unsigned seconds);
|
||||
int usleep(useconds_t);
|
||||
int gethostname(char*, size_t);
|
||||
ssize_t readlink(const char* path, char* buffer, size_t);
|
||||
char* ttyname(int fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue