Documentation: modernize cat-texi.perl
Good style for Perl includes using the strict and warnings pragmas, and preferring lexical file handles over bareword file handles. Using lexical file handles necessitates being explicit when $_ is printed, so that Perl does not get confused and instead print the glob ref. The benefit of this modernization is that a formerly obscured bug is now visible, which will be fixed in a followup patch. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f7bf8feaf5
commit
b56867c986
@ -1,9 +1,12 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
my @menu = ();
|
my @menu = ();
|
||||||
my $output = $ARGV[0];
|
my $output = $ARGV[0];
|
||||||
|
|
||||||
open TMP, '>', "$output.tmp";
|
open my $tmp, '>', "$output.tmp";
|
||||||
|
|
||||||
while (<STDIN>) {
|
while (<STDIN>) {
|
||||||
next if (/^\\input texinfo/../\@node Top/);
|
next if (/^\\input texinfo/../\@node Top/);
|
||||||
@ -13,9 +16,9 @@ while (<STDIN>) {
|
|||||||
}
|
}
|
||||||
s/\(\@pxref\{\[(URLS|REMOTES)\]}\)//;
|
s/\(\@pxref\{\[(URLS|REMOTES)\]}\)//;
|
||||||
s/\@anchor\{[^{}]*\}//g;
|
s/\@anchor\{[^{}]*\}//g;
|
||||||
print TMP;
|
print $tmp $_;
|
||||||
}
|
}
|
||||||
close TMP;
|
close $tmp;
|
||||||
|
|
||||||
printf '\input texinfo
|
printf '\input texinfo
|
||||||
@setfilename gitman.info
|
@setfilename gitman.info
|
||||||
@ -34,10 +37,10 @@ for (@menu) {
|
|||||||
print "* ${_}::\n";
|
print "* ${_}::\n";
|
||||||
}
|
}
|
||||||
print "\@end menu\n";
|
print "\@end menu\n";
|
||||||
open TMP, '<', "$output.tmp";
|
open $tmp, '<', "$output.tmp";
|
||||||
while (<TMP>) {
|
while (<$tmp>) {
|
||||||
print;
|
print;
|
||||||
}
|
}
|
||||||
close TMP;
|
close $tmp;
|
||||||
print "\@bye\n";
|
print "\@bye\n";
|
||||||
unlink "$output.tmp";
|
unlink "$output.tmp";
|
||||||
|
Loading…
Reference in New Issue
Block a user