mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
LibC: Add some things needed to build GNU bc.
This patch adds vprintf(), sig_atomic_t, random() and strdup(). bc doesn't build yet, but it will.
This commit is contained in:
parent
feed67ede2
commit
76f53b40f4
6 changed files with 30 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
extern "C" {
|
||||
|
@ -51,6 +52,14 @@ size_t strlen(const char* str)
|
|||
return len;
|
||||
}
|
||||
|
||||
char* strdup(const char* str)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
char* new_str = (char*)malloc(len);
|
||||
strcpy(new_str, str);
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int strcmp(const char* s1, const char* s2)
|
||||
{
|
||||
while (*s1 == *s2++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue