feat: add rm command
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* main.cpp
|
||||||
|
* rm - command to remove files
|
||||||
|
* Copyright (c) 2026 Daniel Hammer
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <montauk/syscall.h>
|
||||||
|
#include <montauk/string.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <montauk/syscall.h>
|
#include <montauk/syscall.h>
|
||||||
#include <montauk/string.h>
|
#include <montauk/string.h>
|
||||||
#include <montauk/heap.h>
|
#include <montauk/heap.h>
|
||||||
#include <montauk/config.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Mar 24, 2026 - update to use getuser() syscall
|
Mar 24, 2026 - update to use getuser() syscall
|
||||||
|
|||||||
Reference in New Issue
Block a user