diff options
Diffstat (limited to '6/main.pl')
-rw-r--r-- | 6/main.pl | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -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). |