unlink.c 805 B

1234567891011121314151617181920212223242526272829303132
  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 (3.5 kb)"
  10. //config: default y
  11. //config: help
  12. //config: unlink deletes a file by calling unlink()
  13. //applet:IF_UNLINK(APPLET_NOFORK(unlink, unlink, BB_DIR_USR_BIN, BB_SUID_DROP, unlink))
  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. getopt32(argv, "^" "" "\0" "=1");
  24. argv += optind;
  25. xunlink(argv[0]);
  26. return 0;
  27. }