diff options
Diffstat (limited to 'ext/socket/mkconstants.rb')
-rw-r--r-- | ext/socket/mkconstants.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb index bc574aa3e5..c7f599beb8 100644 --- a/ext/socket/mkconstants.rb +++ b/ext/socket/mkconstants.rb @@ -34,10 +34,7 @@ end opt.parse! -result = '' -# workaround for NetBSD, OpenBSD and etc. -result << "#define pseudo_AF_FTIP pseudo_AF_RTIP\n" h = {} DATA.each_line {|s| @@ -258,7 +255,8 @@ def_intern('intern_protocol_family', /\APF_/) def_intern('intern_socktype', /\ASOCK_/) def_intern('intern_ipproto', /\AIPPROTO_/) -result << ERB.new(<<'EOS', nil, '%').result(binding) +result = ERB.new(<<'EOS', nil, '%').result(binding) +/* autogenerated file */ <%= INTERN_DEFS.map {|vardef, gen_hash, decl, func| vardef }.join("\n") %> @@ -276,6 +274,7 @@ init_constants(VALUE mConst) EOS header_result = ERB.new(<<'EOS', nil, '%').result(binding) +/* autogenerated file */ <%= gen_const_decls %> <%= NAME_TO_INT_DEFS.map {|decl, func| decl }.join("\n") %> <%= INTERN_DEFS.map {|vardef, gen_hash, decl, func| decl }.join("\n") %> @@ -285,6 +284,8 @@ if opt_H File.open(opt_H, 'w') {|f| f << header_result } +else + result = header_result + result end if opt_o |