summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-10-27 11:55:30 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-10-27 11:55:30 +0100
commitbd031f809422ea88b9619924911aa5112f95b6b3 (patch)
tree3ba9f42285a722c54989e13f4b3140204fa908ea
parent7b24d95cffcf889c59b5e6706cddb53b26b6aa69 (diff)
flowtop: Use bool for show_src option
Use boolean false/true for show_src option value. This makes the handling of on/off parameters more consistent. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--flowtop.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/flowtop.c b/flowtop.c
index 0777a34..50ceccb 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -106,11 +106,12 @@ struct sysctl_params_ctx {
static volatile bool is_flow_collecting;
static volatile sig_atomic_t sigint = 0;
-static int what = INCLUDE_IPV4 | INCLUDE_IPV6 | INCLUDE_TCP, show_src = 0;
+static int what = INCLUDE_IPV4 | INCLUDE_IPV6 | INCLUDE_TCP;
static struct flow_list flow_list;
static struct sysctl_params_ctx sysctl = { -1, -1 };
static unsigned int interval = 1;
+static bool show_src = false;
static bool resolve_dns = true;
static bool resolve_geoip = true;
@@ -1113,7 +1114,7 @@ static void presenter_screen_update(WINDOW *screen, struct flow_list *fl,
presenter_screen_do_line(screen, n, &line);
line++;
- maxy -= (2 + 1 * show_src);
+ maxy -= (2 + (show_src ? 1 : 0));
}
mvwprintw(screen, 1, 2,
@@ -1534,7 +1535,7 @@ int main(int argc, char **argv)
what_cmd |= INCLUDE_SCTP;
break;
case 's':
- show_src = 1;
+ show_src = true;
break;
case 'u':
update_geoip();