File: indent.pl

package info (click to toggle)
notion 4.0.2%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,676 kB
  • sloc: ansic: 47,508; sh: 2,096; makefile: 603; perl: 270
file content (20 lines) | stat: -rwxr-xr-x 399 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl

# Take the output of addr2line.sh, select only the 'Enter' calls and indent
# them to show the call hierarchy. The result can be browsed for example with
# vim and ':set foldmethod=indent'.

use strict;

my $currentIndent = 4;

while (<STDIN>) {
  if ($_ =~ /^Enter/) {
    print "\t" x $currentIndent ;
    print "$_";

    $currentIndent++;
  } else {
    $currentIndent--;
  }
}