sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 314885836c091dfeb68232f50c8be862a381f265
parent 1dd2913e332955b91700298cefbcf0fb53dc3598
Author: Markus Teich <markus.teich@stusta.mhn.de>
Date:   Fri Oct 17 15:32:08 +0100

Add link(1)

Diffstat:
Makefile | 1+
README | 1+
TODO | 1-
link.1 | 14++++++++++++++
link.c | 17+++++++++++++++++
5 files changed, 33 insertions(+), 1 deletion(-)
diff --git 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 @@ -34,6 +34,7 @@ grep head hostname kill +link ln ls md5sum diff --git a/TODO b/TODO @@ -12,7 +12,6 @@ file find getconf join -link logger logname od diff --git a/link.1 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 @@ -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; +}