Squash commits for public release
This commit is contained in:
5
userland/utilities/rm/.info.mk
Normal file
5
userland/utilities/rm/.info.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
APPS += RM
|
||||
|
||||
RM_NAME = rm
|
||||
RM_LIBS = c
|
||||
RM_INSTALL_PATH = bin/
|
||||
8
userland/utilities/rm/BUILD.gn
Normal file
8
userland/utilities/rm/BUILD.gn
Normal file
@@ -0,0 +1,8 @@
|
||||
import("//build/userland/TEMPLATE.gni")
|
||||
|
||||
xOS_executable("rm") {
|
||||
install_path = "bin/"
|
||||
sources = [ "main.c" ]
|
||||
configs = [ "//build/userland:userland_flags" ]
|
||||
deplibs = [ "libc" ]
|
||||
}
|
||||
18
userland/utilities/rm/main.c
Normal file
18
userland/utilities/rm/main.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
write(1, "Usage: rm files...\n", 21);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (unlink(argv[i]) < 0) {
|
||||
write(1, "rm: failed to delete\n", 21);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user