isequal: add --skip for both left and right file

isequal: New option --skip as a shortcut for --skipleft and --skipright
at once.

Use that for the .list-ref files, so they now contain the first line of
the output, too, which is ignored.
This commit is contained in:
Spiro Trikaliotis
2022-06-19 22:42:44 +02:00
parent 1446b7dcc3
commit e17cb6d602
13 changed files with 24 additions and 1 deletions

View File

@@ -36,9 +36,11 @@ int handleparameter(int argc, char *argv[])
static const char opt_empty[] = "--empty";
static const char opt_skipleft[] = "--skipleft";
static const char opt_skipright[] = "--skipright";
static const char opt_skip[] = "--skip";
static const char len_skipleft = sizeof opt_skipleft - 1;
static const char len_skipright = sizeof opt_skipright - 1;
static const char len_skip = sizeof opt_skip - 1;
int argindex = 1;
@@ -81,6 +83,16 @@ int handleparameter(int argc, char *argv[])
fprintf(stderr, "%s: you must specify the number of lines\n", opt_skipright);
}
}
else if (strncmp(argv[argindex], opt_skip, len_skip) == 0) {
if (binary || empty) {
fprintf(stderr, "%s cannot go with other options.\n", opt_skipright);
exit(1);
}
skiplines_left = skiplines_right = handleargparameter(len_skip, argv[argindex]);
if (skiplines_left < 0) {
fprintf(stderr, "%s: you must specify the number of lines\n", opt_skip);
}
}
++argindex;
}