summaryrefslogtreecommitdiffstats
path: root/bin/mv
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1996-02-19 00:44:19 +0000
committerwosch <wosch@FreeBSD.org>1996-02-19 00:44:19 +0000
commitbaaea7f3b7d27651092bf272882cd88a4d54027e (patch)
tree9b8f8df0eb9caf897a1cbf95bc707616786a4937 /bin/mv
parent961eb1cd883594725b9482b6df04576a582d42c5 (diff)
downloadFreeBSD-src-baaea7f3b7d27651092bf272882cd88a4d54027e.zip
FreeBSD-src-baaea7f3b7d27651092bf272882cd88a4d54027e.tar.gz
delete my last commit
Submitted by: pst, ache
Diffstat (limited to 'bin/mv')
-rw-r--r--bin/mv/mv.117
-rw-r--r--bin/mv/mv.c19
2 files changed, 8 insertions, 28 deletions
diff --git a/bin/mv/mv.1 b/bin/mv/mv.1
index eb9634f..f113a3a 100644
--- a/bin/mv/mv.1
+++ b/bin/mv/mv.1
@@ -77,25 +77,17 @@ The following options are available:
Do not prompt for confirmation before overwriting the destination
path.
(The
-.Fl f
-option overrides any previous
.Fl i
-options.)
+option is ignored if the
+.Fl f
+option is specified.)
.It Fl i
Causes
.Nm mv
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
-.Sq Li y
-or
-.Sq Li Y ,
+If the response from the standard input begins with the character ``y'',
the move is attempted.
-(The
-.Fl i
-option overrides any previous
-.Fl f
-options.)
.El
.Pp
It is an error for either the
@@ -129,7 +121,6 @@ The
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr cp 1 ,
-.Xr rm 1 ,
.Xr symlink 7
.Sh STANDARDS
The
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index 0a3d35e..28da455 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -79,17 +79,13 @@ main(argc, argv)
int ch;
char path[MAXPATHLEN + 1];
- fflg = iflg = 0;
-
- while ((ch = getopt(argc, argv, "-if?")) != EOF)
+ while ((ch = getopt(argc, argv, "-if")) != EOF)
switch (ch) {
case 'i':
- iflg = isatty(STDIN_FILENO);
- fflg = 0;
+ iflg = 1;
break;
case 'f':
fflg = 1;
- iflg = 0;
break;
case '-': /* Undocumented; for compatibility. */
goto endarg;
@@ -156,13 +152,6 @@ do_move(from, to)
* make sure the user wants to clobber it.
*/
if (!fflg && !access(to, F_OK)) {
-
- /* prompt only if source exist */
- if (lstat(from, &sb) == -1) {
- warn("%s", from);
- return (1);
- }
-
ask = 0;
if (iflg) {
(void)fprintf(stderr, "overwrite %s? ", to);
@@ -178,7 +167,7 @@ do_move(from, to)
if (ask) {
if ((ch = getchar()) != EOF && ch != '\n')
while (getchar() != '\n');
- if (ch != 'y' && ch != 'Y')
+ if (ch != 'y')
return (0);
}
}
@@ -314,6 +303,6 @@ void
usage()
{
(void)fprintf(stderr,
-"usage: mv [-if] src target;\n or: mv [-i | -f] src1 ... srcN directory\n");
+"usage: mv [-if] src target;\n or: mv [-if] src1 ... srcN directory\n");
exit(1);
}
OpenPOWER on IntegriCloud