master xplshn/aruu / cmd / posix / link.c
 1/* See LICENSE file for copyright and license details. */
 2
 3
 4#include <unistd.h>
 5
 6#include "util.h"
 7
 8static void
 9usage(void)
10{
11	eprintf("usage: %s target name\n", argv0);
12}
13
14// ?man link: create a link to a file
15// ?man arguments: target name
16// ?man create a hard link to an existing file
17int
18main(int argc, char *argv[])
19{
20	ARGBEGIN {
21	default:
22		usage();
23	} ARGEND
24
25	if (argc != 2)
26		usage();
27
28	if (link(argv[0], argv[1]) < 0)
29		eprintf("link:");
30
31	return 0;
32}