add verbose messages
authorLaurent Mazet <mazet@softndesign.org>
Wed, 1 May 2024 21:13:50 +0000 (23:13 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Wed, 1 May 2024 21:13:50 +0000 (23:13 +0200)
cmd.c
cmd.h
cmore.c
tui.c
tui.h

diff --git a/cmd.c b/cmd.c
index dfbeb3dd22556b927098bb5a567fa9edbcb16984..06a3b2a325dbcff742c2b42e9ef970da17e4c106 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -27,6 +27,7 @@ char *exec_cmd (char *cmd)
     int status = -1;
     char *buffer = NULL;
 
+    VERBOSE (DEBUG, fprintf (stdout, "exec command: %s\n", cmd));
     FILE *fp = popen (cmd, "r");
     if (fp != NULL) {
         buffer = _read_stream (fp);
@@ -46,6 +47,7 @@ char *load_file (char *name)
     int status = -1;
     char *buffer = NULL;
 
+    VERBOSE (DEBUG, fprintf (stdout, "open file: %s\n", name));
     FILE *fd = fopen (name, "r");
     if (fd != NULL) {
         buffer = _read_stream (fd);
@@ -64,6 +66,7 @@ char *read_stdin (void)
 {
     char *buffer = NULL;
 
+    VERBOSE (DEBUG, fprintf (stdout, "read stdin\n"));
     buffer = _read_stream (stdin);
 
     return buffer;
@@ -91,10 +94,11 @@ char **split_lines (char *buffer, int max)
     }
     if (line[0] != '\0') {
         lines = (char **) realloc (lines, (n + 2) * sizeof (char *));
-        lines[n] = line;
+        lines[n++] = line;
     } else {
         free (line);
     }
+    VERBOSE (DEBUG, fprintf (stdout, "split lines: %d\n", n));
 
     return lines;
 }
@@ -108,3 +112,5 @@ void free_lines (char **lines)
     }
     free (lines);
 }
+
+/* vim: set ts=4 sw=4 et: */
diff --git a/cmd.h b/cmd.h
index 407f126815ab67bcf11c194a40e4f33fc690a4a5..5b90769f2b2db9a6f691b4f73f440cc658c74b16 100644 (file)
--- a/cmd.h
+++ b/cmd.h
@@ -12,3 +12,5 @@ char **split_lines (char *buffer, int max);
 void free_lines (char **lines);
 
 #endif /* __CMD_H__ */
+
+/* vim: set ts=4 sw=4 et: */
diff --git a/cmore.c b/cmore.c
index a689d3ec23f3574185bec13cd15bdc0599d0f917..bb1bf860031e0f15e10eb2a89797812ded16eadf 100644 (file)
--- a/cmore.c
+++ b/cmore.c
@@ -1,6 +1,6 @@
 /* depend: */
 /* cflags: */
-/* linker: cmd.o debug.o tui.o -lpdcurses */
+/* linker: cmd.o debug.o tui.o -lcurses */
 
 #include <stdlib.h>
 
diff --git a/tui.c b/tui.c
index 61d69befedac5883fc427782bdeb79a48bd369c4..f1056af4f9193e449872111091cfed0b40ad93d4 100644 (file)
--- a/tui.c
+++ b/tui.c
@@ -824,3 +824,5 @@ int getstrings(char *desc[], char *buf[], int field)
 
     return c;
 }
+
+/* vim: set ts=4 sw=4 et: */
diff --git a/tui.h b/tui.h
index 413c168c0208fdafbc89b920be22a3b65623a480..f458b9ceee7becdab8436a0a2bf6d72d6b664ea9 100644 (file)
--- a/tui.h
+++ b/tui.h
@@ -66,3 +66,5 @@ int     getstrings(char *desc[], char *buf[], int field);
 #define mvwinputbox(w,y,x,l,c) (wmove(w,y,x)==ERR?w:winputbox(w,l,c))
 
 #endif
+
+/* vim: set ts=4 sw=4 et: */