Added verbose extension and updated manual pages. Changes approved by Klaus Klein.
This commit is contained in:
parent
bf746f0aa4
commit
1f6c14f0d6
17
bin/ln/ln.1
17
bin/ln/ln.1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: ln.1,v 1.16 2002/09/25 15:18:39 wiz Exp $
|
||||
.\" $NetBSD: ln.1,v 1.17 2002/12/26 21:37:17 jrf Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -36,7 +36,7 @@
|
||||
.\"
|
||||
.\" @(#)ln.1 8.2 (Berkeley) 12/30/93
|
||||
.\"
|
||||
.Dd October 14, 2000
|
||||
.Dd December 26, 2002
|
||||
.Dt LN 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -44,11 +44,11 @@
|
||||
.Nd make links
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl fhns
|
||||
.Op Fl fhnsv
|
||||
.Ar source_file
|
||||
.Op Ar target_file
|
||||
.Nm ""
|
||||
.Op Fl fhns
|
||||
.Op Fl fhnsv
|
||||
.Ar source_file ... target_dir
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
@ -87,6 +87,10 @@ for compatibility with other
|
||||
implementations.
|
||||
.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
|
||||
@ -146,6 +150,11 @@ The
|
||||
.Nm
|
||||
utility conforms to
|
||||
.St -p1003.2-92 .
|
||||
.Pp
|
||||
The
|
||||
.Fl v
|
||||
option is an extension to
|
||||
.St -p1003.2-92 .
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm
|
||||
|
18
bin/mv/mv.1
18
bin/mv/mv.1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: mv.1,v 1.18 2002/02/08 01:21:58 ross Exp $
|
||||
.\" $NetBSD: mv.1,v 1.19 2002/12/26 21:37:17 jrf Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1989, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -36,7 +36,7 @@
|
||||
.\"
|
||||
.\" @(#)mv.1 8.1 (Berkeley) 5/31/93
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dd December 26, 2002
|
||||
.Dt MV 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -44,10 +44,10 @@
|
||||
.Nd move files
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl fi
|
||||
.Op Fl fiv
|
||||
.Ar source target
|
||||
.Nm ""
|
||||
.Op Fl fi
|
||||
.Op Fl fiv
|
||||
.Ar source ... directory
|
||||
.Sh DESCRIPTION
|
||||
In its first form, the
|
||||
@ -83,6 +83,10 @@ to write a prompt to standard error before moving a file that would
|
||||
overwrite an existing file.
|
||||
If the response from the standard input begins with the character ``y'',
|
||||
the move is attempted.
|
||||
.It Fl v
|
||||
Cause
|
||||
.Nm
|
||||
to be verbose, showing files as they are processed.
|
||||
.El
|
||||
The last of any
|
||||
.Fl f
|
||||
@ -90,7 +94,6 @@ or
|
||||
.Fl i
|
||||
options is the one which affects
|
||||
.Nm Ns 's
|
||||
behavior.
|
||||
.Pp
|
||||
It is an error for any of the
|
||||
.Ar source
|
||||
@ -138,3 +141,8 @@ The
|
||||
utility is expected to be
|
||||
.St -p1003.2
|
||||
compatible.
|
||||
.Pp
|
||||
The
|
||||
.Fl v
|
||||
option is an extension to
|
||||
.St -p1003.2 .
|
||||
|
26
bin/mv/mv.c
26
bin/mv/mv.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mv.c,v 1.27 2001/09/16 21:53:55 wiz Exp $ */
|
||||
/* $NetBSD: mv.c,v 1.28 2002/12/26 21:37:17 jrf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: mv.c,v 1.27 2001/09/16 21:53:55 wiz Exp $");
|
||||
__RCSID("$NetBSD: mv.c,v 1.28 2002/12/26 21:37:17 jrf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -68,7 +68,7 @@ __RCSID("$NetBSD: mv.c,v 1.27 2001/09/16 21:53:55 wiz Exp $");
|
||||
|
||||
#include "pathnames.h"
|
||||
|
||||
int fflg, iflg;
|
||||
int fflg, iflg, vflg;
|
||||
int stdin_ok;
|
||||
|
||||
int copy(char *, char *);
|
||||
@ -88,7 +88,7 @@ main(int argc, char *argv[])
|
||||
setprogname(argv[0]);
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
while ((ch = getopt(argc, argv, "if")) != -1)
|
||||
while ((ch = getopt(argc, argv, "ifv")) != -1)
|
||||
switch (ch) {
|
||||
case 'i':
|
||||
fflg = 0;
|
||||
@ -98,6 +98,9 @@ main(int argc, char *argv[])
|
||||
iflg = 0;
|
||||
fflg = 1;
|
||||
break;
|
||||
case 'v':
|
||||
vflg = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
@ -210,8 +213,11 @@ do_move(char *from, char *to)
|
||||
* message to standard error, and do nothing more with the
|
||||
* current source file...
|
||||
*/
|
||||
if (!rename(from, to))
|
||||
if (!rename(from, to)) {
|
||||
if (vflg)
|
||||
printf("%s -> %s\n", from, to);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (errno != EXDEV) {
|
||||
warn("rename %s to %s", from, to);
|
||||
@ -313,6 +319,10 @@ err: if (unlink(to))
|
||||
warn("%s: remove", from);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (vflg)
|
||||
printf("%s -> %s\n", from, to);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -322,7 +332,7 @@ copy(char *from, char *to)
|
||||
int pid, status;
|
||||
|
||||
if ((pid = vfork()) == 0) {
|
||||
execl(_PATH_CP, "mv", "-PRp", from, to, NULL);
|
||||
execl(_PATH_CP, "mv", vflg ? "-PRpv" : "-PRp", from, to, NULL);
|
||||
warn("%s", _PATH_CP);
|
||||
_exit(1);
|
||||
}
|
||||
@ -363,8 +373,8 @@ copy(char *from, char *to)
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "usage: %s [-fi] source target\n"
|
||||
" %s [-fi] source ... directory\n", getprogname(),
|
||||
(void)fprintf(stderr, "usage: %s [-fiv] source target\n"
|
||||
" %s [-fiv] source ... directory\n", getprogname(),
|
||||
getprogname());
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
|
Loading…
Reference in New Issue
Block a user