annotate toys/unlink.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 95a4da23c53a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
390
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 /* vi: set sw=4 ts=4:
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * unlink.c - delete one file
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 *
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 * Copyright 2011 Rob Landley <rob@landley.net>
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 *
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 * See http://opengroup.org/onlinepubs/9699919799/utilities/unlink.html
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 USE_UNLINK(NEWTOY(unlink, "<1>1", TOYFLAG_USR|TOYFLAG_BIN))
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
10
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 config UNLINK
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 bool "unlink"
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 default y
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 help
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 usage: unlink FILE
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
16
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 Deletes one file.
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 */
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
19
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 #include "toys.h"
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
21
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 void unlink_main(void)
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 {
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 if (unlink(*toys.optargs))
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 perror_exit("Couldn't unlink `%s'", *toys.optargs);
95a4da23c53a Implement unlink.
Rob Landley <rob@landley.net>
parents:
diff changeset
26 }