LibC: Implement remove for stdio

This commit is contained in:
Bananymous 2023-12-14 10:58:50 +02:00
parent af8db9f350
commit ba85f07b64
1 changed files with 9 additions and 2 deletions

View File

@ -422,8 +422,15 @@ int puts(const char* string)
return 0;
}
// TODO
int remove(const char*);
int remove(const char* path)
{
struct stat st;
if (stat(path, &st) == -1)
return -1;
if (S_ISDIR(st.st_mode))
return rmdir(path);
return unlink(path);
}
// TODO
int rename(const char*, const char*);