[dev] [PATCH][sbase] add link utility

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Thu, 16 Oct 2014 22:12:12 +0200

---
Heyho,
there you go, pretty simple, but it was still missing so here you go.
--Markus
 Makefile |  1 +
 README   |  1 +
 TODO     |  1 -
 link.1   | 14 ++++++++++++++
 link.c   | 16 ++++++++++++++++
 5 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 link.1
 create mode 100644 link.c
diff --git a/Makefile b/Makefile
index 6f995be..5ff507e 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -57,6 +57,7 @@ SRC = \
 	head.c     \
 	hostname.c \
 	kill.c     \
+	link.c     \
 	ln.c       \
 	ls.c       \
 	md5sum.c   \
diff --git a/README b/README
index f3736b0..242b99b 100644
--- a/README
+++ b/README
_AT_@ -34,6 +34,7 @@ grep
 head
 hostname
 kill
+link
 ln
 ls
 md5sum
diff --git a/TODO b/TODO
index bff60a9..0db8e6c 100644
--- a/TODO
+++ b/TODO
_AT_@ -12,7 +12,6 @@ file
 find
 getconf
 join
-link
 logger
 logname
 od
diff --git a/link.1 b/link.1
new file mode 100644
index 0000000..3d77f26
--- /dev/null
+++ b/link.1
_AT_@ -0,0 +1,14 @@
+.TH LN 1 sbase\-VERSION
+.SH NAME
+link \- create a hard link by calling the link function
+.SH SYNOPSIS
+.B link
+.I TARGET
+.I LINKNAME
+.P
+.SH DESCRIPTION
+.B link
+creates a hard link to a given file, with the given name.
+.SH SEE ALSO
+.IR ln (1),
+.IR link (2)
diff --git a/link.c b/link.c
new file mode 100644
index 0000000..e4f8eca
--- /dev/null
+++ b/link.c
_AT_@ -0,0 +1,16 @@
+/* See LICENSE file for copyright and license details. */
+#include <errno.h>
+#include <unistd.h>
+#include "util.h"
+
+int
+main(int argc, char *argv[])
+{
+	if(argc != 3)
+		eprintf("usage: %s TARGET LINKNAME\n", argv[0]);
+
+	if (0 != link(argv[1], argv[2]))
+		eprintf("link:");
+
+	return 0;
+}
-- 
1.8.5.5
Received on Thu Oct 16 2014 - 22:12:12 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 16 2014 - 22:24:08 CEST