388
|
1 /* vi: set sw=4 ts=4:
|
|
2 *
|
|
3 * link.c - hardlink a file
|
|
4 *
|
|
5 * Copyright 2011 Rob Landley <rob@landley.net>
|
|
6 *
|
|
7 * See http://opengroup.org/onlinepubs/9699919799/utilities/link.html
|
|
8
|
|
9 USE_LINK(NEWTOY(link, "<2>2", TOYFLAG_USR|TOYFLAG_BIN))
|
|
10
|
|
11 config LINK
|
|
12 bool "link"
|
|
13 default y
|
|
14 help
|
|
15 usage: link FILE NEWLINK
|
|
16
|
|
17 Create hardlink to a file.
|
|
18 */
|
|
19
|
|
20 #include "toys.h"
|
|
21
|
|
22 void link_main(void)
|
|
23 {
|
|
24 if (link(toys.optargs[0], toys.optargs[1]))
|
|
25 perror_exit("couldn't link '%s' to '%s'", toys.optargs[0],
|
|
26 toys.optargs[1]);
|
|
27 }
|