ladybird/Userland/rm.cpp
Andreas Kling bda0c935c2 Add unlink() syscall and /bin/rm.
This patch adds most of the plumbing for working file deletion in Ext2FS.
Directory entries are removed and inode link counts updated.
We don't yet update the inode or block bitmaps, I will do that separately.
2019-01-22 07:03:44 +01:00

19 lines
300 B
C++

#include <stdio.h>
#include <errno.h>
#include <unistd.h>
int main(int argc, char** argv)
{
if (argc != 2) {
fprintf(stderr, "usage: rm <path>\n");
return 1;
}
int rc = unlink(argv[1]);
if (rc < 0) {
perror("unlink");
return 1;
}
return 0;
}