blob: 3322d5b47a6165030cff962b62aec914587f5c80 [file] [log] [blame]
Isaac Dunhamea23c252014-06-22 20:44:25 +02001/* vi: set sw=4 ts=4: */
2/* unlink for busybox
3 *
4 * Copyright (C) 2014 Isaac Dunham <ibid.ag@gmail.com>
5 *
6 * Licensed under GPLv2, see LICENSE in this source tree
7 */
Isaac Dunhamea23c252014-06-22 20:44:25 +02008//config:config UNLINK
Denys Vlasenko4eed2c62017-07-18 22:01:24 +02009//config: bool "unlink (3.5 kb)"
Isaac Dunhamea23c252014-06-22 20:44:25 +020010//config: default y
11//config: help
Denys Vlasenko72089cf2017-07-21 09:50:55 +020012//config: unlink deletes a file by calling unlink()
Isaac Dunhamea23c252014-06-22 20:44:25 +020013
Isaac Dunhamea23c252014-06-22 20:44:25 +020014//applet:IF_UNLINK(APPLET(unlink, BB_DIR_USR_BIN, BB_SUID_DROP))
15
Denys Vlasenkoaf3f4202016-11-23 14:46:56 +010016//kbuild:lib-$(CONFIG_UNLINK) += unlink.o
17
Isaac Dunhamea23c252014-06-22 20:44:25 +020018//usage:#define unlink_trivial_usage
19//usage: "FILE"
20//usage:#define unlink_full_usage "\n\n"
21//usage: "Delete FILE by calling unlink()"
22
23#include "libbb.h"
24
25int unlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
26int unlink_main(int argc UNUSED_PARAM, char **argv)
27{
28 opt_complementary = "=1"; /* must have exactly 1 param */
29 getopt32(argv, "");
30 argv += optind;
31 xunlink(argv[0]);
32 return 0;
33}