diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ln/ln.1 | 12 | ||||
-rw-r--r-- | bin/ln/ln.c | 14 |
2 files changed, 21 insertions, 5 deletions
diff --git a/bin/ln/ln.1 b/bin/ln/ln.1 index 93fa3df..ea9458f 100644 --- a/bin/ln/ln.1 +++ b/bin/ln/ln.1 @@ -43,11 +43,11 @@ .Nd make links .Sh SYNOPSIS .Nm ln -.Op Fl fs +.Op Fl fsv .Ar source_file .Op target_file .Nm ln -.Op Fl fs +.Op Fl fsv .Ar source_file ... .Op target_dir .Sh DESCRIPTION @@ -72,6 +72,10 @@ The options are as follows: Unlink any already existing file, permitting the link to occur. .It Fl s Create a symbolic link. +.It Fl v +Cause +.Nm +to be verbose, showing files as they are processed. .El .Pp By default, @@ -125,6 +129,10 @@ The links made will have the same name as the files being linked to. .Xr stat 2 , .Xr symlink 2 , .Xr symlink 7 +.Sh COMPATIBILITY +The +.Fl v +option is non-standard and its use in scripts is not recommended. .Sh HISTORY An .Nm diff --git a/bin/ln/ln.c b/bin/ln/ln.c index 9ccf805..48dbeae 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -57,8 +57,10 @@ static const char rcsid[] = int fflag; /* Unlink existing files. */ int sflag; /* Symbolic, not hard, link. */ +int vflag; /* Verbose output. */ /* System link call. */ int (*linkf) __P((const char *, const char *)); +char linkch; int linkit __P((char *, char *, int)); void usage __P((void)); @@ -73,7 +75,7 @@ main(argc, argv) int ch, exitval; char *sourcedir; - while ((ch = getopt(argc, argv, "fs")) != -1) + while ((ch = getopt(argc, argv, "fsv")) != -1) switch (ch) { case 'f': fflag = 1; @@ -81,6 +83,9 @@ main(argc, argv) case 's': sflag = 1; break; + case 'v': + vflag = 1; + break; case '?': default: usage(); @@ -90,6 +95,7 @@ main(argc, argv) argc -= optind; linkf = sflag ? symlink : link; + linkch = sflag ? '-' : '='; switch(argc) { case 0: @@ -153,6 +159,8 @@ linkit(target, source, isdir) warn("%s", source); return (1); } + if (vflag) + (void)printf("%s %c> %s\n", source, linkch, target); return (0); } @@ -160,7 +168,7 @@ void usage() { (void)fprintf(stderr, "%s\n%s\n", - "usage: ln [-fs] file1 file2", - " ln [-fs] file ... directory"); + "usage: ln [-fsv] file1 file2", + " ln [-fsv] file ... directory"); exit(1); } |