<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">use File::Basename;

$ARGV[0] =~ /([^\/]*)$/;
my $pkg = $1;

while(&lt;$ARGV[0]/man/*.Rd&gt;){ &amp;do_one; }
if(-d  "$ARGV[0]/man/unix") {
    while(&lt;$ARGV[0]/man/unix/*.Rd&gt;){ &amp;do_one; }
}

sub do_one {
    my $file = basename($_, (".Rd", ".rd"));

    open(rdfile, "&lt;$_");
    undef $text;

    while(&lt;rdfile&gt;){
	$text .= $_;
    }
    close rdfile;

    $text =~ /\\name\{\s*([^\}]+)\s*\}/s;
    my $rdname = $1;
    $rdname =~ s/\n/ /sg;

    $text =~ /\\title\{\s*([^\}]+)\s*\}/s;
    my $rdtitle = $1;
    $rdtitle =~ s/\n/ /sg;

    undef @aliases;
    while($text =~ s/\\alias\{\s*(.*)\s*\}//){
	$alias = $1;
	$alias =~ s/\\%/%/g;
	push @aliases, $alias;
    }

    undef @keywords;
    while($text =~ s/\\keyword\{\s*(.*)\s*\}//){
	$keyword = $1;
	$keyword =~ s/\\%/%/g;
	push @keywords, $keyword;
    }

    $, = " ";
    print "Entry: $rdname\n";
    print "Aliases: @aliases\n";
    print "Keywords: @keywords\n";
    print "Description: $rdtitle\n";
    print "URL: ../../../library/$pkg/html/$file.html\n\n";
}

</pre></body></html>