changeset 390:95a4da23c53a

Implement unlink.
author Rob Landley <rob@landley.net>
date Sun, 20 Nov 2011 21:36:37 -0600
parents 5e9c1d73c84a
children 56d07d82e691
files toys/unlink.c
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toys/unlink.c	Sun Nov 20 21:36:37 2011 -0600
@@ -0,0 +1,26 @@
+/* vi: set sw=4 ts=4:
+ *
+ * unlink.c - delete one file
+ *
+ * Copyright 2011 Rob Landley <rob@landley.net>
+ *
+ * See http://opengroup.org/onlinepubs/9699919799/utilities/unlink.html
+
+USE_UNLINK(NEWTOY(unlink, "<1>1", TOYFLAG_USR|TOYFLAG_BIN))
+
+config UNLINK
+	bool "unlink"
+	default y
+	help
+	  usage: unlink FILE
+
+	  Deletes one file.
+*/
+
+#include "toys.h"
+
+void unlink_main(void)
+{
+	if (unlink(*toys.optargs))
+		perror_exit("Couldn't unlink `%s'", *toys.optargs);
+}