[PATCH] autoheader: Write to stdout if an argument was given.

Andre Noll <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <[email protected]>
The documentation says:

    If you give `autoheader' an argument, it uses that file instead of
    `configure.ac' and writes the header file to the standard output
    instead of to `config.h.in'.  If you give `autoheader' an argument of
    `-', it reads the standard input instead of `configure.ac' and writes
    the header file to the standard output.

However, currently autoheader writes its output to a file, regardless
of whether an argument is given. This patch makes it work as advertised.

Signed-off-by: Andre Noll <[email protected]>
---
 bin/autoheader.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/bin/autoheader.in b/bin/autoheader.in
index 14b8f03..8f9dd51 100644
--- a/bin/autoheader.in
+++ b/bin/autoheader.in
@@ -55,7 +55,7 @@ local $config_h;
 my $config_h_in;
 my @prepend_include;
 my @include;
-
+my $dst;
 
 # $HELP
 # -----
@@ -119,6 +119,10 @@ sub parse_args ()
       my $configure_ac = require_configure_ac;
       push @ARGV, $configure_ac;
     }
+  else
+    {
+      $dst = "-";
+    }
 }
 
 
@@ -298,7 +302,8 @@ $out->close;
     if keys %symbol;
 }
 
-update_file ("$tmp/config.hin", "$config_h_in", $force);
+$dst = "$config_h_in" unless defined $dst;
+update_file ("$tmp/config.hin", "$dst", $force);
 
 ### Setup "GNU" style for perl-mode and cperl-mode.
 ## Local Variables:
-- 
2.7.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.