commit 00e7f4e38a5aae64e6328670809e63a26c42b6ba
parent 70670897984f17e01943ead87c49af272f4c2033
Author: FRIGN <dev@frign.de>
Date: Mon, 26 Jan 2015 14:54:22 +0100
Add mandoc-manpage for ln(1)
and mark it as finished in the README.
Diffstat:
M | README | | | 2 | +- |
M | ln.1 | | | 98 | ++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------- |
M | ln.c | | | 4 | ++-- |
3 files changed, 65 insertions(+), 39 deletions(-)
diff --git a/README b/README
@@ -37,7 +37,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
= hostname non-posix none
=* kill yes none
=* link yes none
-= ln yes none
+=* ln yes none
=* logger yes none
= logname yes none
= ls no -C, -R, -q, -u
diff --git a/ln.1 b/ln.1
@@ -1,36 +1,62 @@
-.TH LN 1 sbase\-VERSION
-.SH NAME
-ln \- make links between files
-.SH SYNOPSIS
-.B ln
-.RB [ \-LPfs ]
-.I file
-.RI [ name ]
-.P
-.B ln
-.RB [ \-LPfs ]
-.RI [ file ...]
-.RI [ directory ]
-.SH DESCRIPTION
-.B ln
-creates a hard link to a given file, with the given name. If no name is given
-it is linked into the current directory. If multiple files are listed they will
-be linked into the given directory.
-.SH OPTIONS
-.TP
-.B \-L
-create links to the files referenced by symbolic link source files (default
-behavior).
-.TP
-.B \-P
-create links to symbolic link source files themselves.
-.TP
-.B \-f
-remove existing destinations.
-.TP
-.B \-s
-create a symlink.
-.SH SEE ALSO
-.IR cp (1),
-.IR link (2),
-.IR symlink (2)
+.Dd January 26, 2015
+.Dt LN 1 sbase\-VERSION
+.Sh NAME
+.Nm ln
+.Nd link files
+.Sh SYNOPSIS
+.Nm ln
+.Op Fl f
+.Op Fl L | Fl P | Fl s
+.Ar target
+.Op Ar name
+.Nm ln
+.Op Fl f
+.Op Fl L | Fl P | Fl s
+.Ar target ...
+.Ar directory
+.Sh DESCRIPTION
+.Nm
+creates a hard link
+.Ar name
+to
+.Ar target .
+If no
+.Ar name
+is given, a hard link to
+.Ar target
+is created in the current directory.
+If more than one
+.Ar target
+is given,
+.Nm
+hardlinks them in the existing
+.Ar directory .
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl f
+If
+.Ar name
+exists, remove it to allow the link.
+.It Fl L | Fl P
+If
+.Ar target
+is a symbolic link, create a hard link to the (referenced file) | (symbolic link itself).
+The former is the default.
+.It Fl s
+Create symbolic links instead of hard links.
+Disables
+.Fl L
+and
+.Fl P ,
+because their purpose does not apply to symbolic links.
+.El
+.Sh SEE ALSO
+.Xr cp 1 ,
+.Xr link 2 ,
+.Xr symlink 2
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
diff --git a/ln.c b/ln.c
@@ -13,8 +13,8 @@
static void
usage(void)
{
- eprintf("usage: %1$s [-LPfs] target [linkname]\n"
- " %1$s [-LPfs] target... directory\n", argv0);
+ eprintf("usage: %1$s [-f] [-L | -P | -s] target [name]\n"
+ " %1$s [-f] [-L | -P | -s] target ... directory\n", argv0);
}
int