OSDN Git Service
(root)
/
shogi-server
/
shogi-server.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/wdoor-stable'
[shogi-server/shogi-server.git]
/
mk_game_results
diff --git
a/mk_game_results
b/mk_game_results
index
d2c3682
..
0260f88
100755
(executable)
--- a/
mk_game_results
+++ b/
mk_game_results
@@
-1,11
+1,11
@@
-#!/usr/bin/ruby
1.9.1
+#!/usr/bin/ruby
# $Id$
#
# Author:: Daigo Moriwaki
# Homepage:: http://sourceforge.jp/projects/shogi-server/
#
#--
# $Id$
#
# Author:: Daigo Moriwaki
# Homepage:: http://sourceforge.jp/projects/shogi-server/
#
#--
-# Copyright (C) 2009 Daigo Moriwaki <daigo at debian dot org>
+# Copyright (C) 2009
-2012
Daigo Moriwaki <daigo at debian dot org>
#
# 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
#
# 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
@@
-35,9
+35,9
@@
#
# Sample Command lines that isntall prerequires will work on Debian.
#
#
# Sample Command lines that isntall prerequires will work on Debian.
#
-# * Ruby
1.9.3 or 1.8.7
+# * Ruby
2.0.0 or later
#
#
-# $ sudo aptitude install ruby
1.9.1
+# $ sudo aptitude install ruby
#
# == Run
#
#
# == Run
#
@@
-58,7
+58,11
@@
require 'getoptlong'
# @parameter file an absolute path of a csa file
#
def grep(file)
# @parameter file an absolute path of a csa file
#
def grep(file)
- str = File.open(file).read
+ if RUBY_VERSION >= "1.9.1"
+ str = File.open(file, "r:EUC-JP").read
+ else
+ str = File.open(file, "r").read
+ end
if /^N\+(.*)$/ =~ str then black_name = $1.strip end
if /^N\-(.*)$/ =~ str then white_name = $1.strip end
if /^N\+(.*)$/ =~ str then black_name = $1.strip end
if /^N\-(.*)$/ =~ str then white_name = $1.strip end
@@
-89,6
+93,7
@@
def grep(file)
puts [time, state, black_mark, black_id, white_id, white_mark, file].join("\t")
end
end
puts [time, state, black_mark, black_id, white_id, white_mark, file].join("\t")
end
end
+ $stdout.flush
end
# Show Usage
end
# Show Usage