This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=0ceb06bf5497507cd772b3018a92c106deecf808

The branch, master has been updated
       via  0ceb06bf5497507cd772b3018a92c106deecf808 (commit)
      from  e3acdefa854ccd1134cf75e5c4ae805bf1a50d67 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0ceb06bf5497507cd772b3018a92c106deecf808
Author: Ralf Wildenhues <[EMAIL PROTECTED]>
Date:   Sat Dec 8 11:23:38 2007 +0100

    * lib/Automake/FileUtils.pm (open_quote): New function.
    (update_file, contents): Use it.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |    3 +++
 lib/Automake/FileUtils.pm |   34 ++++++++++++++++++++++++++++++----
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 45c37c6..191b99d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-12-08  Ralf Wildenhues  <[EMAIL PROTECTED]>
 
+       * lib/Automake/FileUtils.pm (open_quote): New function.
+       (update_file, contents): Use it.
+
        Reword the copyright notices to match what's suggested in GPLv3.
 
 2007-12-08  Ralf Wildenhues  <[EMAIL PROTECTED]>
diff --git a/lib/Automake/FileUtils.pm b/lib/Automake/FileUtils.pm
index 6a60e22..34c48e3 100644
--- a/lib/Automake/FileUtils.pm
+++ b/lib/Automake/FileUtils.pm
@@ -1,4 +1,4 @@
-# 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
 # it under the terms of the GNU General Public License as published by
@@ -44,12 +44,38 @@ use Automake::ChannelDefs;
 use vars qw (@ISA @EXPORT);
 
 @ISA = qw (Exporter);
[EMAIL PROTECTED] = qw (&contents
[EMAIL PROTECTED] = 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 Automake::XFile "< $file";
+  my $f = new Automake::XFile "< " . open_quote ($file);
   my $contents = $f->getline;
   $f->close;
   return $contents;


hooks/post-receive
--
GNU Automake


Reply via email to