autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: build question


From: Alexandre Duret-Lutz
Subject: Re: build question
Date: 14 Feb 2002 00:17:13 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

[Moving from address@hidden to address@hidden

>>> "Akim" == Akim Demaille <address@hidden> writes:

[...]

 Akim> Once you installed it, please, make sure you update the version
 Akim> number, and backport it to Autoconf (which is the main repo.  BTW, if
 Akim> the fact that Autoconf is the master is not properly displayed, please
 Akim> do so).

Let's do that the other way, then.  I'll try to update 'make
fetch' in Automake after this is commited in Autoconf.

I've added the code for `getlines' because autom4te uses it.  I
also checked all the Autoconf scripts for potential uses of
<$HANDLE> instead of $HANDLE->getline, but didn't find anything.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/autoconf/autoconf/ChangeLog,v
retrieving revision 1.1849
diff -u -r1.1849 ChangeLog
--- ChangeLog   7 Feb 2002 18:31:27 -0000       1.1849
+++ ChangeLog   13 Feb 2002 23:04:50 -0000
@@ -1,3 +1,8 @@
+2002-02-13  Alexandre Duret-Lutz  <address@hidden>
+
+       * lib/Autom4te/XFile.pm (getline, getlines): New functions,
+       translate \r\n to \n.
+
 2002-02-07  Akim Demaille  <address@hidden>
 
        Version 2.52h.
Index: lib/Autom4te/XFile.pm
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/XFile.pm,v
retrieving revision 1.3
diff -u -r1.3 XFile.pm
--- lib/Autom4te/XFile.pm       20 Oct 2001 06:56:45 -0000      1.3
+++ lib/Autom4te/XFile.pm       13 Feb 2002 23:04:50 -0000
@@ -17,6 +17,11 @@
 
 # Written by Akim Demaille <address@hidden>.
 
+###############################################################
+# The main copy of this file is in Autoconf's CVS repository. #
+# Updates should be sent to address@hidden         #
+###############################################################
+
 package Autom4te::XFile;
 
 =head1 NAME
@@ -59,7 +64,8 @@
 =head1 DESCRIPTION
 
 C<Autom4te::XFile> inherits from C<IO::File>.  It provides dying
-version of the methods C<open>, C<new>, and C<close>.
+version of the methods C<open>, C<new>, and C<close>.  It also overrides
+the C<getline> and C<getlines> methods to translate C<\r\n> to C<\n>.
 
 =head1 SEE ALSO
 
@@ -86,7 +92,7 @@
 
 @ISA = qw(IO::File Exporter DynaLoader);
 
-$VERSION = "1.0";
+$VERSION = "1.1";
 
 @EXPORT = @IO::File::EXPORT;
 
@@ -156,6 +162,33 @@
       my $file = ${*$fh}{'autom4te_xfile_file'};
       croak "$me: cannot close $file: $!\n";
     }
+}
+
+################################################
+## Getline
+##
+
+# Some Win32/perl installations fail to translate \r\n to \n on input
+# so we do that here.
+sub getline
+{
+    local $_ = $_[0]->SUPER::getline;
+    # Perform a _global_ replacement: $_ may can contains many lines
+    # in slurp mode ($/ = undef).
+    s/\015\012/\n/gs if defined $_;
+    return $_;
+}
+
+################################################
+## Getlines
+##
+
+sub getlines
+{
+    my @res = ();
+    my $line;
+    push @res, $line while $line = $_[0]->getline;
+    return @res;
 }
 
 1;

-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]