2014-06-23 00:14:25 +05:30
|
|
|
/* vi: set sw=4 ts=4: */
|
2017-10-05 18:49:25 +05:30
|
|
|
/*
|
|
|
|
* unlink for busybox
|
2014-06-23 00:14:25 +05:30
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Isaac Dunham <ibid.ag@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under GPLv2, see LICENSE in this source tree
|
|
|
|
*/
|
|
|
|
//config:config UNLINK
|
2018-12-28 07:50:17 +05:30
|
|
|
//config: bool "unlink (3.2 kb)"
|
2014-06-23 00:14:25 +05:30
|
|
|
//config: default y
|
|
|
|
//config: help
|
2017-07-21 13:20:55 +05:30
|
|
|
//config: unlink deletes a file by calling unlink()
|
2014-06-23 00:14:25 +05:30
|
|
|
|
2017-08-03 06:59:32 +05:30
|
|
|
//applet:IF_UNLINK(APPLET_NOFORK(unlink, unlink, BB_DIR_USR_BIN, BB_SUID_DROP, unlink))
|
2014-06-23 00:14:25 +05:30
|
|
|
|
2016-11-23 19:16:56 +05:30
|
|
|
//kbuild:lib-$(CONFIG_UNLINK) += unlink.o
|
|
|
|
|
2014-06-23 00:14:25 +05:30
|
|
|
//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)
|
|
|
|
{
|
2017-08-09 01:25:02 +05:30
|
|
|
getopt32(argv, "^" "" "\0" "=1");
|
2014-06-23 00:14:25 +05:30
|
|
|
argv += optind;
|
|
|
|
xunlink(argv[0]);
|
|
|
|
return 0;
|
|
|
|
}
|