summaryrefslogtreecommitdiff
path: root/src/ln.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-05-23 19:41:19 +0000
committerJim Meyering <jim@meyering.net>1999-05-23 19:41:19 +0000
commit2a8c9424f0e9acd8bec68b8806dcf2aca61b59ff (patch)
tree0d340557ed17b7f2c28a09b21fb0f6cbd430bdea /src/ln.c
parent96074cef7904ccc99565e91f1a1fa46a47dc34e6 (diff)
downloadcoreutils-2a8c9424f0e9acd8bec68b8806dcf2aca61b59ff.tar.xz
(same_name): Remove function.
<same.h>: Include this instead. <dirname.h>: No longer include this.
Diffstat (limited to 'src/ln.c')
-rw-r--r--src/ln.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/src/ln.c b/src/ln.c
index 1cdc72f2f..7943c8841 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -27,8 +27,8 @@
#include <getopt.h>
#include "system.h"
+#include "same.h"
#include "backupfile.h"
-#include "dirname.h"
#include "error.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -117,40 +117,6 @@ static struct option const long_options[] =
{NULL, 0, NULL, 0}
};
-/* Return nonzero if SOURCE and DEST point to the same name in the same
- directory. */
-
-static int
-same_name (const char *source, const char *dest)
-{
- struct stat source_dir_stats;
- struct stat dest_dir_stats;
- char *source_dirname, *dest_dirname;
-
- source_dirname = dir_name (source);
- dest_dirname = dir_name (dest);
- if (source_dirname == NULL || dest_dirname == NULL)
- error (1, 0, _("virtual memory exhausted"));
-
- if (stat (source_dirname, &source_dir_stats))
- {
- /* Shouldn't happen. */
- error (1, errno, "%s", source_dirname);
- }
-
- if (stat (dest_dirname, &dest_dir_stats))
- {
- /* Shouldn't happen. */
- error (1, errno, "%s", dest_dirname);
- }
-
- free (source_dirname);
- free (dest_dirname);
-
- return (SAME_INODE (source_dir_stats, dest_dir_stats)
- && STREQ (base_name (source), base_name (dest)));
-}
-
/* Make a link DEST to the (usually) existing file SOURCE.
Symbolic links to nonexistent files are allowed.
If DEST is a directory, put the link to SOURCE in that directory.