summaryrefslogtreecommitdiff
path: root/6/main.pl
diff options
context:
space:
mode:
Diffstat (limited to '6/main.pl')
-rw-r--r--6/main.pl21
1 files changed, 11 insertions, 10 deletions
diff --git a/6/main.pl b/6/main.pl
index cd9f807..d3dd76d 100644
--- a/6/main.pl
+++ b/6/main.pl
@@ -1,16 +1,17 @@
:- use_module(bgp).
-% :- use_module(tnet).
-% H=knot,
-% bgp:bgp_connections(H, BgpConnections),
-% maplist(bgp:to_dict(), BgpConnections, BgpConnectionDicts),
-% yaml_write(current_output, _{bgp_connections:BgpConnectionDicts}).
+print_warnings([]).
+print_warnings([W|Ws]) :- format("Warning: ~w~n", [W]), print_warnings(Ws).
-warnings :-
- bgp:warning(Ws),
- writeln("Warnings: ~w", [length(Ws)]).
+print_warnings :-
+ findall(W, bgp:warning(W), Ws),
+ length(Ws, L),
+ ( L > 0
+ ->format("Found ~w warning(s):~n", [L]),
+ print_warnings(Ws)
+ ; format("No warnings!~n")
+ ).
main :-
bgp:bird_config(BirdDict),
- yaml_write(current_output, BirdDict),
- true.
+ yaml_write(current_output, BirdDict).