Files
freywaros/src/user/app/rm/rm.c
T
freywar b78ef69da8 Fix minor issues in user apps
Uninitialized variables, reading past array end, etc.
2026-08-25 21:41:25 +03:00

21 lines
478 B
C

#include "src/lib/syscall.h"
#include "src/lib/util.h"
#include "src/user/syscall.h"
exit_code_t main(uint64_t argc, const char **argv) {
if (argc < 2) {
ERR_S("rm: requires one or more arguments\n");
return EXIT_CODE_GENERAL_FAILURE;
}
uint64_t code = EXIT_CODE_OK;
for (uint64_t i = 1; i < argc; i++) {
if (remove(argv[i]) == (uint64_t)-1) {
ERR_S("rm: could not remove file\n");
code = EXIT_CODE_GENERAL_FAILURE;
}
}
return code;
}