summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-01-26 04:30:39 +0000
committerJim Meyering <jim@meyering.net>1997-01-26 04:30:39 +0000
commite1ea22da057e9faff943ffd6b03bab0c4c9c3bc2 (patch)
tree43b99873ac353d9dd8ea92b0ee89daaa0470ffa9 /src
parent1e71247ea0fef0d54ca29c15772689b56768dd5a (diff)
downloadcoreutils-e1ea22da057e9faff943ffd6b03bab0c4c9c3bc2.tar.xz
(is_ancestor): Add it.
Diffstat (limited to 'src')
-rw-r--r--src/cp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cp.c b/src/cp.c
index 93dce2c16..7e3489158 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -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