From 97efd1ff64f6a3e8230583ef84069df749bec125 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Wed, 1 May 2024 23:13:50 +0200 Subject: [PATCH] add verbose messages --- cmd.c | 8 +++++++- cmd.h | 2 ++ cmore.c | 2 +- tui.c | 2 ++ tui.h | 2 ++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd.c b/cmd.c index dfbeb3d..06a3b2a 100644 --- 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 407f126..5b90769 100644 --- 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 a689d3e..bb1bf86 100644 --- 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 diff --git a/tui.c b/tui.c index 61d69be..f1056af 100644 --- 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 413c168..f458b9c 100644 --- 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: */ -- 2.30.2