bin/sup in sup-0.19.0 vs bin/sup in sup-0.20.0

- old
+ new

@@ -104,29 +104,31 @@ ## the following magic enables wide characters when used with a ruby ## ncurses.so that's been compiled against libncursesw. (note the w.) why ## this works, i have no idea. much like pretty much every aspect of ## dealing with curses. cargo cult programming at its best. -require 'dl/import' require 'rbconfig' -module LibC - extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable - setlocale_lib = case RbConfig::CONFIG['arch'] - when /darwin/; "libc.dylib" - when /cygwin/; "cygwin1.dll" - when /freebsd/; "libc.so.7" - else; "libc.so.6" - end +unless RbConfig::CONFIG['arch'] =~ /openbsd/ + require 'dl/import' + module LibC + extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable + setlocale_lib = case RbConfig::CONFIG['arch'] + when /darwin/; "libc.dylib" + when /cygwin/; "cygwin1.dll" + when /freebsd/; "libc.so.7" + else; "libc.so.6" + end - debug "dynamically loading setlocale() from #{setlocale_lib}" - begin - dlload setlocale_lib - extern "void setlocale(int, const char *)" - debug "setting locale..." - LibC.setlocale(6, "") # LC_ALL == 6 - rescue RuntimeError => e - warn "cannot dlload setlocale(); ncurses wide character support probably broken." - warn "dlload error was #{e.class}: #{e.message}" + debug "dynamically loading setlocale() from #{setlocale_lib}" + begin + dlload setlocale_lib + extern "void setlocale(int, const char *)" + debug "setting locale..." + LibC.setlocale(6, "") # LC_ALL == 6 + rescue RuntimeError => e + warn "cannot dlload setlocale(); ncurses wide character support probably broken." + warn "dlload error was #{e.class}: #{e.message}" + end end end def start_cursing Ncurses.initscr