From 314885836c091dfeb68232f50c8be862a381f265 Mon Sep 17 00:00:00 2001 From: Markus Teich Date: Fri, 17 Oct 2014 15:32:08 +0100 Subject: [PATCH] Add link(1) --- Makefile | 1 + README | 1 + TODO | 1 - link.1 | 14 ++++++++++++++ link.c | 17 +++++++++++++++++ 5 files changed, 33 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -0,0 +1,17 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include + +#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; +}