annotate toys/posix/link.c @ 1775:57f2a26fa92c draft toast

To ensure that toybox can be installed alongside busybox without confusing update-alternatives, the paths of the links installed by toybox should match those installed by busybox. This is accomplished by changing the flags of a few tools within toybox.
author Paul Barker <paul@paulbarker.me.uk>
date Sat, 04 Apr 2015 11:58:06 -0500
parents 786841fdb1e0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
1 /* link.c - hardlink a file
388
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * Copyright 2011 Rob Landley <rob@landley.net>
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 *
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 * See http://opengroup.org/onlinepubs/9699919799/utilities/link.html
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 USE_LINK(NEWTOY(link, "<2>2", TOYFLAG_USR|TOYFLAG_BIN))
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 config LINK
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
10 bool "link"
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
11 default y
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
12 help
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
13 usage: link FILE NEWLINK
388
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
14
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
15 Create hardlink to a file.
388
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 */
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
17
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 #include "toys.h"
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
19
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 void link_main(void)
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 {
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
22 if (link(toys.optargs[0], toys.optargs[1]))
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
23 perror_exit("couldn't link '%s' to '%s'", toys.optargs[1],
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
24 toys.optargs[0]);
388
b55de19d00c3 Add link.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 }