Permalink
Browse files

Add make helper script.

Repository of little jobs to be called from the Makefile.
  • Loading branch information...
pjcj committed Aug 9, 2009
1 parent d7c4646 commit 447733cabd0e13c956ed3680d9bd422a15f0223d
Showing with 37 additions and 0 deletions.
  1. +37 −0 makeh
View
37 makeh
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+# Copyright 2001-2009, Paul Johnson (pjcj@cpan.org)
+
+# 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:
+# http://www.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" if !defined $t || $t < 0;
+ substr $_, $t, 7, ""
+ if /^line err stmt/ .. /^--------/ and length > $t;
+ print
+ }
+ },
+};
+
+sub main
+{
+ my ($command) = @ARGV;
+ die "No such command: $command" unless $Command->{$command};
+ $Command->{$command}->(@ARGV)
+}
+
+main

0 comments on commit 447733c

Please sign in to comment.