summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-30 07:55:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-30 07:55:47 +0000
commitb8669fe321c6f5e81d071d5790e51b9611fde860 (patch)
treed19d4f3da2790c53b046a861714f6fc21728d7e1
parentb87b7e3fc1499a9f56d1a49aff22838c2166950c (diff)
glibc 2.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--Makefile.in5
-rw-r--r--configure10
-rw-r--r--configure.in10
-rw-r--r--dln.c4
-rw-r--r--ext/dbm/extconf.rb3
-rw-r--r--ext/extmk.rb.in6
-rw-r--r--ext/socket/addrinfo.h10
-rw-r--r--ext/socket/extconf.rb40
-rw-r--r--ext/socket/socket.c56
-rw-r--r--lib/mkmf.rb11
-rw-r--r--lib/telnet.rb21
-rw-r--r--mkconfig.rb4
-rw-r--r--ruby.c4
14 files changed, 122 insertions, 70 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ffc7e9..17669ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 a62d4c8e..0dea641 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
diff --git a/configure b/configure
index 3524f7b..a4761d6 100644
--- a/configure
+++ b/configure
@@ -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 d33d7d7..d810326 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
diff --git a/dln.c b/dln.c
index 3f96dd3..305512f 100644
--- a/dln.c
+++ b/dln.c
@@ -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 c499df9..2f6255b 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 e0b3152..e02194f 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 c6e0f77..612b941 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 5e059a4..0fc5042 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 f8a0297..840d1fa 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 f3654c3..fd2a3c4 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 a841803..855a9f5 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 4c3265a..0610020 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]
diff --git a/ruby.c b/ruby.c
index 10df065..4f6dcea 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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;