link.c (503B)
- // Collection of Unix tools, comparable to coreutils
- // SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- // SPDX-License-Identifier: MPL-2.0
- #define _POSIX_C_SOURCE 200809L
- #include <stdio.h> /* perror, fprintf */
- #include <unistd.h> /* link */
- int
- main(int argc, char *argv[])
- {
- if(argc != 3)
- {
- fprintf(stderr, "usage: link <reference> <destination>\n");
- return 1;
- }
- if(link(argv[1], argv[2]) != 0)
- {
- perror("link");
- return 1;
- }
- return 0;
- }