3
0

unlink.c 820 B

123456789101112131415161718192021222324252627282930313233
  1. /* 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. */
  8. //config:config UNLINK
  9. //config: bool "unlink"
  10. //config: default y
  11. //config: help
  12. //config: unlink deletes a file by calling unlink()
  13. //applet:IF_UNLINK(APPLET(unlink, BB_DIR_USR_BIN, BB_SUID_DROP))
  14. //kbuild:lib-$(CONFIG_UNLINK) += unlink.o
  15. //usage:#define unlink_trivial_usage
  16. //usage: "FILE"
  17. //usage:#define unlink_full_usage "\n\n"
  18. //usage: "Delete FILE by calling unlink()"
  19. #include "libbb.h"
  20. int unlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  21. int unlink_main(int argc UNUSED_PARAM, char **argv)
  22. {
  23. opt_complementary = "=1"; /* must have exactly 1 param */
  24. getopt32(argv, "");
  25. argv += optind;
  26. xunlink(argv[0]);
  27. return 0;
  28. }