diff --git a/include/tool.h b/include/tool.h index b7e0a55..9ebb455 100644 --- a/include/tool.h +++ b/include/tool.h @@ -42,6 +42,7 @@ static inline void pause( ) { void tool_memcpy(void *dest, void *src, uint64_t n); void *tool_memset(void *ptr, uint8_t n, uint64_t size); uint64_t tool_strlen(const char *str); +void tool_strcpy(char *dest, char *src); uint64_t tool_starts_with(const char *str, const char *prefix); void tool_format(void (*putc)(char c), const char *format_string, va_list args); diff --git a/kernel/tool.c b/kernel/tool.c index 0279de5..c0933a2 100644 --- a/kernel/tool.c +++ b/kernel/tool.c @@ -32,6 +32,15 @@ uint64_t tool_strlen(const char *str) { return length; } +void tool_strcpy(char *dest, char *src) { + uint64_t i = 0; + while (src[i] != '\0') { + dest[i] = src[i]; + i++; + } + dest[i] = '\0'; +} + uint64_t tool_starts_with(const char *str, const char *prefix) { uint64_t str_len = tool_strlen(str); uint64_t prefix_len = tool_strlen(prefix);