Vitezslav Samel (6): merge tui/tui.h into tui/msgboxes.h use iptraf-ng-compat.h for system headers in src/tui/* merge src/tui/txbox.c into src/tui/winops.c remove inclusion of non-system headers from iptraf-ng-compat.h use xmalloc[z]() instead of plain malloc() add info about authorship into tui/*.c
Makefile | 2 -- src/bar.c | 2 ++ src/deskman.c | 4 ++++ src/detstats.c | 3 ++- src/error.c | 3 +-- src/fltedit.c | 6 +++++- src/fltmgr.c | 8 +++++++- src/fltselect.c | 5 ++++- src/hostmon.c | 3 +++ src/ifstats.c | 6 +++++- src/ipfilter.c | 5 ++++- src/iptraf-ng-compat.h | 9 --------- src/iptraf.c | 3 +++ src/itrafmon.c | 3 +++ src/landesc.c | 7 ++++++- src/log.c | 5 ++++- src/options.c | 6 +++++- src/othptab.c | 2 ++ src/pktsize.c | 2 ++ src/serv.c | 6 +++++- src/tcptable.c | 2 ++ src/tui/input.c | 11 +++++------ src/tui/input.h | 2 -- src/tui/labels.c | 5 +++-- src/tui/labels.h | 2 -- src/tui/listbox.c | 11 ++++------- src/tui/listbox.h | 2 -- src/tui/menurt.c | 10 ++++------ src/tui/msgboxes.c | 5 +++-- src/tui/msgboxes.h | 2 ++ src/tui/tui.h | 9 --------- src/tui/txbox.c | 39 --------------------------------------- src/tui/winops.c | 38 ++++++++++++++++++++++++++++++++++---- src/tui/winops.h | 1 - 34 files changed, 124 insertions(+), 105 deletions(-) delete mode 100644 src/tui/tui.h delete mode 100644 src/tui/txbox.c
merge tui/tui.h into tui/msgboxes.h and kill the tui/tui.h file.
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- Makefile | 1 - src/detstats.c | 1 - src/error.c | 1 - src/fltedit.c | 1 - src/fltmgr.c | 1 - src/fltselect.c | 1 - src/ifstats.c | 1 - src/ipfilter.c | 1 - src/landesc.c | 1 - src/log.c | 1 - src/options.c | 1 - src/serv.c | 1 - src/tui/listbox.c | 1 - src/tui/msgboxes.h | 2 ++ src/tui/tui.h | 9 --------- 15 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 src/tui/tui.h
diff --git a/Makefile b/Makefile index 1429aca..dbf1990 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,6 @@ iptraf-h += src/tui/listbox.h iptraf-h += src/tui/menurt.h iptraf-h += src/tui/msgboxes.h iptraf-h += src/tui/winops.h -iptraf-h += src/tui/tui.h iptraf-h += src/iptraf-ng-compat.h iptraf-h += src/parse-options.h iptraf-h += src/packet.h diff --git a/src/detstats.c b/src/detstats.c index e3de9a0..25fdcdd 100644 --- a/src/detstats.c +++ b/src/detstats.c @@ -8,7 +8,6 @@ detstats.c - the interface statistics module ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "counters.h" #include "ifaces.h" diff --git a/src/error.c b/src/error.c index 0c9ac4b..e4167e4 100644 --- a/src/error.c +++ b/src/error.c @@ -8,7 +8,6 @@ error.c - Error-handling subroutines ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "error.h" #include "log.h" diff --git a/src/fltedit.c b/src/fltedit.c index aed3936..c83b199 100644 --- a/src/fltedit.c +++ b/src/fltedit.c @@ -8,7 +8,6 @@ fltedit.c - the filter editing Facility ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "fltdefs.h" #include "fltmgr.h" diff --git a/src/fltmgr.c b/src/fltmgr.c index 1f00f52..bb93bc1 100644 --- a/src/fltmgr.c +++ b/src/fltmgr.c @@ -8,7 +8,6 @@ fltmgr.c - filter list management routines ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "attrs.h" #include "deskman.h" diff --git a/src/fltselect.c b/src/fltselect.c index 3edd0d7..e51fbcf 100644 --- a/src/fltselect.c +++ b/src/fltselect.c @@ -9,7 +9,6 @@ fltselect.c - a menu-based module that allows selection of ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "addproto.h" #include "dirs.h" diff --git a/src/ifstats.c b/src/ifstats.c index 8b336bc..8cb384e 100644 --- a/src/ifstats.c +++ b/src/ifstats.c @@ -8,7 +8,6 @@ ifstats.c - the interface statistics module ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "ifaces.h" #include "isdntab.h" diff --git a/src/ipfilter.c b/src/ipfilter.c index 1a41cae..162c997 100644 --- a/src/ipfilter.c +++ b/src/ipfilter.c @@ -8,7 +8,6 @@ ipfilter.c - user interface and filter function for all IP packets ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "addproto.h" #include "dirs.h" diff --git a/src/landesc.c b/src/landesc.c index c29da0f..38e01f2 100644 --- a/src/landesc.c +++ b/src/landesc.c @@ -10,7 +10,6 @@ landesc.c - LAN host description management module ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h" #include "landesc.h" #include "deskman.h" #include "attrs.h" diff --git a/src/log.c b/src/log.c index 764c73b..ebe3c35 100644 --- a/src/log.c +++ b/src/log.c @@ -8,7 +8,6 @@ log.c - the iptraf logging facility ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "attrs.h" #include "deskman.h" diff --git a/src/options.c b/src/options.c index baf7a2b..b62b9dd 100644 --- a/src/options.c +++ b/src/options.c @@ -8,7 +8,6 @@ options.c - implements the configuration section of the utility ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "serv.h" #include "options.h" diff --git a/src/serv.c b/src/serv.c index 7bbcdf7..8fda3f5 100644 --- a/src/serv.c +++ b/src/serv.c @@ -8,7 +8,6 @@ serv.c - TCP/UDP port statistics module ***/
#include "iptraf-ng-compat.h" -#include "tui/tui.h"
#include "dirs.h" #include "deskman.h" diff --git a/src/tui/listbox.c b/src/tui/listbox.c index ed563d3..7e1e336 100644 --- a/src/tui/listbox.c +++ b/src/tui/listbox.c @@ -12,7 +12,6 @@ #include "labels.h" #include "listbox.h" #include "msgboxes.h" -#include "tui.h"
void tx_init_listbox(struct scroll_list *list, int width, int height, int startx, int starty, int mainattr, int borderattr, diff --git a/src/tui/msgboxes.h b/src/tui/msgboxes.h index 57eb8d8..9758411 100644 --- a/src/tui/msgboxes.h +++ b/src/tui/msgboxes.h @@ -6,5 +6,7 @@ void tx_init_error_attrs(int border, int text, int prompt); void tx_init_info_attrs(int border, int text, int prompt); void tx_infobox(char *text, char *prompt); +void tui_error(const char *prompt, const char *err, ...) __attribute((format (printf, 2, 3))); +void tui_error_va(const char *prompt, const char *err, va_list vararg);
#endif /* IPTRAF_NG_TUI_MSGBOXES_H */ diff --git a/src/tui/tui.h b/src/tui/tui.h deleted file mode 100644 index 81f7a05..0000000 --- a/src/tui/tui.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef IPTRAF_NG_TUI_TUI_H -#define IPTRAF_NG_TUI_TUI_H - -#define ANYKEY_MSG "Press a key to continue" - -extern void tui_error(const char *prompt, const char *err, ...) __attribute((format (printf, 2, 3))); -extern void tui_error_va(const char *prompt, const char *err, va_list vararg); - -#endif /* IPTRAF_NG_TUI_TUI_H */
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- src/tui/input.c | 5 ++--- src/tui/input.h | 2 -- src/tui/labels.c | 4 ++-- src/tui/labels.h | 2 -- src/tui/listbox.c | 6 ++---- src/tui/listbox.h | 2 -- src/tui/menurt.c | 7 ++----- src/tui/msgboxes.c | 4 ++-- src/tui/txbox.c | 2 +- src/tui/winops.c | 4 ---- src/tui/winops.h | 1 - 11 files changed, 11 insertions(+), 28 deletions(-)
diff --git a/src/tui/input.c b/src/tui/input.c index 40ec42a..ba4a0cf 100644 --- a/src/tui/input.c +++ b/src/tui/input.c @@ -6,9 +6,8 @@ input.c - a custom keyboard input module
***/
-#include <curses.h> -#include <panel.h> -#include <ctype.h> +#include "iptraf-ng-compat.h" + #include "input.h"
void tx_initfields(struct FIELDLIST *list, int leny, int lenx, int begy, diff --git a/src/tui/input.h b/src/tui/input.h index 26d2912..f8a78b5 100644 --- a/src/tui/input.h +++ b/src/tui/input.h @@ -7,8 +7,6 @@ input.h - structure declarations and function prototypes for input.c
***/
-#include <string.h> -#include <stdlib.h> #include "winops.h"
#define CTRL_X 24 diff --git a/src/tui/labels.c b/src/tui/labels.c index 654d026..8ce04b6 100644 --- a/src/tui/labels.c +++ b/src/tui/labels.c @@ -5,8 +5,8 @@ * user interface library */
-#include <curses.h> -#include <panel.h> +#include "iptraf-ng-compat.h" + #include "winops.h"
void tx_printkeyhelp(char *keytext, char *desc, WINDOW * win, int highattr, diff --git a/src/tui/labels.h b/src/tui/labels.h index 3073763..4be8232 100644 --- a/src/tui/labels.h +++ b/src/tui/labels.h @@ -1,8 +1,6 @@ #ifndef IPTRAF_NG_TUI_LABELS_H #define IPTRAF_NG_TUI_LABELS_H
-#include <curses.h> - void tx_printkeyhelp(char *keytext, char *desc, WINDOW * win, int highattr, int textattr); void tx_menukeyhelp(int textattr, int highattr); diff --git a/src/tui/listbox.c b/src/tui/listbox.c index 7e1e336..a867d95 100644 --- a/src/tui/listbox.c +++ b/src/tui/listbox.c @@ -4,10 +4,8 @@ * listbox.c - scrollable listbox management module */
-#include <curses.h> -#include <panel.h> -#include <string.h> -#include <stdlib.h> +#include "iptraf-ng-compat.h" + #include "winops.h" #include "labels.h" #include "listbox.h" diff --git a/src/tui/listbox.h b/src/tui/listbox.h index 2ba8430..75637ff 100644 --- a/src/tui/listbox.h +++ b/src/tui/listbox.h @@ -1,8 +1,6 @@ #ifndef IPTRAF_NG_TUI_LISTBOX_H #define IPTRAF_NG_TUI_LISTBOX_H
-#include <curses.h> - #define MAX_TEXT_LENGTH 240
struct textlisttype { diff --git a/src/tui/menurt.c b/src/tui/menurt.c index b64a4c1..aa7f654 100644 --- a/src/tui/menurt.c +++ b/src/tui/menurt.c @@ -6,11 +6,8 @@ menurt.c - ncurses-based menu definition module
***/
-#include <curses.h> -#include <panel.h> -#include <string.h> -#include <ctype.h> -#include <stdlib.h> +#include "iptraf-ng-compat.h" + #include "menurt.h" #include "winops.h" #include "labels.h" diff --git a/src/tui/msgboxes.c b/src/tui/msgboxes.c index cfd075e..9b17bc4 100644 --- a/src/tui/msgboxes.c +++ b/src/tui/msgboxes.c @@ -4,8 +4,8 @@ * msgboxes.c - message and error box display functions */
-#include <curses.h> -#include <panel.h> +#include "iptraf-ng-compat.h" + #include "winops.h"
int ERR_BORDER_ATTR; diff --git a/src/tui/txbox.c b/src/tui/txbox.c index 402c23a..c71e081 100644 --- a/src/tui/txbox.c +++ b/src/tui/txbox.c @@ -11,7 +11,7 @@ * The tx_box function is a drop-in replacement for box(). */
-#include <curses.h> +#include "iptraf-ng-compat.h"
void tx_box(WINDOW * win, int vline, int hline) { diff --git a/src/tui/winops.c b/src/tui/winops.c index a0c0e6b..f130ab1 100644 --- a/src/tui/winops.c +++ b/src/tui/winops.c @@ -6,10 +6,6 @@ winops.c - screen configuration and setup functions
***/
-#include <curses.h> -#include <stdlib.h> -#include <string.h> - #include "iptraf-ng-compat.h"
void tx_stdwinset(WINDOW * win) diff --git a/src/tui/winops.h b/src/tui/winops.h index 53f7038..9036d6b 100644 --- a/src/tui/winops.h +++ b/src/tui/winops.h @@ -8,7 +8,6 @@ for IPTraf
***/
-#include <curses.h> #define tx_coloreol() tx_wcoloreol(stdscr)
void tx_stdwinset(WINDOW * win);
Merge src/tui/txbox.c into src/tui/winops.c and delete src/tui/txbox.c.
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- Makefile | 1 - src/tui/txbox.c | 39 --------------------------------------- src/tui/winops.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 40 deletions(-) delete mode 100644 src/tui/txbox.c
diff --git a/Makefile b/Makefile index dbf1990..1fe073f 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,6 @@ iptraf-o += src/tui/labels.o iptraf-o += src/tui/listbox.o iptraf-o += src/tui/menurt.o iptraf-o += src/tui/msgboxes.o -iptraf-o += src/tui/txbox.o iptraf-o += src/tui/winops.o iptraf-o += src/error.o iptraf-o += src/log.o diff --git a/src/tui/txbox.c b/src/tui/txbox.c deleted file mode 100644 index c71e081..0000000 --- a/src/tui/txbox.c +++ /dev/null @@ -1,39 +0,0 @@ -/* For terms of usage/redistribution/modification see the LICENSE file */ - -/* - * txbox.c - custom window bordering routine for ncurses windows. - * - * This function is written to address a strange symptom in ncurses 5.2, at - * least on RedHat 7.3. The border drawn by the box() macro (actually an alias - * for a call to wborder()) no longer uses the color attributes set by - * wattrset(). However, the addch() and wvline() functions still do. - * - * The tx_box function is a drop-in replacement for box(). - */ - -#include "iptraf-ng-compat.h" - -void tx_box(WINDOW * win, int vline, int hline) -{ - int winwidth; - int winheight; - int i; - - scrollok(win, 0); - getmaxyx(win, winheight, winwidth); - winheight--; - winwidth--; - - mvwaddch(win, 0, 0, ACS_ULCORNER); - mvwhline(win, 0, 1, hline, winwidth - 1); - mvwaddch(win, 0, winwidth, ACS_URCORNER); - - for (i = 1; i < winheight; i++) { - mvwaddch(win, i, 0, vline); - mvwaddch(win, i, winwidth, vline); - } - - mvwaddch(win, winheight, 0, ACS_LLCORNER); - mvwhline(win, winheight, 1, hline, winwidth - 1); - mvwaddch(win, winheight, winwidth, ACS_LRCORNER); -} diff --git a/src/tui/winops.c b/src/tui/winops.c index f130ab1..363611a 100644 --- a/src/tui/winops.c +++ b/src/tui/winops.c @@ -57,3 +57,36 @@ void tx_wcoloreol(WINDOW * win) scrollok(win, 0); wprintw(win, sp_buf, ' '); } + +/* + * This function is written to address a strange symptom in ncurses 5.2, at + * least on RedHat 7.3. The border drawn by the box() macro (actually an alias + * for a call to wborder()) no longer uses the color attributes set by + * wattrset(). However, the addch() and wvline() functions still do. + * + * The tx_box function is a drop-in replacement for box(). + */ +void tx_box(WINDOW *win, int vline, int hline) +{ + int winwidth; + int winheight; + int i; + + scrollok(win, 0); + getmaxyx(win, winheight, winwidth); + winheight--; + winwidth--; + + mvwaddch(win, 0, 0, ACS_ULCORNER); + mvwhline(win, 0, 1, hline, winwidth - 1); + mvwaddch(win, 0, winwidth, ACS_URCORNER); + + for (i = 1; i < winheight; i++) { + mvwaddch(win, i, 0, vline); + mvwaddch(win, i, winwidth, vline); + } + + mvwaddch(win, winheight, 0, ACS_LLCORNER); + mvwhline(win, winheight, 1, hline, winwidth - 1); + mvwaddch(win, winheight, winwidth, ACS_LRCORNER); +}
Vitezslav Samel vitezslav@samel.cz writes:
Merge src/tui/txbox.c into src/tui/winops.c and delete src/tui/txbox.c.
- This function is written to address a strange symptom in ncurses 5.2, at
- least on RedHat 7.3. The border drawn by the box() macro (actually an alias
- for a call to wborder()) no longer uses the color attributes set by
- wattrset(). However, the addch() and wvline() functions still do.
- The tx_box function is a drop-in replacement for box().
- */
would be nice to check if comment is still valid, if not, remove tx_box() and use box()
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- src/bar.c | 2 ++ src/deskman.c | 4 ++++ src/detstats.c | 2 ++ src/error.c | 2 +- src/fltedit.c | 5 +++++ src/fltmgr.c | 7 +++++++ src/fltselect.c | 4 ++++ src/hostmon.c | 3 +++ src/ifstats.c | 5 +++++ src/ipfilter.c | 4 ++++ src/iptraf-ng-compat.h | 9 --------- src/iptraf.c | 3 +++ src/itrafmon.c | 3 +++ src/landesc.c | 6 ++++++ src/log.c | 4 ++++ src/options.c | 5 +++++ src/othptab.c | 2 ++ src/pktsize.c | 2 ++ src/serv.c | 5 +++++ src/tcptable.c | 2 ++ 20 files changed, 69 insertions(+), 10 deletions(-)
diff --git a/src/bar.c b/src/bar.c index 7c4fbbc..bc88c4c 100644 --- a/src/bar.c +++ b/src/bar.c @@ -12,6 +12,8 @@
#include "iptraf-ng-compat.h"
+#include "tui/winops.h" + #include "attrs.h"
void set_barptr(void **barptr, void *entry, time_t * starttime, void *spanbr, diff --git a/src/deskman.c b/src/deskman.c index 4a6ad7a..25940dc 100644 --- a/src/deskman.c +++ b/src/deskman.c @@ -9,6 +9,10 @@ deskman.c - desktop management routines
#include "iptraf-ng-compat.h"
+#include "tui/labels.h" +#include "tui/msgboxes.h" +#include "tui/winops.h" + #include "deskman.h"
/* Attribute variables */ diff --git a/src/detstats.c b/src/detstats.c index 25fdcdd..e92031b 100644 --- a/src/detstats.c +++ b/src/detstats.c @@ -9,6 +9,8 @@ detstats.c - the interface statistics module
#include "iptraf-ng-compat.h"
+#include "tui/winops.h" + #include "counters.h" #include "ifaces.h" #include "isdntab.h" diff --git a/src/error.c b/src/error.c index e4167e4..45d8e8c 100644 --- a/src/error.c +++ b/src/error.c @@ -9,8 +9,8 @@ error.c - Error-handling subroutines
#include "iptraf-ng-compat.h"
-#include "error.h" #include "log.h" +#include "tui/msgboxes.h"
extern int daemonized;
diff --git a/src/fltedit.c b/src/fltedit.c index c83b199..cd926f1 100644 --- a/src/fltedit.c +++ b/src/fltedit.c @@ -9,6 +9,11 @@ fltedit.c - the filter editing Facility
#include "iptraf-ng-compat.h"
+#include "tui/labels.h" +#include "tui/menurt.h" +#include "tui/msgboxes.h" +#include "tui/winops.h" + #include "fltdefs.h" #include "fltmgr.h" #include "ipfilter.h" diff --git a/src/fltmgr.c b/src/fltmgr.c index bb93bc1..5771f89 100644 --- a/src/fltmgr.c +++ b/src/fltmgr.c @@ -9,6 +9,13 @@ fltmgr.c - filter list management routines
#include "iptraf-ng-compat.h"
+#include "tui/input.h" +#include "tui/labels.h" +#include "tui/listbox.h" +#include "tui/menurt.h" +#include "tui/msgboxes.h" +#include "tui/winops.h" + #include "attrs.h" #include "deskman.h" #include "dirs.h" diff --git a/src/fltselect.c b/src/fltselect.c index e51fbcf..42b2047 100644 --- a/src/fltselect.c +++ b/src/fltselect.c @@ -10,6 +10,10 @@ fltselect.c - a menu-based module that allows selection of
#include "iptraf-ng-compat.h"
+#include "tui/menurt.h" +#include "tui/msgboxes.h" +#include "tui/winops.h" + #include "addproto.h" #include "dirs.h" #include "fltdefs.h" diff --git a/src/hostmon.c b/src/hostmon.c index e9f3dc0..4f29879 100644 --- a/src/hostmon.c +++ b/src/hostmon.c @@ -10,6 +10,9 @@ Discovers LAN hosts and displays packet statistics for them
#include "iptraf-ng-compat.h"
+#include "tui/labels.h" +#include "tui/winops.h" + #include "dirs.h" #include "deskman.h" #include "fltdefs.h" diff --git a/src/ifstats.c b/src/ifstats.c index 8cb384e..d7a0f75 100644 --- a/src/ifstats.c +++ b/src/ifstats.c @@ -9,6 +9,11 @@ ifstats.c - the interface statistics module
#include "iptraf-ng-compat.h"
+#include "tui/labels.h" +#include "tui/listbox.h" +#include "tui/msgboxes.h" +#include "tui/winops.h" + #include "ifaces.h" #include "isdntab.h" #include "fltdefs.h" diff --git a/src/ipfilter.c b/src/ipfilter.c index 162c997..aa03b3e 100644 --- a/src/ipfilter.c +++ b/src/ipfilter.c @@ -9,6 +9,10 @@ ipfilter.c - user interface and filter function for all IP packets
#include "iptraf-ng-compat.h"
+#include "tui/input.h" +#include "tui/menurt.h" +#include "tui/msgboxes.h" + #include "addproto.h" #include "dirs.h" #include "deskman.h" diff --git a/src/iptraf-ng-compat.h b/src/iptraf-ng-compat.h index ac8b612..a48e09c 100644 --- a/src/iptraf-ng-compat.h +++ b/src/iptraf-ng-compat.h @@ -45,15 +45,6 @@ #include <linux/if.h> #include <linux/if_arp.h>
-/* move it out! */ -#include "tui/labels.h" -#include "tui/listbox.h" -#include "tui/input.h" -#include "tui/menurt.h" -#include "tui/winops.h" -#include "tui/msgboxes.h" -//#include "txbox.h" - #define debug(...) \ do { \ fprintf(stderr, "%s:%s():%d:", \ diff --git a/src/iptraf.c b/src/iptraf.c index 0cf91b9..08ddeb5 100644 --- a/src/iptraf.c +++ b/src/iptraf.c @@ -10,6 +10,9 @@ An IP Network Statistics Utility
#include "iptraf-ng-compat.h"
+#include "tui/menurt.h" +#include "tui/winops.h" + #include "dirs.h" #include "deskman.h" #include "fltdefs.h" diff --git a/src/itrafmon.c b/src/itrafmon.c index ebe053b..4228b31 100644 --- a/src/itrafmon.c +++ b/src/itrafmon.c @@ -9,6 +9,9 @@ itrafmon.c - the IP traffic monitor module
#include "iptraf-ng-compat.h"
+#include "tui/labels.h" +#include "tui/winops.h" + #include "options.h" #include "tcptable.h" #include "othptab.h" diff --git a/src/landesc.c b/src/landesc.c index 38e01f2..4d67ed8 100644 --- a/src/landesc.c +++ b/src/landesc.c @@ -10,6 +10,12 @@ landesc.c - LAN host description management module ***/
#include "iptraf-ng-compat.h" + +#include "tui/input.h" +#include "tui/listbox.h" +#include "tui/msgboxes.h" +#include "tui/menurt.h" + #include "landesc.h" #include "deskman.h" #include "attrs.h" diff --git a/src/log.c b/src/log.c index ebe3c35..dfa2cd9 100644 --- a/src/log.c +++ b/src/log.c @@ -14,6 +14,10 @@ log.c - the iptraf logging facility #include "dirs.h" #include "log.h"
+#include "tui/input.h" +#include "tui/msgboxes.h" +#include "tui/winops.h" + #define TARGET_LOGNAME_MAX 160
int rotate_flag; diff --git a/src/options.c b/src/options.c index b62b9dd..ee693de 100644 --- a/src/options.c +++ b/src/options.c @@ -9,6 +9,11 @@ options.c - implements the configuration section of the utility
#include "iptraf-ng-compat.h"
+#include "tui/input.h" +#include "tui/menurt.h" +#include "tui/msgboxes.h" +#include "tui/winops.h" + #include "serv.h" #include "options.h" #include "deskman.h" diff --git a/src/othptab.c b/src/othptab.c index dbd392c..c73eb39 100644 --- a/src/othptab.c +++ b/src/othptab.c @@ -9,6 +9,8 @@ othptab.c - non-TCP protocol display module
#include "iptraf-ng-compat.h"
+#include "tui/winops.h" + #include "arphdr.h" #include "options.h" #include "tcptable.h" diff --git a/src/pktsize.c b/src/pktsize.c index 7dfcb92..f544d0b 100644 --- a/src/pktsize.c +++ b/src/pktsize.c @@ -9,6 +9,8 @@ pktsize.c - the packet size breakdown facility
#include "iptraf-ng-compat.h"
+#include "tui/winops.h" + #include "attrs.h" #include "dirs.h" #include "fltdefs.h" diff --git a/src/serv.c b/src/serv.c index 8fda3f5..e5584bb 100644 --- a/src/serv.c +++ b/src/serv.c @@ -9,6 +9,11 @@ serv.c - TCP/UDP port statistics module
#include "iptraf-ng-compat.h"
+#include "tui/input.h" +#include "tui/labels.h" +#include "tui/listbox.h" +#include "tui/msgboxes.h" + #include "dirs.h" #include "deskman.h" #include "isdntab.h" diff --git a/src/tcptable.c b/src/tcptable.c index bcc24ff..e6df461 100644 --- a/src/tcptable.c +++ b/src/tcptable.c @@ -9,6 +9,8 @@ tcptable.c - table manipulation routines for the IP monitor
#include "iptraf-ng-compat.h"
+#include "tui/winops.h" + #include "options.h" #include "tcptable.h" #include "deskman.h"
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- src/tui/input.c | 5 ++--- src/tui/listbox.c | 3 +-- src/tui/menurt.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/tui/input.c b/src/tui/input.c index ba4a0cf..cd9a5dc 100644 --- a/src/tui/input.c +++ b/src/tui/input.c @@ -33,7 +33,7 @@ void tx_addfield(struct FIELDLIST *list, unsigned int len, unsigned int y, struct FIELD *newfield; unsigned int i;
- newfield = malloc(sizeof(struct FIELD)); + newfield = xmalloc(sizeof(struct FIELD));
if (list->list == NULL) { list->list = newfield; @@ -50,8 +50,7 @@ void tx_addfield(struct FIELDLIST *list, unsigned int len, unsigned int y, newfield->ypos = y; newfield->len = len; newfield->tlen = strlen(initstr); - newfield->buf = malloc(len + 1); - memset(newfield->buf, 0, len + 1); + newfield->buf = xmallocz(len + 1); strncpy(newfield->buf, initstr, len);
if (newfield->tlen > (len)) diff --git a/src/tui/listbox.c b/src/tui/listbox.c index a867d95..09e2d3a 100644 --- a/src/tui/listbox.c +++ b/src/tui/listbox.c @@ -45,8 +45,7 @@ void tx_add_list_entry(struct scroll_list *list, char *node, char *text) { struct textlisttype *ptmp;
- ptmp = malloc(sizeof(struct textlisttype)); - memset(ptmp, 0, sizeof(struct textlisttype)); + ptmp = xmallocz(sizeof(struct textlisttype));
strncpy(ptmp->text, text, MAX_TEXT_LENGTH); ptmp->nodeptr = node; diff --git a/src/tui/menurt.c b/src/tui/menurt.c index aa7f654..8670bb0 100644 --- a/src/tui/menurt.c +++ b/src/tui/menurt.c @@ -56,7 +56,7 @@ void tx_additem(struct MENU *menu, char *item, char *desc) if (menu->itemcount >= 25) return;
- tnode = malloc(sizeof(struct ITEM)); + tnode = xmalloc(sizeof(struct ITEM));
if (item != NULL) { strcpy(tnode->option, item);
Signed-off-by: Vitezslav Samel vitezslav@samel.cz --- src/tui/input.c | 1 + src/tui/labels.c | 1 + src/tui/listbox.c | 1 + src/tui/menurt.c | 1 + src/tui/msgboxes.c | 1 + src/tui/winops.c | 1 + 6 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/tui/input.c b/src/tui/input.c index cd9a5dc..1dc129f 100644 --- a/src/tui/input.c +++ b/src/tui/input.c @@ -1,4 +1,5 @@ /* For terms of usage/redistribution/modification see the LICENSE file */ +/* For authors and contributors see the AUTHORS file */
/***
diff --git a/src/tui/labels.c b/src/tui/labels.c index 8ce04b6..e4e11fb 100644 --- a/src/tui/labels.c +++ b/src/tui/labels.c @@ -1,4 +1,5 @@ /* For terms of usage/redistribution/modification see the LICENSE file */ +/* For authors and contributors see the AUTHORS file */
/* * labels.c - some common keyhelp printing routines for the iptraf diff --git a/src/tui/listbox.c b/src/tui/listbox.c index 09e2d3a..3574626 100644 --- a/src/tui/listbox.c +++ b/src/tui/listbox.c @@ -1,4 +1,5 @@ /* For terms of usage/redistribution/modification see the LICENSE file */ +/* For authors and contributors see the AUTHORS file */
/* * listbox.c - scrollable listbox management module diff --git a/src/tui/menurt.c b/src/tui/menurt.c index 8670bb0..3d118cf 100644 --- a/src/tui/menurt.c +++ b/src/tui/menurt.c @@ -1,4 +1,5 @@ /* For terms of usage/redistribution/modification see the LICENSE file */ +/* For authors and contributors see the AUTHORS file */
/***
diff --git a/src/tui/msgboxes.c b/src/tui/msgboxes.c index 9b17bc4..ee7ebdf 100644 --- a/src/tui/msgboxes.c +++ b/src/tui/msgboxes.c @@ -1,4 +1,5 @@ /* For terms of usage/redistribution/modification see the LICENSE file */ +/* For authors and contributors see the AUTHORS file */
/* * msgboxes.c - message and error box display functions diff --git a/src/tui/winops.c b/src/tui/winops.c index 363611a..73a3899 100644 --- a/src/tui/winops.c +++ b/src/tui/winops.c @@ -1,4 +1,5 @@ /* For terms of usage/redistribution/modification see the LICENSE file */ +/* For authors and contributors see the AUTHORS file */
/***
Vitezslav Samel vitezslav@samel.cz writes:
Vitezslav Samel (6): merge tui/tui.h into tui/msgboxes.h use iptraf-ng-compat.h for system headers in src/tui/* merge src/tui/txbox.c into src/tui/winops.c remove inclusion of non-system headers from iptraf-ng-compat.h use xmalloc[z]() instead of plain malloc() add info about authorship into tui/*.c
Makefile | 2 -- src/bar.c | 2 ++ src/deskman.c | 4 ++++ src/detstats.c | 3 ++- src/error.c | 3 +-- src/fltedit.c | 6 +++++- src/fltmgr.c | 8 +++++++- src/fltselect.c | 5 ++++- src/hostmon.c | 3 +++ src/ifstats.c | 6 +++++- src/ipfilter.c | 5 ++++- src/iptraf-ng-compat.h | 9 --------- src/iptraf.c | 3 +++ src/itrafmon.c | 3 +++ src/landesc.c | 7 ++++++- src/log.c | 5 ++++- src/options.c | 6 +++++- src/othptab.c | 2 ++ src/pktsize.c | 2 ++ src/serv.c | 6 +++++- src/tcptable.c | 2 ++ src/tui/input.c | 11 +++++------ src/tui/input.h | 2 -- src/tui/labels.c | 5 +++-- src/tui/labels.h | 2 -- src/tui/listbox.c | 11 ++++------- src/tui/listbox.h | 2 -- src/tui/menurt.c | 10 ++++------ src/tui/msgboxes.c | 5 +++-- src/tui/msgboxes.h | 2 ++ src/tui/tui.h | 9 --------- src/tui/txbox.c | 39 --------------------------------------- src/tui/winops.c | 38 ++++++++++++++++++++++++++++++++++---- src/tui/winops.h | 1 - 34 files changed, 124 insertions(+), 105 deletions(-) delete mode 100644 src/tui/tui.h delete mode 100644 src/tui/txbox.c
applied.
iptraf-ng@lists.fedorahosted.org