]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Sync from Automake.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 8 Dec 2007 10:39:34 +0000 (11:39 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 8 Dec 2007 10:39:34 +0000 (11:39 +0100)
* lib/Autom4te/Channels.pm, lib/Autom4te/Configure_ac.pm,
lib/Autom4te/Struct.pm, lib/Autom4te/XFile.pm: Likewise.
* lib/Autom4te/FileUtils.pm (open_quote): New function.
(update_file, contents): Use it.

ChangeLog
lib/Autom4te/Channels.pm
lib/Autom4te/Configure_ac.pm
lib/Autom4te/FileUtils.pm
lib/Autom4te/Struct.pm
lib/Autom4te/XFile.pm

index 5c59f9f3d769aeedce0c9afa4b77aa16d6dfb6c5..5d49b2cd619c4db2584d1074b6009fe148bf2df7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-12-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Sync from Automake.
+       * lib/Autom4te/Channels.pm, lib/Autom4te/Configure_ac.pm,
+       lib/Autom4te/Struct.pm, lib/Autom4te/XFile.pm: Likewise.
+       * lib/Autom4te/FileUtils.pm (open_quote): New function.
+       (update_file, contents): Use it.
+
        * Makefile.am (autom4te-update): Rewrite for git.
 
 2007-12-04  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
index 9840a3a9956b9c5a61b5395fac49c004cb8b09ef..7324f28b4c10175db94d053e5578bc3c54ef2082 100644 (file)
@@ -1,9 +1,9 @@
 # Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
 
-# This program is free software: you can redistribute it and/or modify
+# This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
 
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
index 48a1d19b8a76392ecaab4e64ff996f44334c1e5d..3ed65f45a649fd75c7cfc58e23d2a72631b8fd60 100644 (file)
@@ -1,9 +1,9 @@
 # Copyright (C) 2003, 2005, 2006  Free Software Foundation, Inc.
 
-# This program is free software: you can redistribute it and/or modify
+# This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
 
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
index 3c9c1bad0421906b3197cb2e31e193e9be03c67f..819a7c384d5761128d5f392b3f357d4969db6413 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2007  Free Software Foundation, Inc.
 
-# This program is free software: you can redistribute it and/or modify
+# This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
 
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -44,12 +44,38 @@ use Autom4te::ChannelDefs;
 use vars qw (@ISA @EXPORT);
 
 @ISA = qw (Exporter);
-@EXPORT = qw (&contents
+@EXPORT = qw (&open_quote &contents
              &find_file &mtime
              &update_file &up_to_date_p
              &xsystem &xqx &dir_has_case_matching_file &reset_dir_cache);
 
 
+=item C<open_quote ($file_name)>
+
+Quote C<$file_name> for open.
+
+=cut
+
+# $FILE_NAME
+# open_quote ($FILE_NAME)
+# -----------------------
+# If the string $S is a well-behaved file name, simply return it.
+# If it starts with white space, prepend `./', if it ends with
+# white space, add `\0'.  Return the new string.
+sub open_quote($)
+{
+  my ($s) = @_;
+  if ($s =~ m/^\s/)
+    {
+      $s = "./$s";
+    }
+  if ($s =~ m/\s$/)
+    {
+      $s = "$s\0";
+    }
+  return $s;
+}
+
 =item C<find_file ($file_name, @include)>
 
 Return the first path for a C<$file_name> in the C<include>s.
@@ -139,7 +165,7 @@ sub update_file ($$;$)
 
   if ($to eq '-')
     {
-      my $in = new IO::File ("$from");
+      my $in = new IO::File ("< " . open_quote ($from));
       my $out = new IO::File (">-");
       while ($_ = $in->getline)
        {
@@ -303,7 +329,7 @@ sub contents ($)
   my ($file) = @_;
   verb "reading $file";
   local $/;                    # Turn on slurp-mode.
-  my $f = new Autom4te::XFile "< $file";
+  my $f = new Autom4te::XFile "< " . open_quote ($file);
   my $contents = $f->getline;
   $f->close;
   return $contents;
index 89c885c6f765b17ba27e471cf59fc28197706206..203571902d0e5d535f935017ebc025d160f0015d 100644 (file)
@@ -1,10 +1,10 @@
 # autoconf -- create `configure' using m4 macros
 # Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
 
-# This program is free software: you can redistribute it and/or modify
+# This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
 
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
index 55ff2a1e89b18f72d93720fc37b962c81be122c5..8d6e70ac6542875ba4887c68fe90e1a729cab41e 100644 (file)
@@ -1,9 +1,9 @@
 # Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
 
-# This program is free software: you can redistribute it and/or modify
+# This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
 
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -64,7 +64,7 @@ Autom4te::XFile - supply object methods for filehandles with error handling
 C<Autom4te::XFile> inherits from C<IO::File>.  It provides the method
 C<name> returning the file name.  It provides dying version of the
 methods C<close>, C<lock> (corresponding to C<flock>), C<new>,
-C<open>, C<seek>, and C<trunctate>.  It also overrides the C<getline>
+C<open>, C<seek>, and C<truncate>.  It also overrides the C<getline>
 and C<getlines> methods to translate C<\r\n> to C<\n>.
 
 =head1 SEE ALSO