From: Jim Meyering Date: Fri, 12 Mar 2004 11:53:29 +0000 (+0000) Subject: (src_to_dest_lookup): New function. X-Git-Tag: v5.2.1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83f4f1abd9dddd70a015953ba335d69a6ebc40e1;p=thirdparty%2Fcoreutils.git (src_to_dest_lookup): New function. --- diff --git a/src/cp-hash.c b/src/cp-hash.c index a9aa16b068..c9fff7a19b 100644 --- a/src/cp-hash.c +++ b/src/cp-hash.c @@ -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. */