Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 81 lines (66 sloc) 1.522 kb
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
1 #!/usr/bin/perl -w
d75a4e1 add .perl files to the t94kwalitee struct tests and fix the non strict
Tony Cook authored
2 use strict;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
3
4 use Cwd;
5
6 # doco.perl - 24 Jan 18:09:40 EST 2001
7 # Addi - (addi@umich.edu)
8 #
9 # Extract documentation and help from the source files
10 #
11 # -f <files> list FIXME comments for files
12 # -f list FIXME comments for all files
13 # -d <file> list pod comments from file
14
15 my $comm = shift or USAGE();
16
d75a4e1 add .perl files to the t94kwalitee struct tests and fix the non strict
Tony Cook authored
17 my @files;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
18 if ($comm eq "-f") {
d75a4e1 add .perl files to the t94kwalitee struct tests and fix the non strict
Tony Cook authored
19 if (@ARGV) {
20 @files = @ARGV;
21 }
22 else {
23 @files = getfiles();
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
24 }
25
26 for my $file (@files) {
d75a4e1 add .perl files to the t94kwalitee struct tests and fix the non strict
Tony Cook authored
27 local(*FH, $/); open(FH,"< $file") or die $!;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
28 my $data = <FH>; close(FH);
29 while( $data =~ m/FIXME:(.*?)\*\//sg ) {
30 printf("%10.10s:%5d %s\n", $file, ptol($data, pos($data)), $1);
31 }
32 }
33 exit(0);
34 }
35
36 if ($comm eq "-d") {
37 USAGE() if !@ARGV;
38 my $file = shift;
39 getfiles();
d75a4e1 add .perl files to the t94kwalitee struct tests and fix the non strict
Tony Cook authored
40 local(*FH, $/); open(FH, "< $file") or die $!;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
41 my $data = <FH>; close(FH);
42 $data =~ s/^(=item)/\n$1/mg;
43 $data =~ s/^(=cut)/\n~~~~~~~~\n\n$1\n\n/mg;
44 print "\n";
45 open(FH,"|pod2text ") or die "Cannot run pod2text: $!\n";
46 print FH $data;
47 close(FH);
48 exit(2);
49 }
50
51
52 sub USAGE {
53
54 print<<'EOF';
55 doco.perl [-f files| stuff]
56
57 -f <files> list FIXME comments for files.
58 -f list FIXME comments for all files.
59
60 EOF
61 exit;
62 }
63
64 sub getfiles {
d75a4e1 add .perl files to the t94kwalitee struct tests and fix the non strict
Tony Cook authored
65 my $BASE=cwd;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
66 local(*FH);
67 open(FH,"$BASE/MANIFEST") or die "Cannot open MANIFEST file: $!\n";
68 my @MANIFEST = <FH>;
69 chomp(@MANIFEST);
d75a4e1 add .perl files to the t94kwalitee struct tests and fix the non strict
Tony Cook authored
70 return grep { m/\.(c|im)\s*$/ } @MANIFEST;
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
71 }
72
73 # string position to line number in string
74
75 sub ptol {
76 my ($str, $pos) = @_;
77 my $lcnt=1;
78 $lcnt++ while(substr($str,0,$pos)=~m/\n/g);
79 $lcnt;
80 }
Something went wrong with that request. Please try again.