File: makeh

package info (click to toggle)
libdevel-cover-perl 1.51-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,036 kB
  • sloc: perl: 10,861; sh: 687; makefile: 7
file content (35 lines) | stat: -rwxr-xr-x 784 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl

# Copyright 2001-2025, Paul Johnson (paul@pjcj.net)

# This software is free.  It is licensed under the same terms as Perl itself.

# The latest version of this software should be available from my homepage:
# https://pjcj.net

use strict;
use warnings;

my $Command = {
  strip_criterion => sub {
    my ($command, $criterion, $file) = @_;
    my $t;
    local ($^I, @ARGV) = (".bak", $file);
    while (<>) {
      $t = index($_, "$criterion   code") - 3 if !defined $t || $t < 0;
      substr $_, $t, 7, ""
        if /^line  err   stmt/ .. /^--------/
        and $t > -1
        and length > $t;
      print;
    }
  }
};

sub main {
  my ($command) = @ARGV;
  die "No such command: $command" unless $Command->{$command};
  $Command->{$command}->(@ARGV)
}

main