summaryrefslogtreecommitdiff
path: root/difftool
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-20 21:01:59 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-20 21:13:43 +0200
commita7d22b83cf70eb500f52edb625e9c719a35b0134 (patch)
treed24d2fbd1aceaac36add177ea2295ba1891a8d1f /difftool
parent3f515038371bde961c88bf62a9ba0a75667b95dd (diff)
Change CLI of sqfsdiff to specify images through long options
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'difftool')
-rw-r--r--difftool/sqfsdiff.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/difftool/sqfsdiff.c b/difftool/sqfsdiff.c
index 4754557..baebc25 100644
--- a/difftool/sqfsdiff.c
+++ b/difftool/sqfsdiff.c
@@ -7,6 +7,8 @@
#include "difftool.h"
static struct option long_opts[] = {
+ { "old", required_argument, NULL, 'a' },
+ { "new", required_argument, NULL, 'b' },
{ "no-owner", no_argument, NULL, 'O' },
{ "no-permissions", no_argument, NULL, 'P' },
{ "no-contents", no_argument, NULL, 'C' },
@@ -18,10 +20,10 @@ static struct option long_opts[] = {
{ "version", no_argument, NULL, 'V' },
};
-static const char *short_opts = "OPCTISe:hV";
+static const char *short_opts = "a:b:OPCTISe:hV";
static const char *usagestr =
-"Usage: sqfsdiff [OPTIONS...] <first> <second>\n"
+"Usage: sqfsdiff [OPTIONS...] --old,-a <first> --new,-b <second>\n"
"\n"
"Compare two squashfs images. In contrast to doing a direct diff of the\n"
"images, this actually parses the filesystems and generates a more\n"
@@ -38,6 +40,9 @@ static const char *usagestr =
"\n"
"Possible options:\n"
"\n"
+" --old, -a <first> The first of the two images to compare.\n"
+" --new, -b <second> The second of the two images to compare.\n"
+"\n"
" --no-contents, -C Do not compare file contents.\n"
" --no-owner, -O Do not compare file owners.\n"
" --no-permissions, -P Do not compare permission bits.\n"
@@ -73,6 +78,12 @@ static void process_options(int argc, char **argv)
break;
switch (i) {
+ case 'a':
+ first_path = optarg;
+ break;
+ case 'b':
+ second_path = optarg;
+ break;
case 'O':
compare_flags |= COMPARE_NO_OWNER;
break;
@@ -106,20 +117,16 @@ static void process_options(int argc, char **argv)
}
}
- if (optind >= argc) {
+ if (first_path == NULL) {
fputs("Missing arguments: first filesystem\n", stderr);
goto fail_arg;
}
- first_path = argv[optind++];
-
- if (optind >= argc) {
+ if (second_path == NULL) {
fputs("Missing arguments: second filesystem\n", stderr);
goto fail_arg;
}
- second_path = argv[optind++];
-
if (optind < argc) {
fputs("Unknown extra arguments\n", stderr);
goto fail_arg;