link.c (524B)
- // Collection of Unix tools, comparable to coreutils
- // SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
- #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;
- }