diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | Makefile.in | 5 | ||||
-rw-r--r-- | configure | 10 | ||||
-rw-r--r-- | configure.in | 10 | ||||
-rw-r--r-- | dln.c | 4 | ||||
-rw-r--r-- | ext/dbm/extconf.rb | 3 | ||||
-rw-r--r-- | ext/extmk.rb.in | 6 | ||||
-rw-r--r-- | ext/socket/addrinfo.h | 10 | ||||
-rw-r--r-- | ext/socket/extconf.rb | 40 | ||||
-rw-r--r-- | ext/socket/socket.c | 56 | ||||
-rw-r--r-- | lib/mkmf.rb | 11 | ||||
-rw-r--r-- | lib/telnet.rb | 21 | ||||
-rw-r--r-- | mkconfig.rb | 4 | ||||
-rw-r--r-- | ruby.c | 4 |
14 files changed, 122 insertions, 70 deletions
@@ -11,6 +11,12 @@ Fri Apr 30 15:24:58 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * lib/mkmf.rb (enable_config): ditto. +Thu Apr 29 18:55:31 1999 WATANABE Hirofumi <eban@os.rim.or.jp> + + * dln.c (conv_to_posix_path): remove const from args. + + * ruby.c (rubylib_mangle): remove Fatal(), the obsolete function. + Tue Apr 27 14:11:45 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * parse.y (fname): lazy workaround for keywords did not work well. @@ -97,7 +103,7 @@ Fri Apr 16 15:09:20 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * config.guess: avoid 'linux-gnu' for alpha-unknown-linux. -Thu Apr 15 23:46:20 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> + Thu Apr 15 23:46:20 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> * ruby.c (rubylib_mangle): mangle path by RUBYLIB_PREFIX. diff --git a/Makefile.in b/Makefile.in index a62d4c8e47..0dea641c72 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,7 +13,8 @@ AUTOCONF = autoconf prefix = @prefix@ CFLAGS = @CFLAGS@ -I. -I@srcdir@ -I@includedir@ -LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@ @XLDFLAGS@ +LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@ +XLDFLAGS = @XLDFLAGS@ EXTLIBS = LIBS = @LIBS@ $(EXTLIBS) MISSING = @LIBOBJS@ @ALLOCA@ @@ -89,7 +90,7 @@ miniruby$(binsuffix): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.o $(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) @rm -f $@ - $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@ + $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@ $(LIBRUBY_A): $(OBJS) dmyext.o @AR@ rcu $@ $(OBJS) dmyext.o @@ -3829,7 +3829,7 @@ echo "$ac_t""$rb_cv_binary_elf" 1>&6 with_dln_a_out=yes host_os=${host_os}-a_out else - XLDFLAGS="-rdynamic" + LDFLAGS="-rdynamic" fi;; esac @@ -3863,11 +3863,11 @@ echo "configure:3844: checking whether OS depend dynamic link works" >&5 case "$host_os" in hpux*) DLDFLAGS="-E" LDSHARED='ld -b' - XLDFLAGS="-Wl,-E" + LDFLAGS="-Wl,-E" rb_cv_dlopen=yes;; solaris*) if test "$GCC" = yes; then LDSHARED='gcc -Wl,-G' - `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null && XLDFLAGS="-Wl,-E" + `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null && LDFLAGS="-Wl,-E" else LDSHARED='ld -G' fi @@ -3887,7 +3887,7 @@ echo "configure:3844: checking whether OS depend dynamic link works" >&5 freebsd*) LDSHARED="gcc -shared" if test -x /usr/bin/objformat && \ test `/usr/bin/objformat` = "elf" ; then - XLDFLAGS="-rdynamic" + LDFLAGS="-rdynamic" DLDFLAGS='-Wl,-soname,$(.TARGET)' rb_cv_freebsd_elf=yes else @@ -3897,7 +3897,7 @@ echo "configure:3844: checking whether OS depend dynamic link works" >&5 netbsd*) LDSHARED="ld -Bshareable" case "$host_cpu" in alpha|mips) - XLDFLAGS="-export-dynamic" ;; + LDFLAGS="-export-dynamic" ;; *) ;; esac diff --git a/configure.in b/configure.in index d33d7d73bb..d81032660e 100644 --- a/configure.in +++ b/configure.in @@ -357,7 +357,7 @@ main() { with_dln_a_out=yes host_os=${host_os}-a_out else - XLDFLAGS="-rdynamic" + LDFLAGS="-rdynamic" fi;; esac @@ -395,11 +395,11 @@ if test "$with_dln_a_out" != yes; then case "$host_os" in hpux*) DLDFLAGS="-E" LDSHARED='ld -b' - XLDFLAGS="-Wl,-E" + LDFLAGS="-Wl,-E" rb_cv_dlopen=yes;; solaris*) if test "$GCC" = yes; then LDSHARED='gcc -Wl,-G' - `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null && XLDFLAGS="-Wl,-E" + `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null && LDFLAGS="-Wl,-E" else LDSHARED='ld -G' fi @@ -419,7 +419,7 @@ if test "$with_dln_a_out" != yes; then freebsd*) LDSHARED="gcc -shared" if test -x /usr/bin/objformat && \ test `/usr/bin/objformat` = "elf" ; then - XLDFLAGS="-rdynamic" + LDFLAGS="-rdynamic" DLDFLAGS='-Wl,-soname,$(.TARGET)' rb_cv_freebsd_elf=yes else @@ -429,7 +429,7 @@ if test "$with_dln_a_out" != yes; then netbsd*) LDSHARED="ld -Bshareable" case "$host_cpu" in alpha|mips) - XLDFLAGS="-export-dynamic" ;; + LDFLAGS="-export-dynamic" ;; *) ;; esac @@ -1573,8 +1573,8 @@ dln_find_file(fname, path) #if defined(__CYGWIN32__) const char * conv_to_posix_path(win32, posix) - const char *win32; - const char *posix; + char *win32; + char *posix; { char *first = win32; char *p = win32; diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb index c499df97ad..2f6255b50f 100644 --- a/ext/dbm/extconf.rb +++ b/ext/dbm/extconf.rb @@ -1,5 +1,8 @@ require 'mkmf' $LDFLAGS = "-L/usr/local/lib" +if dir = with_config("dbm-include") + $CFLAGS = "-I#{dir}" +end have_library("gdbm", "dbm_open") or have_library("db", "dbm_open") or have_library("dbm", "dbm_open") diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index e0b31528f7..e02194f15f 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -101,7 +101,11 @@ def try_link(src, opt="") cfile = open("conftest.c", "w") cfile.print src cfile.close - xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt)) + begin + xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt)) + ensure + system "rm -f conftest*" + end end def try_cpp(src, opt=$CFLAGS) diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h index c6e0f7727f..612b941c65 100644 --- a/ext/socket/addrinfo.h +++ b/ext/socket/addrinfo.h @@ -48,6 +48,16 @@ #undef AI_PASSIVE #undef AI_CANONNAME #undef AI_NUMERICHOST +#undef AI_ALL +#undef AI_ADDRCONFIG +#undef AI_V4MAPPED +#undef AI_DEFAULT + +#undef NI_NOFQDN +#undef NI_NUMERICHOST +#undef NI_NAMEREQD +#undef NI_NUMERICSERV +#undef NI_DGRAM #define addrinfo addrinfo__compat #define getaddrinfo getaddrinfo__compat diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 5e059a425f..0fc5042b7d 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -1,7 +1,6 @@ require 'mkmf' $LDFLAGS = "-L/usr/local/lib" if File.directory?("/usr/local/lib") $CFLAGS ||= "" -$CFLAGS+=" -Dss_family=__ss_family -Dss_len=__ss_len" case PLATFORM when /mswin32/ @@ -28,7 +27,6 @@ if enable_config("ipv6", "yes") #include <sys/socket.h> main() { - exit(0); if (socket(AF_INET6, SOCK_STREAM, 0) < 0) exit(1); else @@ -236,17 +234,47 @@ end $objs = ["socket.o"] -if $getaddr_info_ok - have_func("getaddrinfo") - have_func("getnameinfo") +if $getaddr_info_ok or not $ipv6 + if have_func("getaddrinfo") and + have_func("getnameinfo") + have_getaddrinfo = true + end +end + +if have_getaddrinfo + if try_link(<<EOF) +#include <sys/types.h> +#include <netdb.h> +#include <string.h> +#include <sys/socket.h> +#include <netinet/in.h> +int +main() +{ + struct sockaddr_storage storage; + struct sockaddr_storage *addr; + + addr = &storage; + return 0; +} +EOF + sockaddr_storage=true + end else + sockaddr_storage=true + $CFLAGS="-I. "+$CFLAGS $objs += "getaddrinfo.o" $objs += "getnameinfo.o" end +if sockaddr_storage + $CFLAGS="-DSOCKADDR_STORAGE "+$CFLAGS +end + +p $ipv6 + have_header("sys/un.h") if have_func(test_func) - have_func("inet_aton") have_func("hsterror") unless have_func("gethostname") have_func("uname") diff --git a/ext/socket/socket.c b/ext/socket/socket.c index f8a0297ff3..840d1fad3a 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -48,6 +48,17 @@ extern int rb_thread_select(int, fd_set*, fd_set*, fd_set*, struct timeval*); /* # include "addrinfo.h" #endif +#ifdef SOCKADDR_STORAGE +# define ss_falily __ss_family +# define SS_LEN(ss) (ss)->__ss_len +#else +# define SOCKADDR_STORAGE sockaddr +# define ss_family sa_family +# ifdef SA_LEN +# define SS_LEN(ss) SA_LEN(ss) +# endif +#endif + VALUE rb_cBasicSocket; VALUE rb_cIPSocket; VALUE rb_cTCPSocket; @@ -468,27 +479,6 @@ ipaddr(sockaddr) } -#ifndef HAVE_INET_ATON -static unsigned long -inet_aton(host, inp) - char *host; - struct in_addr *inp; -{ - int d1, d2, d3, d4; - char ch; - - if (sscanf(host, "%d.%d.%d.%d%c", &d1, &d2, &d3, &d4, &ch) == 4 && - 0 <= d1 && d1 <= 255 && 0 <= d2 && d2 <= 255 && - 0 <= d3 && d3 <= 255 && 0 <= d4 && d4 <= 255) { - inp->s_addr = htonl( - ((long) d1 << 24) | ((long) d2 << 16) | - ((long) d3 << 8) | ((long) d4 << 0)); - return 1; - } - return 0; -} -#endif - static void setipaddr(name, addr) char *name; @@ -713,7 +703,7 @@ static VALUE tcp_s_gethostbyname(obj, host) VALUE obj, host; { - struct sockaddr_storage addr; + struct SOCKADDR_STORAGE addr; struct hostent *h; char **pch; VALUE ary, names; @@ -756,9 +746,9 @@ tcp_s_gethostbyname(obj, host) } if (h == NULL) { -#ifdef HAVE_HSTRERROR +#ifdef HAVE_HSTERROR extern int h_errno; - rb_raise(rb_eSocket, (char *)hstrerror(h_errno)); + rb_raise(rb_eSocket, (char *)hsterror(h_errno)); #else rb_raise(rb_eSocket, "host not found"); #endif @@ -862,7 +852,7 @@ tcp_accept(sock) VALUE sock; { OpenFile *fptr; - struct sockaddr_storage from; + struct SOCKADDR_STORAGE from; int fromlen; GetOpenFile(sock, fptr); @@ -928,7 +918,7 @@ ip_addr(sock) VALUE sock; { OpenFile *fptr; - struct sockaddr_storage addr; + struct SOCKADDR_STORAGE addr; int len = sizeof addr; GetOpenFile(sock, fptr); @@ -943,7 +933,7 @@ ip_peeraddr(sock) VALUE sock; { OpenFile *fptr; - struct sockaddr_storage addr; + struct SOCKADDR_STORAGE addr; int len = sizeof addr; GetOpenFile(sock, fptr); @@ -957,7 +947,7 @@ static VALUE ip_s_getaddress(obj, host) VALUE obj, host; { - struct sockaddr_storage addr; + struct SOCKADDR_STORAGE addr; if (rb_obj_is_kind_of(host, rb_cInteger)) { int i = NUM2INT(host); @@ -1081,7 +1071,7 @@ static VALUE udp_bind(sock, host, port) VALUE sock, host, port; { - struct sockaddr_storage addr; + struct SOCKADDR_STORAGE addr; OpenFile *fptr; struct addrinfo *res0, *res; @@ -1551,7 +1541,7 @@ static VALUE sock_s_gethostbyname(obj, host) VALUE obj, host; { - struct sockaddr_storage addr; + struct SOCKADDR_STORAGE addr; struct hostent *h; if (rb_obj_is_kind_of(host, rb_cInteger)) { @@ -1722,7 +1712,7 @@ sock_s_getnameinfo(argc, argv) int fl; struct addrinfo hints, *res = NULL; int error; - struct sockaddr_storage ss; + struct SOCKADDR_STORAGE ss; struct sockaddr *sap; sa = flags = Qnil; @@ -1733,9 +1723,11 @@ sock_s_getnameinfo(argc, argv) rb_raise(rb_eTypeError, "sockaddr length too big"); } memcpy(&ss, RSTRING(sa)->ptr, RSTRING(sa)->len); - if (RSTRING(sa)->len != ss.ss_len) { +#ifdef SS_LEN + if (RSTRING(sa)->len != SS_LEN(&ss)) { rb_raise(rb_eTypeError, "sockaddr size differs - should not happen"); } +#endif sap = (struct sockaddr *)&ss; } else if (TYPE(sa) == T_ARRAY) { diff --git a/lib/mkmf.rb b/lib/mkmf.rb index f3654c3ca2..fd2a3c4dc5 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -71,9 +71,8 @@ def xsystem command print command, "\n" return system(command) end -p command -# $stderr.reopen($null) -# $stdout.reopen($null) + $stderr.reopen($null) + $stdout.reopen($null) r = system(command) $stderr.reopen($orgerr) $stdout.reopen($orgout) @@ -84,7 +83,11 @@ def try_link(src, opt="") cfile = open("conftest.c", "w") cfile.print src cfile.close - xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt)) + begin + xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt)) + ensure + system "rm -f conftest*" + end end def try_cpp(src, opt=$CFLAGS) diff --git a/lib/telnet.rb b/lib/telnet.rb index a84180365b..855a9f5334 100644 --- a/lib/telnet.rb +++ b/lib/telnet.rb @@ -2,8 +2,7 @@ = simple telnet cliant library -telnet.rb ver0.163 1999/04/11 - +telnet.rb ver0.17 1999/04/30 Wakou Aoyama <wakou@fsinet.or.jp> @@ -144,6 +143,10 @@ of cource, set sync=TRUE or flush is necessary. = history +ver0.17 1999/04/30 +bug fix +$! + "\n" --> $!.to_s + "\n" + ver0.163 1999/04/11 STDOUT.write(message) --> yield(message) if iterator? @@ -316,8 +319,8 @@ class Telnet < SimpleDelegator rescue TimeoutError raise TimeOut, "timed-out; opening of the host" rescue - @log.write($! + "\n") if @options.include?("Output_log") - @dumplog.write($! + "\n") if @options.include?("Dump_log") + @log.write($!.to_s + "\n") if @options.include?("Output_log") + @dumplog.write($!.to_s + "\n") if @options.include?("Dump_log") raise end @sock.sync = TRUE @@ -400,11 +403,15 @@ class Telnet < SimpleDelegator waittime = @options["Waittime"] if options.kind_of?(Hash) - prompt = options["Prompt"] if options.include?("Prompt") + prompt = if options.include?("Match") + options["Match"] + elsif options.include?("Prompt") + options["Prompt"] + elsif options.include?("String") + Regexp.new( Regexp.quote(options["String"]) ) + end time_out = options["Timeout"] if options.include?("Timeout") waittime = options["Waittime"] if options.include?("Waittime") - prompt = Regexp.new( Regexp.quote(options["String"]) ) if - options.include?("String") else prompt = options end diff --git a/mkconfig.rb b/mkconfig.rb index 4c3265ad5a..0610020912 100644 --- a/mkconfig.rb +++ b/mkconfig.rb @@ -28,14 +28,12 @@ File.foreach "config.status" do |$_| if /^s%@program_transform_name@%s,(.*)%g$/ ptn = $1.sub(/\$\$/, '$').split(/,/) #' v_fast << " CONFIG[\"ruby_install_name\"] = \"" + "ruby".sub(ptn[0],ptn[1]) + "\"\n" - elsif /^s%@DLDFLAGS@%(.*)%g$/ - v_fast << " CONFIG[\"DLDFLAGS\"] = \"" + $1 + "\"\n" elsif /^s%@(\w+)@%(.*)%g/ name = $1 val = $2 || "" next if name =~ /^(INSTALL|DEFS|configure_input|srcdir|top_srcdir)$/ v = " CONFIG[\"" + name + "\"] = " + - val.sub(/^\s*(.*)\s*$/, '"\1"').gsub(/\$[{(]?([^})]+)[})]?/) { + val.sub(/^\s*(.*)\s*$/, '"\1"').gsub(/\$\{?([^(){}]+)\}?/) { "\#{CONFIG[\\\"#{$1}\\\"]}" } + "\n" if fast[name] @@ -150,7 +150,7 @@ rubylib_mangle(s, l) } newl = strlen(newp); if (newl == 0 || oldl == 0 || newl > STATIC_FILE_LENGTH) { - Fatal("malformed RUBYLIB_PREFIX"); + rb_fatal("malformed RUBYLIB_PREFIX"); } strcpy(ret, newp); s = ret; @@ -172,7 +172,7 @@ rubylib_mangle(s, l) return s; } if (l + newl - oldl > STATIC_FILE_LENGTH || newl > STATIC_FILE_LENGTH) { - Fatal("malformed RUBYLIB_PREFIX"); + rb_fatal("malformed RUBYLIB_PREFIX"); } strcpy(ret + newl, s + oldl); return ret; |