Mercurial > hg > toybox
comparison toys/link.c @ 388:b55de19d00c3
Add link.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 20 Nov 2011 11:39:13 -0600 |
parents | |
children | ab6c0adfcc10 |
comparison
equal
deleted
inserted
replaced
387:67b0ded3c56c | 388:b55de19d00c3 |
---|---|
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 } |