update main #1

Merged
Sinipelto merged 240 commits from Bananymous/banan-os:main into main 2023-11-20 13:20:51 +02:00
3 changed files with 40 additions and 0 deletions
Showing only changes of commit 126edea119 - Show all commits

View File

@ -16,6 +16,7 @@ set(USERSPACE_PROJECTS
mkdir
mmap-shared-test
poweroff
rm
Shell
snake
stat

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.26)
project(rm CXX)
set(SOURCES
main.cpp
)
add_executable(rm ${SOURCES})
target_compile_options(rm PUBLIC -O2 -g)
target_link_libraries(rm PUBLIC libc)
add_custom_target(rm-install
COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/rm ${BANAN_BIN}/
DEPENDS rm
USES_TERMINAL
)

22
userspace/rm/main.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include <unistd.h>
int main(int argc, char** argv)
{
if (argc <= 1)
{
fprintf(stderr, "Missing operand\n");
return 1;
}
int ret = 0;
for (int i = 1; i < argc; i++)
{
if (unlink(argv[i]) == -1)
{
perror(argv[i]);
ret = 1;
}
}
return ret;
}