From: Pablo Neira Ayuso <[email protected]>

With this patch, we don't including e1_input if it's empty

[...]
    timeslot 7
     phys_chan_config TCH/F
     hopping enabled 0
e1_input <----------------- empty, it should not show up.
msc
[...]
---
 openbsc/src/libabis/e1_input_vty.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/openbsc/src/libabis/e1_input_vty.c 
b/openbsc/src/libabis/e1_input_vty.c
index 7dbf17a..af984bc 100644
--- a/openbsc/src/libabis/e1_input_vty.c
+++ b/openbsc/src/libabis/e1_input_vty.c
@@ -19,6 +19,7 @@
 
 #include <stdlib.h>
 #include <unistd.h>
+#include <stdbool.h>
 
 #include <osmocom/vty/command.h>
 #include <osmocom/vty/buffer.h>
@@ -75,10 +76,13 @@ DEFUN(cfg_e1inp, cfg_e1inp_cmd,
 static int e1inp_config_write(struct vty *vty)
 {
        struct e1inp_line *line;
-
-       vty_out(vty, "e1_input%s", VTY_NEWLINE);
+       bool heading = false;
 
        llist_for_each_entry(line, &e1inp_line_list, list) {
+               if (!heading) {
+                       vty_out(vty, "e1_input%s", VTY_NEWLINE);
+                       heading = true;
+               }
                vty_out(vty, " e1_line %u driver %s%s", line->num,
                        line->driver->name, VTY_NEWLINE);
        }
-- 
1.7.2.3


Reply via email to