Revisão | 3996e01a7f79ee9525521ab22b587dc5af2b2bb7 (tree) |
---|---|
Hora | 2022-04-10 02:51:29 |
Autor | dyknon <dyknon@user...> |
Commiter | dyknon |
better padding + fix cidr handling
@@ -328,8 +328,7 @@ sub get_pad_ascii_formatter{ | ||
328 | 328 | my %len_part = $asciilen{$type}->%*; |
329 | 329 | my $len = @vals |
330 | 330 | + (sum0 map{$_->{len}}@vals) |
331 | - + $len_part{addr} | |
332 | - + 1; | |
331 | + + $len_part{addr}; | |
333 | 332 | if($cidr){ |
334 | 333 | $len += $len_part{cidrnm}+1; |
335 | 334 | }else{ |
@@ -337,10 +336,11 @@ sub get_pad_ascii_formatter{ | ||
337 | 336 | } |
338 | 337 | my $inner = get_ascii_formatter($type, $cidr, @vals); |
339 | 338 | sub{ |
340 | - my $line = $inner->(@_); | |
341 | - my $padn = $len - length $line; | |
342 | - die if($padn < 0); | |
343 | - "$line\t" . " "x$padn; | |
339 | + map{ | |
340 | + my $padn = $len - length $_; | |
341 | + die if($padn < 0); | |
342 | + "$_\t" . " "x$padn; | |
343 | + }$inner->(@_); | |
344 | 344 | }; |
345 | 345 | } |
346 | 346 | sub get_binary_formatter{ |
@@ -486,7 +486,7 @@ if($op eq "generate"){ | ||
486 | 486 | } |
487 | 487 | |
488 | 488 | my @formats = keys %formatters; |
489 | - @formats = grep{!/^cidr/}@formats if($cidr); | |
489 | + @formats = grep{!/^cidr/}@formats if(!$cidr); | |
490 | 490 | |
491 | 491 | if($address_sort){ |
492 | 492 | for(@formats){ |