forked from Bananymous/banan-os
LibC: Implement remove for stdio
This commit is contained in:
parent
e227a87140
commit
694cda6e40
|
@ -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*);
|
||||
|
|
Loading…
Reference in New Issue