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