Use input file name in initial comment of resulting info file.

For info backend, we better put original input file name in
resulting info, instead of obscure temp file name, so we
have in header comment something like

  This is file.info, produced by makeinfo version x.yy from
  info file generated after file.sgml by means of linuxdoc-tools.

instead of

  This is file.info, produced by makeinfo version x.yy from
  /tmp/linuxdoc-tools.Adm1iK88Ek/sgmltmp.file.2.texi.
parent a985da18
......@@ -5,7 +5,7 @@
# GNU Info-specific driver stuff
#
# Copyright 1996, Cees de Groot
# Copyright 2008 Agustin Martin
# Copyright 2008-2009 Agustin Martin
# ------------------------------------------------------------------
package LinuxDocTools::fmt_info;
......@@ -106,12 +106,14 @@ $info->{postASP} = sub {
my $INFILE = shift;
my $OUTFILE;
my $msgheader = "fmt_info::postASP";
my $fileinfo = "info file generated after $global->{origfile} by means of linuxdoc-tools";
my $awk = $main::progs->{AWK};
my $awkfilter = "$main::DataDir" . "/filters/info-postASP.awk";
my $awkin = "$global->{tmpbase}.1.texi0";
my $texifile = "$global->{tmpbase}.2.texi";
my $infofile = "$global->{filename}.info";
my $infofile0 = "$global->{tmpbase}.info";
open ($OUTFILE, "> $awkin")
or die "fmt_info::postASP: Could not open \"$awkin\" for writing\n";
......@@ -120,9 +122,29 @@ $info->{postASP} = sub {
system ("$awk -v INFO=$infofile -f $awkfilter $awkin > $texifile") == 0
or die "$msgheader: Failed to run awk filter. Aborting ...\n";
system ("makeinfo $texifile -o $infofile") == 0
or die "$msgheader: Failed to run makeinfo. Aborting ...\n";
move $infofile, $infofile0;
my $TMPINFO;
my $infotext;
open ( $TMPINFO, "< $infofile0")
or die "Could not open $infofile0 for read. Aborting ... \n";
{
local $/ = undef;
$infotext = <$TMPINFO>;
}
close $TMPINFO;
$infotext =~ s/^$texifile/$fileinfo/m;
open ($OUTFILE, "> $infofile")
or die "Could not open $infofile for write. Aborting ... \n";
print $OUTFILE $infotext;
close $OUTFILE;
return 0;
};
......
......@@ -470,7 +470,7 @@ etcetera. See the code for details.
# ------------------------------------------------------------------------
sub process_file {
# ------------------------------------------------------------------------
my $file = shift (@_);
my $file = $global->{origfile} = shift (@_);
my $saved_umask = umask;
my $error_header = "LinuxdocTools::process_file";
......
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