annotate toys/posix/unlink.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 /* unlink.c - delete one file
390
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * Copyright 2011 Rob Landley <rob@landley.net>
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 *
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 * See http://opengroup.org/onlinepubs/9699919799/utilities/unlink.html
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 USE_UNLINK(NEWTOY(unlink, "<1>1", TOYFLAG_USR|TOYFLAG_BIN))
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 config UNLINK
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 "unlink"
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: unlink FILE
390
95a4da23c53a Implement unlink.
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 Deletes one file.
390
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 */
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
17
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 #include "toys.h"
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
19
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 void unlink_main(void)
95a4da23c53a Implement unlink.
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 (unlink(*toys.optargs))
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 unlink `%s'", *toys.optargs);
390
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 }