add debug info
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Wed, 6 Dec 2023 10:02:13 +0000 (11:02 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Wed, 6 Dec 2023 10:02:13 +0000 (11:02 +0100)
indent.c

index 874eead8efc566ed3b6e046357367d1c0094f484..145661ba7950afed98f7a0c292e6e9f04ee87ffc 100644 (file)
--- 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;