aboutsummaryrefslogtreecommitdiff
path: root/contrib/shunit2-2.0.3/bin/extractDocs.pl
blob: a8035261d3e6ec7469b2e9fbc06be3832dce9aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/perl
# $Id$

if(@ARGV != 1) {
   print "usage: $0 sourceFile\n";
   exit;
}

$sourceFile = $ARGV[0];

#
# read in the source file
#
$rslt = open(FILE, $sourceFile)
  || die "could not open file ($sourceFile)";

$inComment = 0;
while(<FILE>) {
  next if /^[^#]/;
  s/^# //;
  s/^#//;

  if(/^\/\*\*/) {
    $inComment = 1;
    next;
  }
  if(/\*\/$/) {
    $inComment = 0;
    next;
  }

  if ($inComment == 1) { print $_ };
  if ($inComment == 0 && /\/\/\*/) {
    @line = split /\/\/\*/, $_, 2;
    $line[1] =~ s/^ //;
    print $line[1];
  }
}

close(FILE);