1#!/usr/bin/env perl 2# 3# This program works as a filter that reads from stdin, copies to 4# stdout *and* creates an error file that can be read by vim. 5# 6# This program has only been tested on SGI, Irix5.3. 7# 8# Written by Ives Aerts in 1996. This little program is not guaranteed 9# to do (or not do) anything at all and can be freely used for 10# whatever purpose you can think of. 11 12$args = @ARGV; 13 14unless ($args == 1) { 15 die("Usage: vimccparse <output filename>\n"); 16} 17 18$filename = @ARGV[0]; 19open (OUT, ">$filename") || die ("Can't open file: \"$filename\""); 20 21while (<STDIN>) { 22 print; 23 if ( (/"(.*)", line (\d+): (e)rror\((\d+)\):/) 24 || (/"(.*)", line (\d+): (w)arning\((\d+)\):/) ) { 25 $file=$1; 26 $line=$2; 27 $errortype="\u$3"; 28 $errornr=$4; 29 chop($errormsg=<STDIN>); 30 $errormsg =~ s/^\s*//; 31 $sourceline=<STDIN>; 32 $column=index(<STDIN>, "^") - 1; 33 34 print OUT "$file>$line:$column:$errortype:$errornr:$errormsg\n"; 35 } 36} 37 38close(OUT); 39exit(0); 40