Add 'docs' and 'doxygen' targets to top-level Makefile.
[openocd.git] / tools / logger.pl
1 #!/usr/bin/perl
2 # logger.pl: masks long meaningless output with pretty lines of dots
3 # Details: 1) reads lines from STDIN and echos them on STDOUT,
4 # 2) print a '.' to STDERR every $N lines.
5 # 3) print a newline after a sequence of $C dots
6
7 use strict;
8 use warnings;
9
10 # make sure all output gets displayed immediately
11 $| = 1;
12
13 # TODO: add -n and -c options w/ zero checks)
14 # line and column limits
15 my $N = 10;
16 my $C = 72;
17
18 # current line and column counters
19 my $n = 0;
20 my $c = 0;
21
22 # read all lines from STDIN
23 while (<STDIN>)
24 {
25 # echo line to output
26 print STDOUT $_;
27 # only display progress every Nth step
28 next unless ++$n % $N;
29 print STDERR ".";
30 # wrap at column C to provide fixed-width rows of dots
31 print STDERR "\n" unless ++$c % $C;
32 }
33
34 print STDERR "\n"