From 83f4f1abd9dddd70a015953ba335d69a6ebc40e1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 12 Mar 2004 11:53:29 +0000 Subject: [PATCH] (src_to_dest_lookup): New function. --- src/cp-hash.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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. */ -- 2.47.2