annotate toys/link.c @ 562:4d802d438983

Match uint64_t with PRIu64 to avoid warnings on 64 bit builds.
author Rob Landley <rob@landley.net>
date Sat, 14 Apr 2012 21:27:00 -0500
parents ab6c0adfcc10
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
388
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 /* vi: set sw=4 ts=4:
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * link.c - hardlink a file
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 *
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 * Copyright 2011 Rob Landley <rob@landley.net>
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 *
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 * See http://opengroup.org/onlinepubs/9699919799/utilities/link.html
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 USE_LINK(NEWTOY(link, "<2>2", TOYFLAG_USR|TOYFLAG_BIN))
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
10
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 config LINK
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 bool "link"
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 default y
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 help
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 usage: link FILE NEWLINK
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
16
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 Create hardlink to a file.
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 */
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
19
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 #include "toys.h"
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
21
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 void link_main(void)
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 {
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 if (link(toys.optargs[0], toys.optargs[1]))
465
ab6c0adfcc10 Error message fix from Pere (gotrunks at gmail).
Rob Landley <rob@landley.net>
parents: 388
diff changeset
25 perror_exit("couldn't link '%s' to '%s'", toys.optargs[1],
ab6c0adfcc10 Error message fix from Pere (gotrunks at gmail).
Rob Landley <rob@landley.net>
parents: 388
diff changeset
26 toys.optargs[0]);
388
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 }