summaryrefslogtreecommitdiff
path: root/src/ln.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-08-01 04:42:08 +0000
committerJim Meyering <jim@meyering.net>1996-08-01 04:42:08 +0000
commitb10f778bf5475e8daa06041365b10875495390a6 (patch)
treeec4bab87dd63e84963ca412c5414220fe46a6271 /src/ln.c
parente9ed1c0601baed24ed474413e4f310c9c9f3ef0e (diff)
downloadcoreutils-b10f778bf5475e8daa06041365b10875495390a6.tar.xz
[LINK_TYPE]: Remove macro. NLS messages aren't
extracted from macros. (link_type_string): New global variable to be used instead of LINK_TYPE. (main): Set it here. (do_link): Use it (instead of macro) here.
Diffstat (limited to 'src/ln.c')
-rw-r--r--src/ln.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/ln.c b/src/ln.c
index 0cb3359ab..8e76abdcc 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -36,12 +36,6 @@ int link (); /* Some systems don't declare this anywhere. */
int symlink ();
#endif
-#ifdef S_ISLNK
-# define LINK_TYPE symbolic_link ? _("symbolic link") : _("hard link")
-#else
-# define LINK_TYPE ""
-#endif
-
/* Construct a string NEW_DEST by concatenating DEST, a slash, and
basename(SOURCE) in alloca'd memory. Don't modify DEST or SOURCE. */
@@ -80,6 +74,10 @@ static int (*linkfunc) ();
/* If nonzero, make symbolic links; otherwise, make hard links. */
static int symbolic_link;
+/* A string describing type of link to make. For use in verbose
+ diagnostics and in error messages. */
+static const char *link_type_string;
+
/* If nonzero, ask the user before removing existing files. */
static int interactive;
@@ -289,15 +287,14 @@ do_link (const char *source, const char *dest)
}
if (verbose)
- printf (_("create %s %s to %s\n"), LINK_TYPE,
- dest, source);
+ printf (_("create %s %s to %s\n"), link_type_string, dest, source);
if ((*linkfunc) (source, dest) == 0)
{
return 0;
}
- error (0, errno, _("cannot create %s `%s' to `%s'"), LINK_TYPE,
+ error (0, errno, _("cannot create %s `%s' to `%s'"), link_type_string,
dest, source);
if (dest_backup)
@@ -368,7 +365,6 @@ main (int argc, char **argv)
simple_backup_suffix = version;
version = getenv ("VERSION_CONTROL");
- linkfunc = link;
symbolic_link = remove_existing_files = interactive = verbose
= hard_dir_link = 0;
errors = 0;
@@ -441,7 +437,17 @@ main (int argc, char **argv)
#ifdef S_ISLNK
if (symbolic_link)
- linkfunc = symlink;
+ {
+ linkfunc = symlink;
+ link_type_string = _("symbolic link");
+ }
+ else
+ {
+ linkfunc = link;
+ link_type_string = _("hard link");
+ }
+#else
+ link_type_string = _("link");
#endif
if (optind == argc - 1)