diff --git a/src/rm.c b/src/rm.c new file mode 100644 index 0000000..ea42ce9 --- /dev/null +++ b/src/rm.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +int main(const int argc, char **argv) { + if (argc == 1) { + fprintf(stderr, "rm: missing operand\n"); + return 1; + } + + for (int i = 1; i < argc; i++) { + if (unlink(argv[i]) < 0) { + fprintf(stderr, "rm: %s %s\n", argv[i], strerror(errno)); + return 1; + } + } + + return 0; +}