18 unless ( $filename =~ m/tags$/ ) {
20 my $file = IO::File->new("<$filename") or die "can't open $filename";
25 while (my $line = <$file>) {
26 # The sentence after the TODO ~should start with a letter.
27 # This ensures we skip the TODO's like the one below.
28 if ($line =~ /TODO(|:)\s+[A-Za-z]/i) {
36 if (scalar(keys %todos)) {
37 foreach my $key (sort { $a <=> $b } keys %todos) {
38 my $line = $todos{$key};
39 if ($line =~ m/TODO(.*)$/i) {
41 $comment =~ s/^(:|\s)+//;
42 $comment =~ s/\*\/\s*$//;
43 # Print as: foobar.c(10) The stuff to be done
44 printf( "%-30s %s\n", "$filename($key)", $comment );
54 # Scan all the files in a directory.
55 # Then repeat the process for all the subdirectories.
61 my $dir = IO::Dir->new($dirname) or die "can't open $dirname : $!";
62 my @files = $dir->read();
65 my @source_files = grep { -T "$dirname/$_" } @files;
67 foreach my $filename ( sort @source_files ) {
68 my $path = "$dirname/$filename";
73 # Repeat the process for all subdirectories.
74 foreach my $filename ( sort @files ) {
75 my $path = "$dirname/$filename";
76 if ( ( -d $path ) and ( $filename !~ m/^\./ ) ) {
77 scan_directory( $path );
85 # We are given a set of file names on the command line.
86 foreach my $file (grep { -T } @ARGV) {
90 # No parameters, scan the current directory and
92 scan_directory( '.' );
94 print $count, " TODOs to go\n";