зеркало из https://github.com/github/ruby.git
* ext/socket/mkconstants.rb: add -o option.
* ext/socket/depend: use mkconstants.rb with -o option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0d2e8c14bb
Коммит
212e90ce3a
|
@ -1,3 +1,9 @@
|
|||
Thu Jan 1 15:07:56 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/mkconstants.rb: add -o option.
|
||||
|
||||
* ext/socket/depend: use mkconstants.rb with -o option.
|
||||
|
||||
Thu Jan 1 07:42:36 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/singleton.rb: fix indentation of RDoc text. [ruby-core:21029]
|
||||
|
|
|
@ -6,4 +6,4 @@ getaddrinfo.o: getaddrinfo.c $(arch_hdrdir)/ruby/config.h addrinfo.h sockport.h
|
|||
|
||||
constants.h: $(srcdir)/mkconstants.rb
|
||||
@echo "generating constants.h"
|
||||
@$(RUBY) $(srcdir)/mkconstants.rb > $@
|
||||
@$(RUBY) $(srcdir)/mkconstants.rb -o $@
|
||||
|
|
|
@ -1,4 +1,24 @@
|
|||
$out ||= $stdout
|
||||
require 'optparse'
|
||||
|
||||
opt = OptionParser.new
|
||||
|
||||
opt.def_option('-h', 'help') {
|
||||
puts opt
|
||||
exit 0
|
||||
}
|
||||
|
||||
opt_o = nil
|
||||
opt.def_option('-o FILE', 'specify output file') {|filename|
|
||||
opt_o = filename
|
||||
}
|
||||
|
||||
$out = ''
|
||||
def $out.puts(str="")
|
||||
str += "\n" if /\n\z/ !~ str
|
||||
self << str
|
||||
end
|
||||
|
||||
opt.parse!
|
||||
|
||||
# workaround for NetBSD, OpenBSD and etc.
|
||||
$out.puts("#define pseudo_AF_FTIP pseudo_AF_RTIP")
|
||||
|
@ -23,6 +43,14 @@ DATA.each_line do |s|
|
|||
end
|
||||
end
|
||||
|
||||
if opt_o
|
||||
File.open(opt_o, 'w') {|f|
|
||||
f << $out
|
||||
}
|
||||
else
|
||||
$stdout << $out
|
||||
end
|
||||
|
||||
__END__
|
||||
|
||||
SOCK_STREAM
|
||||
|
|
Загрузка…
Ссылка в новой задаче