]> Sergey Matveev's repositories - nnn.git/commitdiff
Use dprintf(3) for debugging
authorlostd <lostd@2f30.org>
Wed, 8 Oct 2014 08:36:17 +0000 (11:36 +0300)
committerlostd <lostd@2f30.org>
Wed, 8 Oct 2014 08:36:17 +0000 (11:36 +0300)
noice.c

diff --git a/noice.c b/noice.c
index 4289300db0719848f88794096659124552c0d0b3..9712f803c90701787907975a6c58475c4c936b61 100644 (file)
--- a/noice.c
+++ b/noice.c
 #include <unistd.h>
 
 #ifdef DEBUG
-#define DPRINTF_D(x) printw(#x "=%d\n", x)
-#define DPRINTF_S(x) printw(#x "=%s\n", x)
-#define DPRINTF_P(x) printw(#x "=0x%p\n", x)
+#define DEBUG_FD 8
+#define DPRINTF_D(x) dprintf(DEBUG_FD, #x "=%d\n", x)
+#define DPRINTF_U(x) dprintf(DEBUG_FD, #x "=%u\n", x)
+#define DPRINTF_S(x) dprintf(DEBUG_FD, #x "=%s\n", x)
+#define DPRINTF_P(x) dprintf(DEBUG_FD, #x "=0x%p\n", x)
 #else
 #define DPRINTF_D(x)
+#define DPRINTF_U(x)
 #define DPRINTF_S(x)
 #define DPRINTF_P(x)
 #endif /* DEBUG */
@@ -355,6 +358,9 @@ nochange:
                        pathnew = malloc(strlen(path) + 1
                            + strlen(name) + 1);
                        sprintf(pathnew, "%s/%s", path, name);
+
+                       DPRINTF_S(name);
+                       DPRINTF_U(type);
                        DPRINTF_S(pathnew);
 
 again:
@@ -426,7 +432,6 @@ again:
                                free(pathnew);
                                goto redraw;
                        default:
-                               DPRINTF_D(dents[cur]->d_type);
                                printmsg("Unsupported file");
                                goto nochange;
                        }