diff options
author | Jim Meyering <jim@meyering.net> | 2004-03-12 11:53:29 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-03-12 11:53:29 +0000 |
commit | 83f4f1abd9dddd70a015953ba335d69a6ebc40e1 (patch) | |
tree | 9e26937f7e4bd75f70dd0cda0f93c9c17c80cc65 | |
parent | bcea8e96ea30693a05fcee2ae49aa9aea0e5e7da (diff) | |
download | coreutils-83f4f1abd9dddd70a015953ba335d69a6ebc40e1.tar.xz |
(src_to_dest_lookup): New function.
-rw-r--r-- | src/cp-hash.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cp-hash.c b/src/cp-hash.c index a9aa16b06..c9fff7a19 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. */ |