Start working on a VFS implementation #22

Closed
apio wants to merge 44 commits from oop-vfs into main
2 changed files with 13 additions and 0 deletions
Showing only changes of commit 19b72fe779 - Show all commits

View File

@ -22,6 +22,8 @@ extern "C"
// FIXME: Replace this invented function with strlcpy().
void nullcpy(char* dest, const char* src, usize len);
usize strlcpy(char* dest, const char* src, usize len);
[[deprecated]] char* strcpy(char* dst, const char* src);
[[deprecated]] char* strcat(char* dst, const char* src);

View File

@ -125,4 +125,15 @@ extern "C"
if (*str) return const_cast<char*>(str);
return NULL;
}
usize strlcpy(char* dest, const char* src, usize len)
{
usize src_len = strlen(src);
usize copy_len = src_len;
if (len == 0) return src_len;
if (src_len >= (len - 1)) copy_len = len - 1;
memcpy(dest, src, copy_len);
dest[copy_len] = 0;
return src_len;
}
}