summaryrefslogtreecommitdiff
path: root/src/ln.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-01-09 08:23:51 +0000
committerJim Meyering <jim@meyering.net>2000-01-09 08:23:51 +0000
commit58cba226682aafe13a7c0ca987b4d52a11339525 (patch)
tree22a377bdef805ee746b86bd86050837401386030 /src/ln.c
parentefe3229edb6289c2ce1b0cf01e9674fdb23f210f (diff)
downloadcoreutils-58cba226682aafe13a7c0ca987b4d52a11339525.tar.xz
(do_link): Produce the same sort of one-line output for
`--backup --verbose' as cp, mv, install. Before this, the backup file name wasn't printed at all.
Diffstat (limited to 'src/ln.c')
-rw-r--r--src/ln.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ln.c b/src/ln.c
index 2af9aa7ac..671016aa7 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -1,5 +1,5 @@
/* `ln' program to create links between files.
- Copyright (C) 86, 89, 90, 91, 1995-1999 Free Software Foundation, Inc.
+ Copyright (C) 86, 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -151,6 +151,7 @@ do_link (const char *source, const char *dest)
struct stat dest_stats;
char *dest_backup = NULL;
int lstat_status;
+ int backup_succeeded = 0;
/* Use stat here instead of lstat.
On SVR4, link does not follow symlinks, so this check disallows
@@ -276,6 +277,10 @@ do_link (const char *source, const char *dest)
else
dest_backup = NULL;
}
+ else
+ {
+ backup_succeeded = 1;
+ }
}
/* Try to unlink DEST even if we may have renamed it. In some unusual
@@ -295,7 +300,12 @@ do_link (const char *source, const char *dest)
}
if (verbose)
- printf (_("create %s %s to %s\n"), link_type_string, dest, source);
+ {
+ printf (_("create %s %s to %s"), link_type_string, dest, source);
+ if (backup_succeeded)
+ printf (_(" (backup: %s)"), dest_backup);
+ putchar ('\n');
+ }
if ((*linkfunc) (source, dest) == 0)
{