#!/usr/bin/perl -w
+use strict;
use Cwd;
my $comm = shift or USAGE();
+my @files;
if ($comm eq "-f") {
- if (!@ARGV) {
- getfiles();
- @files = @CFILES;
+ if (@ARGV) {
+ @files = @ARGV;
+ }
+ else {
+ @files = getfiles();
}
for my $file (@files) {
- local(*FH, $/); open(FH,"$BASE/$file") or die $!;
+ local(*FH, $/); open(FH,"< $file") or die $!;
my $data = <FH>; close(FH);
while( $data =~ m/FIXME:(.*?)\*\//sg ) {
printf("%10.10s:%5d %s\n", $file, ptol($data, pos($data)), $1);
USAGE() if !@ARGV;
my $file = shift;
getfiles();
- local(*FH, $/); open(FH, "$BASE/$file") or die $!;
+ local(*FH, $/); open(FH, "< $file") or die $!;
my $data = <FH>; close(FH);
$data =~ s/^(=item)/\n$1/mg;
$data =~ s/^(=cut)/\n~~~~~~~~\n\n$1\n\n/mg;
}
sub getfiles {
- $BASE=cwd;
+ my $BASE=cwd;
local(*FH);
open(FH,"$BASE/MANIFEST") or die "Cannot open MANIFEST file: $!\n";
my @MANIFEST = <FH>;
chomp(@MANIFEST);
- @CFILES = grep { m/\.c\s*$/ } @MANIFEST;
+ return grep { m/\.(c|im)\s*$/ } @MANIFEST;
}
# string position to line number in string