summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorIsaac Dunham2014-06-22 20:44:25 +0200
committerDenys Vlasenko2014-06-22 20:44:25 +0200
commitea23c25e96f74d2e248f790b20e15f18ff91beba (patch)
tree2ec91373efa6fbfbeaa8a8b1d0642767a778a9a5 /coreutils
parent3ed81cf0529145d04299c4cd48b1aaab2fe36193 (diff)
downloadbusybox-ea23c25e96f74d2e248f790b20e15f18ff91beba.zip
busybox-ea23c25e96f74d2e248f790b20e15f18ff91beba.tar.gz
unlink: new applet
function old new delta unlink_main - 45 +45 packed_usage 29667 29686 +19 Signed-off-by: Isaac Dunham <ibid.ag@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/unlink.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/coreutils/unlink.c b/coreutils/unlink.c
new file mode 100644
index 0000000..3b7d0fb
--- /dev/null
+++ b/coreutils/unlink.c
@@ -0,0 +1,34 @@
+/* vi: set sw=4 ts=4: */
+/* unlink for busybox
+ *
+ * Copyright (C) 2014 Isaac Dunham <ibid.ag@gmail.com>
+ *
+ * Licensed under GPLv2, see LICENSE in this source tree
+ */
+
+//config:config UNLINK
+//config: bool "unlink"
+//config: default y
+//config: help
+//config: unlink deletes a file by calling unlink()
+
+//kbuild:lib-$(CONFIG_UNLINK) += unlink.o
+
+//applet:IF_UNLINK(APPLET(unlink, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//usage:#define unlink_trivial_usage
+//usage: "FILE"
+//usage:#define unlink_full_usage "\n\n"
+//usage: "Delete FILE by calling unlink()"
+
+#include "libbb.h"
+
+int unlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int unlink_main(int argc UNUSED_PARAM, char **argv)
+{
+ opt_complementary = "=1"; /* must have exactly 1 param */
+ getopt32(argv, "");
+ argv += optind;
+ xunlink(argv[0]);
+ return 0;
+}