]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(src_to_dest_lookup): New function.
authorJim Meyering <jim@meyering.net>
Fri, 12 Mar 2004 11:53:29 +0000 (11:53 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 12 Mar 2004 11:53:29 +0000 (11:53 +0000)
src/cp-hash.c

index a9aa16b0684b87e660bec340ebf0c87bde448d1c..c9fff7a19babec73f42f94d360c5739bf7e7cd63 100644 (file)
@@ -1,5 +1,5 @@
 /* cp-hash.c  -- file copying (hash search routines)
-   Copyright (C) 89, 90, 91, 1995-2003 Free Software Foundation.
+   Copyright (C) 89, 90, 91, 1995-2004 Free Software Foundation.
 
    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
@@ -116,6 +116,20 @@ remember_created (const char *path)
   return 0;
 }
 
+/* If INO/DEV correspond to an already-copied source file, return the
+   name of the corresponding destination file.  Otherwise, return NULL.  */
+
+char *
+src_to_dest_lookup (ino_t ino, dev_t dev)
+{
+  struct Src_to_dest ent;
+  struct Src_to_dest const *e;
+  ent.st_ino = ino;
+  ent.st_dev = dev;
+  e = hash_lookup (src_to_dest, &ent);
+  return e ? e->name : NULL;
+}
+
 /* Add path NAME, copied from inode number INO and device number DEV,
    to the list of files we have copied.
    Return NULL if inserted, otherwise non-NULL. */