1#! /usr/bin/perl 2# $OpenBSD: reconstitute,v 1.1 2005/09/06 15:33:21 espie Exp $ 3 4# Written by Marc Espie, 2005 5# Public domain 6 7# This simple perl script puts back line numbers everywhere. 8# This is suitable for testing synchronization, as we don't really 9# care how many synchronization marks we emit, as long as the line 10# numbers match 11 12use File::Basename; 13 14my ($lineno, $file) = (-1, "<unknown>"); 15 16while (<>) { 17 if (m/^#line\s+(\d+)\s+\"(.*)\"/) { 18 ($lineno, $file) = ($1, $2); 19 $file=basename($file); 20 } else { 21 print "$file:$lineno:$_"; 22 $lineno++; 23 } 24} 25