Vikiwiki 1.8.9をRuby 2.2で動かす

XREA.COMのRubyが2.2になっていて、Vikiwiki 1.8.9が動かなかったので、動くようにした。そのパッチは以下のとおりである。

diff -ur hollyhock.old/public_html/viki/index.cgi hollyhock/public_html/viki/index.cgi
--- hollyhock.old/public_html/viki/index.cgi	2005-08-26 07:49:06.000000000 +0900
+++ hollyhock/public_html/viki/index.cgi	2016-06-05 13:00:39.234039000 +0900
@@ -1,5 +1,6 @@
-#!/usr/local/bin/ruby
-$KCODE='u'
+#!/usr/local/bin/ruby -Ku
+# -*- coding: utf-8 -*-
+$GKCODE='u'
 # Environment Setting
 $VIKIWIKIDIR="/virtual/hollyhock/vikiwiki/vikiwiki"
 $VIKIWIKITMP="/virtual/hollyhock/vikiwiki/vikiwiki/tmp"
diff -ur hollyhock.old/vikiwiki/setup.rb hollyhock/vikiwiki/setup.rb
--- hollyhock.old/vikiwiki/setup.rb	2005-08-07 12:54:14.000000000 +0900
+++ hollyhock/vikiwiki/setup.rb	2016-06-05 09:21:44.717368000 +0900
@@ -1,7 +1,7 @@
 $:.unshift('vikiwiki')
 $:.unshift('vikiwiki/lib')
 
-require 'ftools'
+#require 'ftools'
 require 'baseextend'
 require 'vikiwikisys'
 
@@ -42,7 +42,7 @@
 end
 
 def setup_system(cmd)
-	rubycmd = "ruby -K#{$KCODE[0].chr.downcase} "
+	rubycmd = "ruby -K#{$GKCODE[0].chr.downcase} "
 	rubycmd << "-d " if $DEBUG
 	rubycmd << cmd.strip
 	puts rubycmd
@@ -156,7 +156,7 @@
 
 		$VIKIWIKIDIR = $WORK_VIKIWIKIDIR+'/vikiwiki'
 		$CONF = VikiWiki::CONF.dup
-		$CONF['ENCODING'] = USEconv::encoding($KCODE)
+		$CONF['ENCODING'] = USEconv::encoding($GKCODE)
 		$CONF['ADMIN']    = $WORK_ADMIN.downcase
 		$CONF['AUTHOR']   = $WORK_ADMIN.dup
 		$WORK_USE_FOR = USE_FOR[0].dup
diff -ur hollyhock.old/vikiwiki/tdiary/vikiwiki_style.rb hollyhock/vikiwiki/tdiary/vikiwiki_style.rb
--- hollyhock.old/vikiwiki/tdiary/vikiwiki_style.rb	2005-08-07 12:54:30.000000000 +0900
+++ hollyhock/vikiwiki/tdiary/vikiwiki_style.rb	2016-06-05 09:14:13.685006000 +0900
@@ -60,8 +60,8 @@
 
 		def do_html4( date, idx, opt, in_stripped_subtitle = nil )
 			begin
-				scode = $KCODE;
-				$KCODE = VIKIWIKICONF['ENCODING'][0].chr.downcase
+				scode = $GKCODE;
+				$GKCODE = VIKIWIKICONF['ENCODING'][0].chr.downcase
 				sys = VikiWiki::Sys::new(
 					VIKIWIKICONF['LOCAL_FILE'],
 					VIKIWIKICONF )
@@ -73,7 +73,7 @@
 				body = VIKIWIKICONV['RESTORE'].call( body ) if VIKIWIKICONV['RESTORE']
 				return body
 			ensure
-				$KCODE = scode
+				$GKCODE = scode
 			end
 		end
 
diff -ur hollyhock.old/vikiwiki/tdiary/vikiwikiconf.rb hollyhock/vikiwiki/tdiary/vikiwikiconf.rb
--- hollyhock.old/vikiwiki/tdiary/vikiwikiconf.rb	2005-08-07 12:54:30.000000000 +0900
+++ hollyhock/vikiwiki/tdiary/vikiwikiconf.rb	2016-06-05 09:14:34.823097000 +0900
@@ -132,8 +132,8 @@
 # Methods to convert the codeset.
 require 'useconv'
 VIKIWIKICONV = {
-'STORE' => USEconv::cnvmethod($KCODE, VIKIWIKICONF['ENCODING']),
-'RESTORE' => USEconv::cnvmethod(VIKIWIKICONF['ENCODING'], $KCODE)
+'STORE' => USEconv::cnvmethod($KGCODE, VIKIWIKICONF['ENCODING']),
+'RESTORE' => USEconv::cnvmethod(VIKIWIKICONF['ENCODING'], $GKCODE)
 }
 # Use wiki links
 if $VIKIWIKIUSEWIKILINK then
diff -ur hollyhock.old/vikiwiki/tool/chgdiffcvs.cgi hollyhock/vikiwiki/tool/chgdiffcvs.cgi
--- hollyhock.old/vikiwiki/tool/chgdiffcvs.cgi	2005-08-07 12:54:31.000000000 +0900
+++ hollyhock/vikiwiki/tool/chgdiffcvs.cgi	2016-06-05 09:15:33.367329000 +0900
@@ -1,5 +1,6 @@
 #!/usr/bin/ruby
-$KCODE = 'u'
+# -*- coding: utf-8 -*-
+$GKCODE = 'u'
 require 'cgi'
 cgi = CGI::new
 
diff -ur hollyhock.old/vikiwiki/tool/static.rb hollyhock/vikiwiki/tool/static.rb
--- hollyhock.old/vikiwiki/tool/static.rb	2005-08-07 12:54:32.000000000 +0900
+++ hollyhock/vikiwiki/tool/static.rb	2016-06-05 09:16:01.164985000 +0900
@@ -1,4 +1,4 @@
-require 'ftools'
+#require 'ftools'
 
 class Usage < StandardError; end
 
@@ -65,8 +65,8 @@
 	sys = VikiWiki::Sys::new(local, conf)
 	sys.setup
 
-	@cnv = USEconv::cnvmethod($KCODE, flags['code'])
-	@cnv = USEconv::cnvmethod($KCODE, sys['OSCODE']) unless @cnv
+	@cnv = USEconv::cnvmethod($GKCODE, flags['code'])
+	@cnv = USEconv::cnvmethod($GKCODE, sys['OSCODE']) unless @cnv
 
 	if flags['delete'] then
 		unless flags['quiet'] then
diff -ur hollyhock.old/vikiwiki/tool/wikiconv.rb hollyhock/vikiwiki/tool/wikiconv.rb
--- hollyhock.old/vikiwiki/tool/wikiconv.rb	2005-08-07 12:54:32.000000000 +0900
+++ hollyhock/vikiwiki/tool/wikiconv.rb	2016-06-05 09:16:21.435354000 +0900
@@ -36,8 +36,8 @@
 	if p and p[0].chr == '-' then
 		raise "invalid code parameter #{p}" unless /^\-([A-Z])([a-z])?$/ === p
 		fc, tc = $1.downcase, $2.downcase
-		fc = USEconv::cnvmethod(fc, $KCODE)
-		tc = USEconv::cnvmethod($KCODE, tc)
+		fc = USEconv::cnvmethod(fc, $GKCODE)
+		tc = USEconv::cnvmethod($GKCODE, tc)
 		p = ARGV.shift
 	end
 	file = p || STDIN
diff -ur hollyhock.old/vikiwiki/vikiwiki/lib/baseextend.rb hollyhock/vikiwiki/vikiwiki/lib/baseextend.rb
--- hollyhock.old/vikiwiki/vikiwiki/lib/baseextend.rb	2005-08-07 12:54:36.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/lib/baseextend.rb	2016-06-05 13:35:23.921672000 +0900
@@ -1,4 +1,5 @@
-require 'ftools'
+#require 'ftools'
+require 'fileutils'
 
 class File
 	# cp -p
@@ -41,7 +42,7 @@
 	end
 	def File::fwrite(file, text, bak='.bak', clear=true)
 		dir = File::dirname(file)
-		File::mkpath(dir)
+		FileUtils.mkpath(dir)
 		bakfile = file+bak
 		File::open(bakfile, "w"){|f|
 			if text.class == String then
@@ -78,7 +79,7 @@
 	# cp -r
 	def Dir::copy(from, to, subdir=true)
 		raise "No such file or directory." unless FileTest::exist?(from)
-		File::mkpath(to)
+		FileUtiles.mkpath(to)
 		Dir::foreach(from){|f|
 			next if /^\.+$/ === f
 			t = (to+'/'+f).untaint
@@ -93,7 +94,7 @@
 	# copy and convert
 	def Dir::copycnv(cnv, fpath, tpath=nil)
 		if FileTest::directory?(fpath) then
-			File::mkpath(tpath) if tpath
+			FileUtils.mkpath(tpath) if tpath
 			Dir::open(fpath){|d|
 				d.each{|n|
 					next if n.nil? or n.empty? or /^\.+$/ === n
diff -ur hollyhock.old/vikiwiki/vikiwiki/lib/cgiextend.rb hollyhock/vikiwiki/vikiwiki/lib/cgiextend.rb
--- hollyhock.old/vikiwiki/vikiwiki/lib/cgiextend.rb	2005-08-07 12:54:36.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/lib/cgiextend.rb	2016-06-05 09:39:27.999688000 +0900
@@ -111,8 +111,8 @@
 			elsif
 				URI_RESERVE.include?(word) or
 				URI_EXCEPT.include?(word) or
-				word[0] < 0x20 or
-				word[0] > 0x7f
+				word[0].ord < 0x20 or
+				word[0].ord > 0x7f
 			then
 				'%' + word.unpack('H2' * word.size).join('%').upcase
 			else
diff -ur hollyhock.old/vikiwiki/vikiwiki/lib/diffcvs.rb hollyhock/vikiwiki/vikiwiki/lib/diffcvs.rb
--- hollyhock.old/vikiwiki/vikiwiki/lib/diffcvs.rb	2005-08-07 12:54:37.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/lib/diffcvs.rb	2016-06-05 13:27:21.327927000 +0900
@@ -1,4 +1,5 @@
-require 'ftools'
+#require 'ftools'
+require 'fileutils'
 require 'difftool'
 require 'lockfile'
 require 'message'
@@ -27,7 +28,7 @@
 		return lines
 	end
 	def writeFile(file, text=nil, tms=nil, user=nil)
-		File::mkpath(File::dirname(file))
+		FileUtils.mkpath(File::dirname(file))
 		LockFile::lock(file) do
 			begin
 				cur = nil
@@ -82,7 +83,7 @@
 		raise Message::new(:FILE_AREADY_EXISTS, to) if File::exist?(to)
 		raise Message::new(:FILE_NOT_FOUND, from) unless File::exist?(from)
 		renames = Array::new
-		File::mkpath(File::dirname(to))
+		FileUtils.mkpath(File::dirname(to))
 		LockFile::lock(from, to) do
 			begin
 				vers = getVersions(from)
@@ -138,7 +139,7 @@
 	def getBackupFile(file, user=nil)
 		dir, base = File::split(file)
 		dir = "#{dir}/#{CVSDIR}"
-		File::mkpath(dir)
+		FileUtils.mkpath(dir)
 		bakfile = nil
 		Dir::glob("#{dir}/#{base}.*"){|fnam|
 			next if /\.diff$/ === fnam
@@ -156,7 +157,7 @@
 		return @diffiles[ver] if user.nil? and @diffile and @diffile == file and @diffiles[ver]
 		dir, base = File::split(file)
 		dir = "#{dir}/#{CVSDIR}"
-		File::mkpath(dir)
+		FileUtils.mkpath(dir)
 		diffile = Dir::glob("#{dir}/#{base}*.#{ver}.diff").first
 		diffile = ["#{dir}/#{base}", user, ver.to_s, "diff"].compact.join('.') if diffile.nil?
 		return diffile.untaint
@@ -165,7 +166,7 @@
 		raise "file path mismatch" unless /^#{Regexp::escape(dir)}/ === file
 		base = $'
 		dstfile = "#{dir}/#{DSTDIR}/#{base}"
-		File::mkpath(File::dirname(dstfile))
+		FileUtils.mkpath(File::dirname(dstfile))
 		File::rename(file, dstfile) if File::exist?(file)
 	end
 	def getVersions(file)
diff -ur hollyhock.old/vikiwiki/vikiwiki/lib/useconv.rb hollyhock/vikiwiki/vikiwiki/lib/useconv.rb
--- hollyhock.old/vikiwiki/vikiwiki/lib/useconv.rb	2005-08-07 12:54:39.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/lib/useconv.rb	2016-06-05 09:05:13.745364000 +0900
@@ -15,7 +15,7 @@
 	# kcode => encoding
 	def USEconv::encoding(kcode); KCODE2ENCODE[USEconv::kcode(kcode)]; end
 	# encoding => kcode
-	def USEconv::kcode(encoding); (encoding || $KCODE)[0].chr.downcase; end
+	def USEconv::kcode(encoding); (encoding || $GKCODE)[0].chr.downcase; end
 	# encoding => kcode
 	def USEconv::eql?(c,d)
 		USEconv::kcode(c) == USEconv::kcode(d) ? true : false
diff -ur hollyhock.old/vikiwiki/vikiwiki/plugin/admin.rb hollyhock/vikiwiki/vikiwiki/plugin/admin.rb
--- hollyhock.old/vikiwiki/vikiwiki/plugin/admin.rb	2005-08-07 12:54:39.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/plugin/admin.rb	2016-06-05 13:27:46.909631000 +0900
@@ -1,4 +1,5 @@
-require 'ftools'
+#require 'ftools'
+require 'fileutils'
 require 'baseextend'
 require 'vikiwikiplugin'
 
@@ -380,7 +381,7 @@
 					logfile = "#{$VIKIWIKITMP}/static#{$$}.log"
 					cmd = [
 						$VIKIWIKIRUBY,
-						"-K#{$KCODE}",
+						"-K#{$GKCODE}",
 						"#{$VIKIWIKIDIR}/../tool/static.rb",
 						"-#{opt}",
 						"-o #{$VIKIWIKITMP}/static#{$$}.log",
@@ -562,7 +563,7 @@
 				@sys.push
 				begin
 					@sys.static = true
-					File::mkpath(@sys['STATICDIR'])
+					FileUtils.mkpath(@sys['STATICDIR'])
 					pages.each{|page|
 						if page == 'index' then
 							uri = CGI::escapeURI(CGI::escapeURI(@sys['TOPPAGE'])) + ".html"
diff -ur hollyhock.old/vikiwiki/vikiwiki/plugin/farm.rb hollyhock/vikiwiki/vikiwiki/plugin/farm.rb
--- hollyhock.old/vikiwiki/vikiwiki/plugin/farm.rb	2005-08-07 12:54:42.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/plugin/farm.rb	2016-06-05 13:28:15.740231000 +0900
@@ -1,4 +1,5 @@
-require 'ftools'
+#require 'ftools'
+require 'fileutils'
 require 'baseextend'
 require 'istore'
 require 'vikiwikiplugin'
@@ -67,8 +68,8 @@
 				fs = [newdir, scfile].path
 				sc = [scdir, FARMNAM, name, scfile].path
 				raise ERR['EXS_SIT'] if FileTest::exist?(newdir)
-				File::mkpath(@sys['FARMDIR'])
-				File::mkpath(newdir)
+				FileUtils.mkpath(@sys['FARMDIR'])
+				FileUtils.mkpath(newdir)
 
 				begin
 					conf = @sys.conf
@@ -87,13 +88,13 @@
 					sys.setup
 					sys.config(conf)
 
-					File::mkpath(sys['DATADIR'])
-					File::mkpath(sys['TEXTDIR'])
-					File::mkpath(sys['IMGDIR'].first)
-					File::mkpath(sys['THEMEDIR'].first)
+					FileUtils.mkpath(sys['DATADIR'])
+					FileUtils.mkpath(sys['TEXTDIR'])
+					FileUtils.mkpath(sys['IMGDIR'].first)
+					FileUtils.mkpath(sys['THEMEDIR'].first)
 					if conf['STATICDIR'] then
-						File::mkpath(File::dirname(sys['STATICDIR']))
-						File::mkpath(sys['STATICDIR'])
+						FileUtils.mkpath(File::dirname(sys['STATICDIR']))
+						FileUtils.mkpath(sys['STATICDIR'])
 					end
 
 					wc = [MASTERDIR, TEXTNAM, sys['LANG'], '*'].path
diff -ur hollyhock.old/vikiwiki/vikiwiki/plugin/tdiary.rb hollyhock/vikiwiki/vikiwiki/plugin/tdiary.rb
--- hollyhock.old/vikiwiki/vikiwiki/plugin/tdiary.rb	2005-08-07 12:54:48.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/plugin/tdiary.rb	2016-06-05 09:17:48.954681000 +0900
@@ -10,16 +10,16 @@
 			def onview
 
 				pwd = Dir::pwd
-				kcode = $KCODE
-				$KCODE = 'e'
+				kcode = $GKCODE
+				$GKCODE = 'e'
 				begin
 					Dir::chdir(File::dirname(@sys['TDIARY_CONF']))
 					cgi = CGI::new
 					conf = TDiary::Config::new
 					tdiary = TDiary::TDiaryLatest::new( cgi, 'unit.rhtml', conf )
-					USEconv::convmethod($KCODE, kcode).call(tdiary.eval_rhtml_body)
+					USEconv::convmethod($GKCODE, kcode).call(tdiary.eval_rhtml_body)
 				ensure
-					$KCODE = kcode
+					$GKCODE = kcode
 					Dir::chdir(pwd)
 				end
 			end
diff -ur hollyhock.old/vikiwiki/vikiwiki/style/vikiwikistyle.rb hollyhock/vikiwiki/vikiwiki/style/vikiwikistyle.rb
--- hollyhock.old/vikiwiki/vikiwiki/style/vikiwikistyle.rb	2005-08-07 12:55:02.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/style/vikiwikistyle.rb	2016-06-05 13:14:12.781113000 +0900
@@ -179,7 +179,7 @@
 			p, pindent = '', 0
 			preindent, indent = 0
 			lines = lines.to_a unless Array === lines
-			lines[0].sub!(RE_BOM, '') if lines[0] and /^u/i === $KCODE
+			lines[0].sub!(RE_BOM, '') if lines[0] and /^u/i === $GKCODE
 			until lines.empty? do
 				nline = lines.shift
 				preindent = indent
@@ -317,7 +317,7 @@
 					windent, wline = $1.size, $' if @my::RE_INDENT === wnline
 					break if windent == indent and @my::RE_PRE_E === wline
 					wnline = wnline.sub(first_indent, '') if first_indent
-					text << wnline
+					text << wnline + "\n"
 				end
 				node = Block::new(indent, 'pre', text)
 			when @my::RE_BLOCKQUOTE then
@@ -403,7 +403,8 @@
 		# Return values : array of nodes
 		#===================================================================
 		def inparse(lines)
-			return lines.chomp.to_a.map{|line|
+#			return lines.chomp.to_a.map{|line|
+			return lines.chomp.split(/\n/).map{|line|
 				nodes = Array::new
 				str = ''
 				line.chomp!
@@ -546,7 +547,7 @@
 				end
 				return out
 			when 'comment' then
-				out << insert_indent(node.level, "<!-- #{node.text.chomp} -->")
+				out << insert_indent(node.level, ["<!-- #{node.text.chomp} -->"])
 				out << expand_html(node.child) if node.have_child?
 				return out
 			when 'pre' then
@@ -584,7 +585,8 @@
 			when 'dd' then
 				return nil if node.text.empty? and not node.have_child?
 			end
-			res = ''
+#			res = ''
+			res = []
 			res << "\n" if /^h\d$/ === node.type and (node.parent or node.prev)
 			res << CGI::bgntag(node.type, node.attr)
 			res << expand_html(node.text)
@@ -846,7 +848,7 @@
 		#===================================================================
 		def insert_indent(level, text)
 			res = ''
-			text.each{|line|
+			([].push(text)).flatten.each{|line|
 				res << ' ' * level
 				res << line
 			}
diff -ur hollyhock.old/vikiwiki/vikiwiki/vikiwikiattach.rb hollyhock/vikiwiki/vikiwiki/vikiwikiattach.rb
--- hollyhock.old/vikiwiki/vikiwiki/vikiwikiattach.rb	2005-08-07 12:54:33.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/vikiwikiattach.rb	2016-06-05 09:18:40.523839000 +0900
@@ -1,4 +1,4 @@
-require 'ftools'
+#require 'ftools'
 require 'cgiextend'
 require 'useconv'
 
@@ -18,12 +18,12 @@
 			@to_file_path = CGI.method(:escapePATH)
 			@to_object_path = CGI.method(:unescapePATH)
 			if /^file:/ === @baseuri[0] then
-				if USEconv::eql?($KCODE, @oscode) then
+				if USEconv::eql?($GKCODE, @oscode) then
 					@to_file_path = nil
 					@to_object_path = nil
-				elsif USEconv::cnvmethod($KCODE, @oscode) then
-					@to_file_path = USEconv::cnvmethod($KCODE, @oscode)
-					@to_object_path = USEconv::cnvmethod(@oscode, $KCODE)
+				elsif USEconv::cnvmethod($GKCODE, @oscode) then
+					@to_file_path = USEconv::cnvmethod($GKCODE, @oscode)
+					@to_object_path = USEconv::cnvmethod(@oscode, $GKCODE)
 				end
 			end
 			@file_path = @to_file_path.call(@object_path).untaint
diff -ur hollyhock.old/vikiwiki/vikiwiki/vikiwikiconst.rb hollyhock/vikiwiki/vikiwiki/vikiwikiconst.rb
--- hollyhock.old/vikiwiki/vikiwiki/vikiwikiconst.rb	2005-08-07 12:54:33.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/vikiwikiconst.rb	2016-06-05 09:04:43.042471000 +0900
@@ -74,7 +74,7 @@
 		'EDITFILE'      => nil,
 		'EDITSYSTEM'    => false,
 		'EDITTHEME'     => false,
-		'ENCODING'      => USEconv::encoding($KCODE),
+		'ENCODING'      => USEconv::encoding($GKCODE),
 		'FILEEXT'       => 'txt',
 		'FILEMODE'      => '440',
 		'FOOTER'        => nil,
diff -ur hollyhock.old/vikiwiki/vikiwiki/vikiwikipage.rb hollyhock/vikiwiki/vikiwiki/vikiwikipage.rb
--- hollyhock.old/vikiwiki/vikiwiki/vikiwikipage.rb	2005-08-07 12:54:34.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/vikiwikipage.rb	2016-06-05 13:28:58.476125000 +0900
@@ -1,4 +1,5 @@
-require 'ftools'
+#require 'ftools'
+require 'fileutils'
 require 'baseextend'
 require 'cgiextend'
 require 'style/vikiwikistyle'
@@ -292,7 +293,8 @@
 		def initialize(sys)
 			@sys = sys
 			@dir = @sys['STATICDIR']
-			File::mkpath(@dir) if @dir
+			FileUtils.mkpath(@dir) if @dir
+#			FileUtils.mkpath(@dir) if @dir
 		end
 		def each(name=nil, subdir=true)
 			each_path(name, subdir){|path|
@@ -333,7 +335,7 @@
 		def generate_location_all
 			@sys.pages.each{|page|
 				uri = page.uri
-				File::mkpath(File::dirname(page.static.path))
+				FileUtils.mkpath(File::dirname(page.static.path))
 				File::open(page.static.path, "w"){|fout|
 					fout << @sys.rhtml('location', binding)
 				}
@@ -425,7 +427,7 @@
 				raise Message::new(:PAGE_NOT_FOUND) unless page.exist?
 				layout = page.load
 				style = page.style
-				File::mkpath(File::dirname(self.path))
+				FileUtils.mkpath(File::dirname(self.path))
 				cgi = @sys.cgi.clone
 				cgi.params.clear
 				cgi.params['p'] = [@name]
@@ -450,7 +452,7 @@
 		def rename(newname)
 			newpath = StaticHTML::new(@sys, newname).path
 			raise Message::new(:FILE_AREADY_EXISTS, newpath) if FileTest::exist?(newpath)
-			File::mkpath(File::dirname(newpath))
+			FileUtils.mkpath(File::dirname(newpath))
 			File::rename(self.path, newpath)
 		end
 		def exist?
diff -ur hollyhock.old/vikiwiki/vikiwiki/vikiwikiparser.rb hollyhock/vikiwiki/vikiwiki/vikiwikiparser.rb
--- hollyhock.old/vikiwiki/vikiwiki/vikiwikiparser.rb	2005-08-07 12:54:34.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/vikiwikiparser.rb	2016-06-05 11:07:47.603969000 +0900
@@ -80,7 +80,8 @@
 			@styles = Styles::new(sys, 'VikiWiki') unless @styles
 		end
 		def parse(lines, style=nil)
-			return @styles[style].parse(lines.to_a) || Block::new
+			return @styles[style].parse(lines.split("\n")) || Block::new
+#			return @styles[style].parse(lines.to_a) || Block::new
 		end
 		def parse_inline(line, style=nil)
 			return @styles[style].inparse(line) || Inline::new
diff -ur hollyhock.old/vikiwiki/vikiwiki/vikiwikiplugin.rb hollyhock/vikiwiki/vikiwiki/vikiwikiplugin.rb
--- hollyhock.old/vikiwiki/vikiwiki/vikiwikiplugin.rb	2005-08-07 12:54:35.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/vikiwikiplugin.rb	2016-06-05 13:29:29.850531000 +0900
@@ -1,7 +1,8 @@
 require 'cgiextend'
 require 'cgiform'
 require 'transtext'
-require 'ftools'
+#require 'ftools'
+require 'fileutils'
 require 'vikiwikibase'
 require 'vikiwikisys'
 require 'vikiwikiparser'
@@ -85,7 +86,7 @@
 			end
 			def serialize(obj=nil, name=@name, datadir=@sys['DATADIR'])
 				dir = [datadir, PLUGINNAM].path
-				File::mkpath(dir)
+				FileUtils.mkpath(dir)
 				db = IStore::new([dir, "#{name}.txt"].path)
 				obj ? db.write(obj) : db.read
 			end
diff -ur hollyhock.old/vikiwiki/vikiwiki/vikiwikisys.rb hollyhock/vikiwiki/vikiwiki/vikiwikisys.rb
--- hollyhock.old/vikiwiki/vikiwiki/vikiwikisys.rb	2005-08-07 12:54:35.000000000 +0900
+++ hollyhock/vikiwiki/vikiwiki/vikiwikisys.rb	2016-06-05 13:29:53.745868000 +0900
@@ -3,7 +3,8 @@
 # Version of Wiki Engine
 $WIKIVERSION    = '1.8.9'
 
-require 'ftools'
+#require 'ftools'
+require 'fileutils'
 require 'baseextend'
 require 'cgiextend'
 require 'useconv'
@@ -49,8 +50,8 @@
 			end
 			kcode = USEconv::kcode(conf['ENCODING'])
 			@code = @cgi.params['c'][0] || kcode
-			@cgi.convert!(USEconv::cnvmethod(@code, $KCODE))
-			@cnv = USEconv::cnvmethod($KCODE, @code)
+			@cgi.convert!(USEconv::cnvmethod(@code, $GKCODE))
+			@cnv = USEconv::cnvmethod($GKCODE, @code)
 			@lang = @cgi.params['l'][0]
 			@lang = conf['LANG'] unless /^[a-z]{2}$/ === @lang
 			@msgs = Message::load([$VIKIWIKIDIR, MSGDIR, "#{@lang}.rb"].path)
@@ -399,7 +400,7 @@
 			vikiwikitmp = conf['$VIKIWIKITMP'] || $VIKIWIKITMP
 			script = <<EOS
 #!#{vikiwikiruby}
-$KCODE='#{$KCODE[0].chr.downcase}'
+$GKCODE='#{$GKCODE[0].chr.downcase}'
 # Environment Setting
 $VIKIWIKIDIR=#{vikiwikidir.inspect}
 $VIKIWIKITMP=#{vikiwikitmp.inspect}
@@ -549,14 +550,14 @@
 			dfile = @basedir + "#{SCRIPTDIR}/#{name}.js"
 			mfile = [MASTERDIR, SCRIPTDIR, "#{name}.js"].path
 			if not File::exist?(dfile) or File::stat(dfile).mtime < File::stat(mfile).mtime then
-				File::mkpath(File::dirname(dfile))
+				FileUtils.mkpath(File::dirname(dfile))
 				File::copyp(mfile, dfile)
 			end
 			if @static then
 				attr['src'] = "#{@conf['STATICURI']}/script/#{name}.js"
 				sfile = "#{@conf['STATICDIR']}/script/#{name}.js"
 				if not File::exist?(sfile) or File::stat(sfile).mtime < File::stat(dfile).mtime then
-					File::mkpath(File::dirname(sfile))
+					FileUtils.mkpath(File::dirname(sfile))
 					File::copyp(dfile, sfile)
 				end
 			end