mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 02:01:55 +00:00
d1c8f22bec
It reduces clutter in root and also avoid collision with doc dir on case-insensitive filesystems when name back to Doc.
47 lines
1.1 KiB
Perl
Executable File
47 lines
1.1 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
$srcdir = $ARGV[0];
|
|
|
|
open(OUT, ">prog.sgml") || die "Cannot create output file";
|
|
process("", "doc/prog-root");
|
|
close OUT;
|
|
exit 0;
|
|
|
|
sub include {
|
|
my $f = shift @_;
|
|
open(IN, "$srcdir/$f") || die "Unable to find $f";
|
|
while (<IN>) {
|
|
print OUT;
|
|
}
|
|
close IN;
|
|
}
|
|
|
|
sub process {
|
|
my $dir = shift @_;
|
|
my $doc = "$dir/" . shift @_;
|
|
print "$doc\n";
|
|
open(IN, "$srcdir/$doc") || die "Unable to read $doc";
|
|
my @docfile = <IN>;
|
|
close IN;
|
|
foreach $_ (@docfile) {
|
|
chomp;
|
|
/^#/ && next;
|
|
/^([A-Z]+)\s*(.*)/ || die "Parse error: $_";
|
|
$cmd = $1;
|
|
$arg = $2;
|
|
if ($cmd eq "C") { process("$dir/$arg", "progdoc"); }
|
|
elsif ($cmd eq "H") {
|
|
push @stack, "H";
|
|
print OUT "<chapt>$arg\n";
|
|
} elsif ($cmd eq "S") {
|
|
print " $arg\n";
|
|
open(DOC, "cd $srcdir/$dir ; $srcdir/doc/kernel-doc -bird $arg |") || die "Unable to start kernel-doc";
|
|
while (<DOC>) { print OUT; }
|
|
close DOC;
|
|
} elsif ($cmd eq "D") {
|
|
print " $arg\n";
|
|
include("$dir/$arg");
|
|
} else { die "Unknown command: $cmd"; }
|
|
}
|
|
}
|