aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_client_vty.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-05-31 17:52:08 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-05-31 17:55:45 +0200
commitbac0c98d22b9db20b4def3976c06618e190218de (patch)
treed913d7dda0a45024d2229434bf16e8cba5b736b5 /src/osmo_client_vty.c
parent3b9b38ca688b422894470618e8f017ea74dee0e1 (diff)
osmo-pcap-client: Do not print the strings if they are NULL
this makes glibc add the (null) for us, but we don't want that as we would attempt to compile a filter or open a device with that.
Diffstat (limited to 'src/osmo_client_vty.c')
-rw-r--r--src/osmo_client_vty.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/osmo_client_vty.c b/src/osmo_client_vty.c
index 3af4dfc..056ab18 100644
--- a/src/osmo_client_vty.c
+++ b/src/osmo_client_vty.c
@@ -49,16 +49,24 @@ DEFUN(cfg_client,
static int config_write_client(struct vty *vty)
{
vty_out(vty, "client%s", VTY_NEWLINE);
- vty_out(vty, " pcap device %s%s",
- pcap_client->device, VTY_NEWLINE);
- vty_out(vty, " pcap filter %s%s",
- pcap_client->filter_string, VTY_NEWLINE);
+
+ if (pcap_client->device)
+ vty_out(vty, " pcap device %s%s",
+ pcap_client->device, VTY_NEWLINE);
+
+ if (pcap_client->filter_string)
+ vty_out(vty, " pcap filter %s%s",
+ pcap_client->filter_string, VTY_NEWLINE);
vty_out(vty, " pcap detect-loop %d%s",
pcap_client->filter_itself, VTY_NEWLINE);
- vty_out(vty, " server ip %s%s",
- pcap_client->srv_ip, VTY_NEWLINE);
- vty_out(vty, " server port %d%s",
- pcap_client->srv_port, VTY_NEWLINE);
+
+ if (pcap_client->srv_ip)
+ vty_out(vty, " server ip %s%s",
+ pcap_client->srv_ip, VTY_NEWLINE);
+
+ if (pcap_client->srv_port > 0)
+ vty_out(vty, " server port %d%s",
+ pcap_client->srv_port, VTY_NEWLINE);
return CMD_SUCCESS;
}