summaryrefslogtreecommitdiff
path: root/difftool/fscompare.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-07 11:10:58 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-07 11:24:37 +0200
commit740b161bfaddbd236c9d052546f27dd4af30582c (patch)
tree6635a86cf206f4111dcceb0f46c34691ccaf3ca3 /difftool/fscompare.c
parent55914564db1ce7a4fc71e9dc34156aa144661d0d (diff)
Add flag to difftool to also compare time stamps
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'difftool/fscompare.c')
-rw-r--r--difftool/fscompare.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/difftool/fscompare.c b/difftool/fscompare.c
index c925adc..3f00a5c 100644
--- a/difftool/fscompare.c
+++ b/difftool/fscompare.c
@@ -9,11 +9,12 @@
static struct option long_opts[] = {
{ "no-owner", no_argument, NULL, 'O' },
{ "no-permissions", no_argument, NULL, 'P' },
+ { "timestamps", no_argument, NULL, 'T' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
};
-static const char *short_opts = "OPhV";
+static const char *short_opts = "OPThV";
static const char *usagestr =
"Usage: fscompare [OPTIONS...] <first> <second>\n"
@@ -26,6 +27,8 @@ static const char *usagestr =
" --no-owner, -O Do not compare file owners.\n"
" --no-permissions, -P Do not compare permission bits.\n"
"\n"
+" --timestamps, -T Compare file timestamps.\n"
+"\n"
" --help, -h Print help text and exit.\n"
" --version, -V Print version information and exit.\n"
"\n";
@@ -50,6 +53,9 @@ static void process_options(int argc, char **argv)
case 'P':
compare_flags |= COMPARE_NO_PERM;
break;
+ case 'T':
+ compare_flags |= COMPARE_TIMESTAMP;
+ break;
case 'h':
fputs(usagestr, stdout);
exit(EXIT_SUCCESS);
@@ -98,10 +104,10 @@ int main(int argc, char **argv)
if (fstree_init(&bfs, 512, NULL))
goto out_afs;
- if (fstree_from_dir(&afs, first_path, false))
+ if (fstree_from_dir(&afs, first_path, true))
goto out_bfs;
- if (fstree_from_dir(&bfs, second_path, false))
+ if (fstree_from_dir(&bfs, second_path, true))
goto out_bfs;
tree_node_sort_recursive(afs.root);