mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-18 18:51:43 +00:00
Updated userspace
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../mem/liballoc_1_1.h"
|
||||
|
||||
@@ -37,10 +38,20 @@ int atoi(const char *nptr)
|
||||
return OutBuffer;
|
||||
}
|
||||
|
||||
char **environ = NULL;
|
||||
|
||||
char *getenv(const char *name)
|
||||
{
|
||||
static char *env = "PATH=/bin";
|
||||
return env;
|
||||
char **env = environ;
|
||||
if (env == NULL)
|
||||
return NULL;
|
||||
size_t len = strlen(name);
|
||||
while (*env != NULL)
|
||||
{
|
||||
if ((strncmp(*env, name, len) == 0) && ((*env)[len] == '='))
|
||||
return &(*env)[len + 1];
|
||||
++env;
|
||||
}
|
||||
}
|
||||
|
||||
void *malloc(size_t Size) { return PREFIX(malloc)(Size); }
|
||||
|
14
libc/src/string.c
Normal file
14
libc/src/string.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <string.h>
|
||||
|
||||
int strncmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
for (size_t i = 0; i < n; i++)
|
||||
{
|
||||
char c1 = s1[i], c2 = s2[i];
|
||||
if (c1 != c2)
|
||||
return c1 - c2;
|
||||
if (!c1)
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user