summaryrefslogtreecommitdiff
path: root/coreutils/mv.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-21 23:40:20 +0000
committerDenis Vlasenko2006-10-21 23:40:20 +0000
commitf24e1f40e032e99cf57a05730e7632b825d3016d (patch)
treea6d0fa74d59e67d1570c54157f5ebcc47b4522d0 /coreutils/mv.c
parent8d73c35916cbae67f5d0269b128de40f9992ddc6 (diff)
downloadbusybox-f24e1f40e032e99cf57a05730e7632b825d3016d.zip
busybox-f24e1f40e032e99cf57a05730e7632b825d3016d.tar.gz
cp: add support for -s, -l. Fix free(nonmalloc) bug.
Add doc on POSIX's rules on -i and -f (insane!). ln: make "ln dangling_symlink new_link" work.
Diffstat (limited to 'coreutils/mv.c')
-rw-r--r--coreutils/mv.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/coreutils/mv.c b/coreutils/mv.c
index 770b424..52ddd9f 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
@@ -57,7 +57,8 @@ int mv_main(int argc, char **argv)
argv += optind;
if (optind + 2 == argc) {
- if ((dest_exists = cp_mv_stat(last, &dest_stat)) < 0) {
+ dest_exists = cp_mv_stat(last, &dest_stat);
+ if (dest_exists < 0) {
return 1;
}
@@ -69,8 +70,8 @@ int mv_main(int argc, char **argv)
do {
dest = concat_path_file(last, bb_get_last_path_component(*argv));
-
- if ((dest_exists = cp_mv_stat(dest, &dest_stat)) < 0) {
+ dest_exists = cp_mv_stat(dest, &dest_stat);
+ if (dest_exists < 0) {
goto RET_1;
}
@@ -79,7 +80,7 @@ DO_MOVE:
if (dest_exists && !(flags & OPT_FILEUTILS_FORCE) &&
((access(dest, W_OK) < 0 && isatty(0)) ||
(flags & OPT_FILEUTILS_INTERACTIVE))) {
- if (fprintf(stderr, "mv: overwrite `%s'? ", dest) < 0) {
+ if (fprintf(stderr, "mv: overwrite '%s'? ", dest) < 0) {
goto RET_1; /* Ouch! fprintf failed! */
}
if (!bb_ask_confirmation()) {
@@ -92,7 +93,7 @@ DO_MOVE:
if (errno != EXDEV ||
(source_exists = cp_mv_stat(*argv, &source_stat)) < 1) {
- bb_perror_msg("unable to rename `%s'", *argv);
+ bb_perror_msg("cannot rename '%s'", *argv);
} else {
if (dest_exists) {
if (dest_exists == 3) {
@@ -107,7 +108,7 @@ DO_MOVE:
}
}
if (unlink(dest) < 0) {
- bb_perror_msg("cannot remove `%s'", dest);
+ bb_perror_msg("cannot remove '%s'", dest);
goto RET_1;
}
}