Add generic strlen implementation

This commit is contained in:
Lucas Schumacher 2025-05-02 20:47:16 -04:00
parent d47709b03c
commit 9163857e83
2 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,15 @@ void *memset(void* s, int c, unsigned long n) {
}
#endif // !MEMSET_DEFINED
#ifndef _STRLEN_DEFINED
#define _STRLEN_DEFINED
int strlen(char* s) {
int len = 0;
for(;s[len] != 0; ++len);
return len;
}
#endif // !_STRLEN_DEFINED
#ifndef _START_DEFINED
#define _START_DEFINED
// Generic _start implementation. Can't access any args

1
sys.h
View File

@ -143,5 +143,6 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *t, stru
uint32_t fork();
void *memset(void* s, int c, unsigned long n);
int strlen(char* s);
#endif // !MINIMALSYS_H