home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
2.x
/
plum2_28_2.lzh
/
support
/
modinfo
< prev
next >
Wrap
Text File
|
1998-10-15
|
2KB
|
71 lines
#!/bin/perl -w
# $Id: modinfo,v 2.8 1998/07/31 09:39:13 hasegawa Exp $
# copyright (c)1997-1998 pupu_j <hasegawa@agusa.nuie.nagoya-u.ac.jp>
&main(@ARGV);
sub main {
local(@args) = @_;
local($dir);
if (!@args) {
&usage();
exit(1);
}
$dir = shift(@args);
&traverse("$dir/module", '');
}
sub traverse {
local($base, $dir) = @_;
local(@files, $file);
opendir(DIR, "$base/$dir") || die;
@files = readdir(DIR);
closedir(DIR);
foreach $file (sort(@files)) {
next if $file =~ /^\./;
next if $file eq 'SCCS';
next if $file eq 'RCS';
next if $file eq 'CVS';
next if $file =~ /\,v$/;
if (-d "$base/$dir/$file") {
if ($dir) {
&traverse($base, "$dir/$file");
} else {
&traverse($base, $file);
}
} elsif ($file =~ /\.plm/) {
if ($dir) {
print "<DT><A HREF=\"../module/$dir/$file\">$dir/$file\n";
print "</A></DT>";
&info("$base/$dir/$file", "$dir/$file");
} else {
print "<DT><A HREF=\"../module/$file\">$file\n";
print "</A></DT>";
&info("$base/$file", $file);
}
}
}
}
sub info {
local($file, $name) = @_;
if (open(FILE, $file)) {
while (defined($line = <FILE>)) {
$line =~ tr/\r\n//d;
last if $line eq '__END__';
}
while (defined($line = <FILE>)) {
$line =~ tr/\r\n//d;
if ($line =~ /^\s*$name\s*\-\s*(.*)$/) {
print "<DD> $1\n";
print "</DD>\n";
}
}
close(FILE);
}
}
sub usage {
print 'usage: perl modinfo <plum-top-directory>', "\n";
}