From 7a45306dc6d57ab8a1d127706e7564af6da49520 Mon Sep 17 00:00:00 2001
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Thu, 25 Jun 2009 04:10:21 +0000
Subject: [PATCH] 	* instruby.rb: '&' in sed s command's replacement is
 '\&' in ruby.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 ChangeLog        | 6 +++++-
 tool/instruby.rb | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 837ccaa87f..b395c57d90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jun 25 13:04:58 2009  NAKAMURA Usaku  <usa@ruby-lang.org>
+
+	* instruby.rb: '&' in sed s command's replacement is '\&' in ruby.
+
 Thu Jun 25 06:50:23 2009  Yukihiro Matsumoto  <matz@ruby-lang.org>
 
 	* io.c (rb_io_each_codepoint): uninitialized local variable enc.
@@ -18,7 +22,7 @@ Wed Jun 24 16:08:03 2009  NAKAMURA Usaku  <usa@ruby-lang.org>
 
 Wed Jun 24 16:07:04 2009  NAKAMURA Usaku  <usa@ruby-lang.org>
 
-	* win32/mkexports.rb: rbconfig.rb exists on ".".
+	* win32/mkexports.rb: rbconfig.rb exists at ".".
 
 Wed Jun 24 15:02:29 2009  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 
diff --git a/tool/instruby.rb b/tool/instruby.rb
index 3c277720d3..730a9151d4 100755
--- a/tool/instruby.rb
+++ b/tool/instruby.rb
@@ -391,7 +391,7 @@ install?(:local, :comm, :bin, :'bin-comm') do
       when 's'
         next if pat == '^' and rep.empty?
         exp << [addr, (opt.include?('g') ? :gsub! : :sub!),
-                Regexp.new(pat, opt.include?('i')), rep]
+                Regexp.new(pat, opt.include?('i')), rep.gsub(/&/){'\&'}]
       when 'y'
         exp << [addr, :tr!, Regexp.quote(pat), rep]
       end