From 943fa96eea0aac7767c54c217f587c07f4ae8181 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Wed, 6 Dec 2023 11:02:13 +0100 Subject: [PATCH] add debug info --- indent.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/indent.c b/indent.c index 874eead..145661b 100644 --- a/indent.c +++ b/indent.c @@ -59,9 +59,9 @@ int indent (FILE *fin, FILE *fout, cmode_t cmode) { /* read file */ nb = fread (bufin, 1, BUFFERSIZE, fin); - VERBOSE (DEBUG, fprintf (stdout, "buffer: %d\n", nb)); + VERBOSE (DEBUG, fprintf (stdout, "buffer in: %d\n", nb)); if (errno != 0) { - VERBOSE (ERROR, fprintf (stderr, "can't read file\n")); + VERBOSE (ERROR, fprintf (stderr, "can't read file (%d)\n", errno)); exit (1); } @@ -89,10 +89,11 @@ int indent (FILE *fin, FILE *fout, cmode_t cmode) { ptout = '\0'; /* write file */ + VERBOSE (DEBUG, fprintf (stdout, "buffer out: %d\n", strlen (bufout))); ptout = bufout; while ((nb = fread (ptout, 1, strlen (ptout), fout)) != strlen (ptout)) { if (errno != 0) { - VERBOSE (ERROR, fprintf (stderr, "can't write file\n")); + VERBOSE (ERROR, fprintf (stderr, "can't write file (%d)\n", errno)); exit (1); } ptout += nb; -- 2.30.2