logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

unlink.c (471B)


  1. // SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  2. // SPDX-License-Identifier: 0BSD
  3. #include <errno.h> // errno
  4. #include <stdio.h> // fprintf
  5. #include <string.h> // strerror
  6. #include <unistd.h> // unlink
  7. int
  8. main(int argc, char *argv[])
  9. {
  10. for(int i = 1; i < argc; i++)
  11. {
  12. if(unlink(argv[i]) != 0)
  13. {
  14. fprintf(stderr, "unlink: error: Failed unlinking '%s': %s\n", argv[i], strerror(errno));
  15. return 1;
  16. }
  17. }
  18. return 0;
  19. }