logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git

unlink.c (494B)


  1. // SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  2. // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
  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: Cannot unlink ā€˜%sā€™: %s\n", argv[i], strerror(errno));
  15. return 1;
  16. }
  17. }
  18. return 0;
  19. }