Commit ab642d48 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Correct case sensitivity in make mandocs

From: Michael Still <mikal@stillhq.com>

The attached patch corrects case sensitivity in the mandocs make target.
XML is case insensitive, and a bunch of the kernel-doc assumes this.  The
makeman and splitman scripts incorrectly cared about case.  This patch also
updates the Docbook DTD version which the script generates.
parent aa9a90bf
...@@ -12,7 +12,7 @@ use strict; ...@@ -12,7 +12,7 @@ use strict;
## $3 -- the filename which contained the sgmldoc output ## $3 -- the filename which contained the sgmldoc output
## (I need this so I know which manpages to convert) ## (I need this so I know which manpages to convert)
my($LISTING, $GENERATED, $INPUT, $OUTPUT, $front, $mode, $filename); my($LISTING, $GENERATED, $INPUT, $OUTPUT, $front, $mode, $filename, $tmpdir);
if($ARGV[0] eq ""){ if($ARGV[0] eq ""){
die "Usage: makeman [convert | install] <dir> <file>\n"; die "Usage: makeman [convert | install] <dir> <file>\n";
...@@ -22,6 +22,13 @@ if( ! -d "$ARGV[1]" ){ ...@@ -22,6 +22,13 @@ if( ! -d "$ARGV[1]" ){
die "Output directory \"$ARGV[1]\" does not exist\n"; die "Output directory \"$ARGV[1]\" does not exist\n";
} }
if($ENV{"TMPDIR"} ne ""){
$tmpdir = $ENV{"TMPDIR"};
}
else{
$tmpdir = "/tmp";
}
if($ARGV[0] eq "convert"){ if($ARGV[0] eq "convert"){
open LISTING, "grep \"<refentrytitle>\" $ARGV[2] |"; open LISTING, "grep \"<refentrytitle>\" $ARGV[2] |";
while(<LISTING>){ while(<LISTING>){
...@@ -40,29 +47,38 @@ if($ARGV[0] eq "convert"){ ...@@ -40,29 +47,38 @@ if($ARGV[0] eq "convert"){
open INPUT, "< $ARGV[1]/$filename.sgml"; open INPUT, "< $ARGV[1]/$filename.sgml";
$front = ""; $front = "";
$mode = 0; $mode = 0;
while(<INPUT>){
if(/.*ENDFRONTTAG.*/){
$mode = 0;
}
# The modes used here are:
# mode = 0
# <!-- BEGINFRONTTAG -->
# <!-- <bookinfo> mode = 1
# <!-- <legalnotice> mode = 2
# <!-- ...GPL or whatever...
# <!-- </legalnotice> mode = 4
# <!-- </bookinfo> mode = 3
# <!-- ENDFRONTTAG -->
#
# ...doco...
# I know that some of the if statements in this while loop are in a funny
# order, but that is deliberate...
while(<INPUT>){
if($mode > 0){ if($mode > 0){
s/<!-- //; s/<!-- //;
s/ -->//; s/ -->//;
s/<bookinfo>//; s/<docinfo>//i;
s/<\/bookinfo>//; s<\/docinfo>//i;
s/<docinfo>//; s/^[ \t]*//i;
s<\/docinfo>//;
s/^[ \t]*//;
} }
if($mode == 2){ if($mode == 2){
if(/<para>/){ if(/<para>/i){
} }
elsif(/<\/para>/){ elsif(/<\/para>/i){
$front = "$front.\\\" \n"; $front = "$front.\\\" \n";
} }
elsif(/<\/legalnotice>/){ elsif(/<\/legalnotice>/i){
$mode = 1; $mode = 4;
} }
elsif(/^[ \t]*$/){ elsif(/^[ \t]*$/){
} }
...@@ -72,69 +88,79 @@ if($ARGV[0] eq "convert"){ ...@@ -72,69 +88,79 @@ if($ARGV[0] eq "convert"){
} }
if($mode == 1){ if($mode == 1){
if(/<title>(.*)<\/title>/){ if(/<title>(.*)<\/title>/i){
$front = "$front.\\\" This documentation was generated from the book titled \"$1\", which is part of the Linux kernel source.\n.\\\" \n"; $front = "$front.\\\" This documentation was generated from the book titled \"$1\", which is part of the Linux kernel source.\n.\\\" \n";
} }
elsif(/<legalnotice>/){ elsif(/<legalnotice>/i){
$front = "$front.\\\" This documentation comes with the following legal notice:\n.\\\" \n"; $front = "$front.\\\" This documentation comes with the following legal notice:\n.\\\" \n";
$mode = 2; $mode = 2;
} }
elsif(/<author>/){ elsif(/<author>/i){
$front = "$front.\\\" Documentation by: "; $front = "$front.\\\" Documentation by: ";
} }
elsif(/<firstname>(.*)<\/firstname>/){ elsif(/<firstname>(.*)<\/firstname>/i){
$front = "$front$1 "; $front = "$front$1 ";
} }
elsif(/<surname>(.*)<\/surname>/){ elsif(/<surname>(.*)<\/surname>/i){
$front = "$front$1 "; $front = "$front$1 ";
} }
elsif(/<email>(.*)<\/email>/){ elsif(/<email>(.*)<\/email>/i){
$front = "$front($1)"; $front = "$front($1)";
} }
elsif(/\/author>/){ elsif(/\/author>/i){
$front = "$front\n"; $front = "$front\n";
} }
elsif(/<copyright>/){ elsif(/<copyright>/i){
$front = "$front.\\\" Documentation copyright: "; $front = "$front.\\\" Documentation copyright: ";
} }
elsif(/<holder>(.*)<\/holder>/){ elsif(/<holder>(.*)<\/holder>/i){
$front = "$front$1 "; $front = "$front$1 ";
} }
elsif(/<year>(.*)<\/year>/){ elsif(/<year>(.*)<\/year>/i){
$front = "$front$1 "; $front = "$front$1 ";
} }
elsif(/\/copyright>/){ elsif(/\/copyright>/i){
$front = "$front\n"; $front = "$front\n";
} }
elsif(/^[ \t]*$/ elsif(/^[ \t]*$/
|| /<affiliation>/ || /<affiliation>/i
|| /<\/affiliation>/ || /<\/affiliation>/i
|| /<address>/ || /<address>/i
|| /<\/address>/ || /<\/address>/i
|| /<authorgroup>/ || /<authorgroup>/i
|| /<\/authorgroup>/ || /<\/authorgroup>/i
|| /<\/legalnotice>/ || /<\/legalnotice>/i
|| /<date>/ || /<date>/i
|| /<\/date>/ || /<\/date>/i
|| /<edition>/ || /<edition>/i
|| /<\/edition>/){ || /<\/edition>/i
|| /<pubdate>/i
|| /<\/pubdate>/i){
} }
else{ else{
print "Unknown tag in manpage conversion: $_"; print "Unknown tag in manpage conversion: $_";
} }
} }
if(/.*BEGINFRONTTAG.*/){ if($mode == 0){
if(/<bookinfo>/i){
$mode = 1; $mode = 1;
} }
} }
if($mode == 4){
if(/<\/bookinfo>/i){
$mode = 3;
}
}
}
close INPUT; close INPUT;
system("cd $ARGV[1]; docbook2man $filename.sgml; mv $filename.9 /tmp/$$.9\n"); system("cd $ARGV[1]; docbook2man $filename.sgml; mv $filename.9 $tmpdir/$$.9\n");
open GENERATED, "< /tmp/$$.9"; open GENERATED, "< $tmpdir/$$.9";
open OUTPUT, "> $ARGV[1]/$filename.9"; open OUTPUT, "> $ARGV[1]/$filename.9";
print OUTPUT "$front"; print OUTPUT "$front";
...@@ -146,7 +172,7 @@ if($ARGV[0] eq "convert"){ ...@@ -146,7 +172,7 @@ if($ARGV[0] eq "convert"){
close GENERATED; close GENERATED;
system("gzip -f $ARGV[1]/$filename.9\n"); system("gzip -f $ARGV[1]/$filename.9\n");
unlink("/tmp/$filename.9"); unlink("$tmpdir/$$.9");
} }
} }
elsif($ARGV[0] eq "install"){ elsif($ARGV[0] eq "install"){
......
...@@ -52,7 +52,7 @@ while(<SGML>){ ...@@ -52,7 +52,7 @@ while(<SGML>){
open REF, "> $ARGV[1]/$filename.sgml" or open REF, "> $ARGV[1]/$filename.sgml" or
die "Couldn't open output file \"$ARGV[1]/$filename.sgml\": $!\n"; die "Couldn't open output file \"$ARGV[1]/$filename.sgml\": $!\n";
print REF <<EOF; print REF <<EOF;
<!DOCTYPE refentry PUBLIC "-//Davenport//DTD DocBook V3.0//EN"> <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
<!-- BEGINFRONTTAG: The following is front matter for the parent book --> <!-- BEGINFRONTTAG: The following is front matter for the parent book -->
$front $front
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment