aboutsummaryrefslogtreecommitdiff
path: root/bin/mv
diff options
context:
space:
mode:
authorWolfram Schneider <wosch@FreeBSD.org>1996-02-19 00:44:19 +0000
committerWolfram Schneider <wosch@FreeBSD.org>1996-02-19 00:44:19 +0000
commitd7e0e5ca0f82c11324beedc8e7d256102e2ef965 (patch)
tree9b8f8df0eb9caf897a1cbf95bc707616786a4937 /bin/mv
parent8ec7a852b0cbbd7348b05373ea0fd79d3c288c08 (diff)
downloadsrc-d7e0e5ca0f82c11324beedc8e7d256102e2ef965.tar.gz
src-d7e0e5ca0f82c11324beedc8e7d256102e2ef965.zip
delete my last commit
Submitted by: pst, ache
Notes
Notes: svn path=/head/; revision=14154
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 eb9634fe7a59..f113a3ac311a 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 0a3d35e6a9f4..28da455ecd6f 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);
}