[hackers] [sbase] Add link(1) || Markus Teich

From: <git_AT_suckless.org>
Date: Fri, 17 Oct 2014 16:36:21 +0200

commit 314885836c091dfeb68232f50c8be862a381f265
Author: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Fri Oct 17 15:32:08 2014 +0100

    Add link(1)

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..bcab529
--- /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..1b59ad8
--- /dev/null
+++ b/link.c
_AT_@ -0,0 +1,17 @@
+/* See LICENSE file for copyright and license details. */
+#include <errno.h>
+#include <unistd.h>
+
+#include "util.h"
+
+int
+main(int argc, char *argv[])
+{
+ argv0 = argv[0];
+
+ if(argc != 3)
+ eprintf("usage: %s target linkname\n", argv0);
+ if (0 != link(argv[1], argv[2]))
+ eprintf("link:");
+ return 0;
+}
Received on Fri Oct 17 2014 - 16:36:21 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 17 2014 - 16:48:20 CEST