Add link(1)
This commit is contained in:
parent
1dd2913e33
commit
314885836c
1
Makefile
1
Makefile
@ -57,6 +57,7 @@ SRC = \
|
|||||||
head.c \
|
head.c \
|
||||||
hostname.c \
|
hostname.c \
|
||||||
kill.c \
|
kill.c \
|
||||||
|
link.c \
|
||||||
ln.c \
|
ln.c \
|
||||||
ls.c \
|
ls.c \
|
||||||
md5sum.c \
|
md5sum.c \
|
||||||
|
1
README
1
README
@ -34,6 +34,7 @@ grep
|
|||||||
head
|
head
|
||||||
hostname
|
hostname
|
||||||
kill
|
kill
|
||||||
|
link
|
||||||
ln
|
ln
|
||||||
ls
|
ls
|
||||||
md5sum
|
md5sum
|
||||||
|
1
TODO
1
TODO
@ -12,7 +12,6 @@ file
|
|||||||
find
|
find
|
||||||
getconf
|
getconf
|
||||||
join
|
join
|
||||||
link
|
|
||||||
logger
|
logger
|
||||||
logname
|
logname
|
||||||
od
|
od
|
||||||
|
14
link.1
Normal file
14
link.1
Normal file
@ -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)
|
17
link.c
Normal file
17
link.c
Normal file
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user