12 #include <sys/types.h>
26 # define _(Text) gettext (Text)
31 #define STREQ(a, b) (strcmp ((a), (b)) == 0)
33 #ifndef HAVE_DECL_FREE
37 char *base_name PARAMS ((char const *));
39 #define SAME_INODE(Stat_buf_1, Stat_buf_2) \
40 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
41 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
43 /* Return nonzero if SOURCE and DEST point to the same name in the same
47 same_name (const char *source, const char *dest)
49 struct stat source_dir_stats;
50 struct stat dest_dir_stats;
51 char *source_dirname, *dest_dirname;
53 source_dirname = dir_name (source);
54 dest_dirname = dir_name (dest);
55 if (source_dirname == NULL || dest_dirname == NULL)
56 error (1, 0, _("virtual memory exhausted"));
58 if (stat (source_dirname, &source_dir_stats))
60 /* Shouldn't happen. */
61 error (1, errno, "%s", source_dirname);
64 if (stat (dest_dirname, &dest_dir_stats))
66 /* Shouldn't happen. */
67 error (1, errno, "%s", dest_dirname);
70 free (source_dirname);
73 return (SAME_INODE (source_dir_stats, dest_dir_stats)
74 && STREQ (base_name (source), base_name (dest)));