diff options
author | Jim Meyering <jim@meyering.net> | 1997-01-26 04:30:39 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-01-26 04:30:39 +0000 |
commit | e1ea22da057e9faff943ffd6b03bab0c4c9c3bc2 (patch) | |
tree | 43b99873ac353d9dd8ea92b0ee89daaa0470ffa9 /src | |
parent | 1e71247ea0fef0d54ca29c15772689b56768dd5a (diff) | |
download | coreutils-e1ea22da057e9faff943ffd6b03bab0c4c9c3bc2.tar.xz |
(is_ancestor): Add it.
Diffstat (limited to 'src')
-rw-r--r-- | src/cp.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -211,6 +211,18 @@ static struct option const long_opts[] = {NULL, 0, NULL, 0} }; +static int +is_ancestor (const struct stat *sb, const struct dir_list *ancestors) +{ + while (ancestors != 0) + { + if (ancestors->ino == sb->st_ino && ancestors->dev == sb->st_dev) + return 1; + ancestors = ancestors->parent; + } + return 0; +} + int main (int argc, char **argv) { @@ -570,7 +582,7 @@ is not a directory"), usage (1); } } - + /* Copy the file SRC_PATH to the file DST_PATH. The files may be of any type. NEW_DST should be nonzero if the file DST_PATH cannot exist because its parent directory was just created; NEW_DST should |