From 6564e4ca4cd7503bfc8ff171d91718f68cd97ea8 Mon Sep 17 00:00:00 2001 From: Colin Leroy-Mira Date: Tue, 30 Jan 2024 08:35:23 +0100 Subject: [PATCH] add debug --- test/isequal.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/isequal.c b/test/isequal.c index 1add624126..58bfc45fa9 100644 --- a/test/isequal.c +++ b/test/isequal.c @@ -436,9 +436,18 @@ static int comparefileswithwildcards(FILE *f1, FILE *f2) } } +static void cat(FILE *fp) { + rewind(fp); + unsigned char c; + while (fread(&c, 1, 1, fp)) { + fprintf(stderr, "%02X ", c); + } +} + int main(int argc, char *argv[]) { FILE *f1, *f2; + int result; if (handleparameter(argc, argv) < 0) { return EXIT_FAILURE; @@ -474,7 +483,14 @@ int main(int argc, char *argv[]) return comparefileswithwildcards(f1, f2); } else { - return comparefiles(f1, f2); + result = comparefiles(f1, f2); + if (result != 0) { + fprintf(stderr, "First file:\n"); + cat(f1); + fprintf(stderr, "\nSecond file:\n"); + cat(f2); + fprintf(stderr, "\n"); + } } } }