logo

utils-std

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

link.c (503B)


  1. // utils-std: Collection of commonly available Unix tools
  2. // SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. // SPDX-License-Identifier: 0BSD
  4. #define _POSIX_C_SOURCE 200809L
  5. #include <stdio.h> /* perror, fputs */
  6. #include <unistd.h> /* link */
  7. int
  8. main(int argc, char *argv[])
  9. {
  10. if(argc != 3)
  11. {
  12. fputs("usage: link <reference> <destination>\n", stderr);
  13. return 1;
  14. }
  15. if(link(argv[1], argv[2]) != 0)
  16. {
  17. perror("link: error");
  18. return 1;
  19. }
  20. return 0;
  21. }