diff --git a/programs/src/rm/main.cpp b/programs/src/rm/main.cpp new file mode 100644 index 0000000..b361ab7 --- /dev/null +++ b/programs/src/rm/main.cpp @@ -0,0 +1,31 @@ +/* + * main.cpp + * rm - command to remove files + * Copyright (c) 2026 Daniel Hammer +*/ + +#include +#include + +extern "C" void _start() { + char args[256]; + montauk::getargs((char *)&args, 256); + + if (*args) { + const char* arg = montauk::skip_spaces((const char *)&args); + + if (*arg != '\0') { + int fd = montauk::open(arg); + if (fd < 0) { + montauk::print("file not found\n"); + } else { + montauk::close(fd); + montauk::fdelete(arg); + } + } + } else { + montauk::print("usage: rm [file]\n"); + } + + montauk::exit(0); +} \ No newline at end of file diff --git a/programs/src/whoami/main.cpp b/programs/src/whoami/main.cpp index 4fe98c0..cc2cf36 100644 --- a/programs/src/whoami/main.cpp +++ b/programs/src/whoami/main.cpp @@ -7,7 +7,6 @@ #include #include #include -#include /* Mar 24, 2026 - update to use getuser() syscall