1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1999-09-22 04:30:11 +00:00
parent 70a444b0cc
commit 8aad024e3a
11 changed files with 109 additions and 35 deletions

View file

@ -1,9 +1,38 @@
Wed Sep 22 09:20:11 1999 Masahiro Tomita <tommy@tmtm.org>
* ext/socket/socket.c: SOCKS5 support.
Wed Sep 22 00:35:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* string.c (rb_str_include): should return boolean value.
* regex.c (re_compile_fastmap): wrong comparison with mbc.
* eval.c (specific_eval): default sourcefile name should be
"(eval)" for module_eval etc.
Wed Sep 22 00:06:07 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
* win32/Makefile: update rules.
* io.c (io_fread): should not assign in char, it maybe -1.
Tue Sep 21 23:57:54 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (call_trace_func): should not propagate retval in
trace_func.
Mon Sep 20 21:35:39 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
* win32/win32.c (myselect): assume non socket files are always
readable/writable.
Mon Sep 20 01:08:02 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* io.c (io_fread): should not block other threads.
* io.c (rb_io_synchronized): renamed from rb_io_unbuffered(); do
not call setbuf(NULL) any more.
not call setbuf(NULL) anymore.
Sat Sep 18 13:45:43 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
@ -3772,7 +3801,7 @@ Sat Mar 28 20:40:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
Sat Mar 28 16:07:11 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
* io.c (io_closed): should not cause exception fot closed IO.
* io.c (io_closed): should not cause exception for closed IO.
* string.c (str_tr): returned nil for success.
@ -4526,7 +4555,7 @@ Fri Dec 12 00:50:25 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (rb_eval): new visibility status `function'.
* parse.y (yycompile): do not clear eval_tree. thus enable multipe
command line script by optn `-e'.
command line script by option `-e'.
* eval.c (rb_eval): END execute just once.
@ -5011,7 +5040,7 @@ Mon Sep 1 11:43:57 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
Fri Aug 29 11:10:21 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
* class.c (class_instance_methods): same method names should not
appear more than twice.
appear more than once.
* parse.y (yylex): spaces can follow =begin/=end.

8
eval.c
View file

@ -648,6 +648,10 @@ static struct tag *prot_tag;
prot_tag = _tag.prev; \
}
#define POP_TMPTAG() \
prot_tag = _tag.prev; \
}
#define TAG_RETURN 0x1
#define TAG_BREAK 0x2
#define TAG_NEXT 0x3
@ -1724,7 +1728,7 @@ call_trace_func(event, file, line, self, id, klass)
self?rb_f_binding(self):Qnil,
klass));
}
POP_TAG();
POP_TMPTAG(); /* do not propagate retval */
POP_FRAME();
rb_thread_critical--;
@ -4488,7 +4492,7 @@ specific_eval(argc, argv, klass, self)
VALUE *argv;
VALUE klass, self;
{
char *file = 0;
char *file = "(eval)";
int line = 1;
int iter = rb_iterator_p();

View file

@ -271,7 +271,9 @@ if have_func(test_func)
have_func("uname")
end
if ENV["SOCKS_SERVER"] or enable_config("socks", false)
if have_library("socks", "Rconnect")
if have_library("socks5", "SOCKSinit")
$CFLAGS="-DSOCKS5 -DSOCKS"
elsif have_library("socks", "Rconnect")
$CFLAGS="-DSOCKS"
end
end

View file

@ -63,9 +63,13 @@ static VALUE rb_eSocket;
#ifdef SOCKS
VALUE rb_cSOCKSSocket;
#ifdef SOCKS5
#include <socks.h>
#else
void SOCKSinit();
int Rconnect();
#endif
#endif
#define INET_CLIENT 0
#define INET_SERVER 1
@ -630,12 +634,15 @@ ruby_connect(fd, sockaddr, len, socks)
#else
# define NONBLOCKING O_NONBLOCK
#endif
#endif
#ifdef SOCKS5
if (!socks)
#endif
fcntl(fd, F_SETFL, mode|NONBLOCKING);
#endif /* HAVE_FCNTL */
for (;;) {
#ifdef SOCKS
#if defined(SOCKS) && !defined(SOCKS5)
if (socks) {
status = Rconnect(fd, sockaddr, len);
}

7
io.c
View file

@ -449,14 +449,15 @@ io_fread(ptr, len, f)
FILE *f;
{
size_t n = len;
int c;
while (n--) {
*ptr = getc(f);
if (*ptr == EOF) {
c = getc(f);
if (c == EOF) {
*ptr = '\0';
break;
}
ptr++;
*ptr++ = c;
if (!READ_DATA_PENDING(f)) {
rb_thread_wait_fd(fileno(f));
}

View file

@ -1,11 +1,11 @@
=begin
$Date: 1999/09/17 17:41:41 $
$Date: 1999/09/21 21:24:07 $
== SIMPLE TELNET CLIANT LIBRARY
telnet.rb
Version 0.40
Version 0.50
Wakou Aoyama <wakou@fsinet.or.jp>
@ -86,6 +86,7 @@ of cource, set sync=true or flush is necessary.
=== SEND STRING
host.print("string")
# == host.write("string\n")
=== TURN TELNET COMMAND INTERPRETATION
@ -154,6 +155,12 @@ of cource, set sync=true or flush is necessary.
== HISTORY
=== Version 0.50
1999/09/21 21:24:07
- add write method
=== Version 0.40
1999/09/17 17:41:41
@ -398,8 +405,8 @@ class Telnet < SimpleDelegator
EOL = CR + LF
v = $-v
$-v = false
VERSION = "0.40"
RELEASE_DATE = "$Date: 1999/09/17 17:41:41 $"
VERSION = "0.50"
RELEASE_DATE = "$Date: 1999/09/21 21:24:07 $"
$-v = v
def initialize(options)
@ -503,33 +510,33 @@ $-v = v
if IAC == $1 # handle escaped IAC characters
IAC
elsif AYT == $1 # respond to "IAC AYT" (are you there)
@sock.write("nobody here but us pigeons" + EOL)
self.write("nobody here but us pigeons" + EOL)
''
elsif DO[0] == $1[0] # respond to "IAC DO x"
if OPT_BINARY[0] == $1[1]
@telnet_option["BINARY"] = true
@sock.write(IAC + WILL + OPT_BINARY)
self.write(IAC + WILL + OPT_BINARY)
else
@sock.write(IAC + WONT + $1[1..1])
self.write(IAC + WONT + $1[1..1])
end
''
elsif DONT[0] == $1[0] # respond to "IAC DON'T x" with "IAC WON'T x"
@sock.write(IAC + WONT + $1[1..1])
self.write(IAC + WONT + $1[1..1])
''
elsif WILL[0] == $1[0] # respond to "IAC WILL x"
if OPT_ECHO[0] == $1[1]
@sock.write(IAC + DO + OPT_ECHO)
self.write(IAC + DO + OPT_ECHO)
elsif OPT_SGA[0] == $1[1]
@telnet_option["SGA"] = true
@sock.write(IAC + DO + OPT_SGA)
self.write(IAC + DO + OPT_SGA)
end
''
elsif WONT[0] == $1[0] # respond to "IAC WON'T x"
if OPT_ECHO[0] == $1[1]
@sock.write(IAC + DONT + OPT_ECHO)
self.write(IAC + DONT + OPT_ECHO)
elsif OPT_SGA[0] == $1[1]
@telnet_option["SGA"] = false
@sock.write(IAC + DONT + OPT_SGA)
self.write(IAC + DONT + OPT_SGA)
end
''
end
@ -591,6 +598,14 @@ $-v = v
line
end
def write(string)
length = string.length
while 0 < length
IO::select(nil, [@sock])
length -= @sock.syswrite(string)
end
end
def print(string)
str = string.dup + "\n"
@ -609,7 +624,7 @@ $-v = v
end
end
@sock.write(str)
self.write(str)
end
def cmd(options)
@ -624,7 +639,6 @@ $-v = v
string = options
end
IO::select(nil, [@sock])
self.print(string)
if iterator?
waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c }

View file

@ -1112,7 +1112,7 @@ re_compile_pattern(pattern, size, bufp)
register const char *p = pattern;
const char *nextp;
const char *pend = pattern + size;
register unsigned c, c1;
register unsigned int c, c1;
const char *p0;
int numlen;
@ -2832,7 +2832,7 @@ re_compile_fastmap(bufp)
while (beg <= end) {
/* NOTE: Charset for multi-byte chars might contain
single-byte chars. We must reject them. */
if (beg < 0x100)
if (c < 0x100)
fastmap[beg] = 2;
else if (ismbchar(beg))
fastmap[beg] = 1;

View file

@ -1275,7 +1275,7 @@ rb_str_include(str, arg)
for (i=0; i<len; i++) {
if (p[i] == c) {
return INT2NUM(i);
return Qtrue;
}
}
return Qfalse;
@ -1285,7 +1285,7 @@ rb_str_include(str, arg)
i = rb_str_index(str, arg, 0);
if (i == -1) return Qfalse;
return INT2NUM(i);
return Qtrue;
}
static VALUE

View file

@ -98,13 +98,13 @@ $(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(LIBRUBY_SO)
@rm -f $@
$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) -o $@ $(LIBRUBYARG) -link /STACK:$(STACK)
$(LIBRUBY_A): $(OBJS)
lib -nologo /OUT:$@ $(OBJS)
$(LIBRUBY_A): $(OBJS) dmyext.obj
lib -nologo /OUT:$@ $(OBJS) dmyext.obj
rubymw.lib: ruby.def
lib -nologo /OUT:$@ /DEF:ruby.def
$(LIBRUBY_SO): $(LIBRUBY_A) $(EXTOBJS)
$(LIBRUBY_SO): $(LIBRUBY_A) $(EXTOBJS) ruby.def
set LIB=.\win32;$(ORGLIBPATH)
@rm -f $@
$(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A) $(LIBS) -o $@ -link /DLL /DEF:ruby.def

View file

@ -33,6 +33,7 @@ EXPORTS
rb_mErrno
;eval.c
rb_cProc
ruby_frame
rb_cThread
rb_thread_tick
rb_thread_critical
@ -72,6 +73,8 @@ EXPORTS
rb_cRange
;re.c
rb_cRegexp
;regex.c
re_mbctab
;ruby.c
ruby_debug
ruby_verbose
@ -370,7 +373,7 @@ EXPORTS
rb_fdopen
rb_file_open
rb_file_sysopen
rb_io_unbuffered
rb_io_synchronized
rb_p
rb_gets
rb_str_setter

View file

@ -677,7 +677,8 @@ mypclose(FILE *fp)
//
// close the pipe
//
CloseHandle(MyPopenRecord[i].oshandle);
// Closehandle() is done by fclose().
//CloseHandle(MyPopenRecord[i].oshandle);
fflush(fp);
fclose(fp);
@ -1835,7 +1836,20 @@ myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
errno = EINTR;
break;
case WSAENOTSOCK:
errno = EBADF;
// assume normal files are always readable/writable
// fake read/write fd_set and return value
r = 0;
if (rd) r += rd->fd_count;
if (wr) r += wr->fd_count;
if (ex && ex->fd_count > 0) {
// exceptional condition never happen for normal files
if (r > 0)
ex->fd_count = 0;
else {
errno = EBADF;
r = SOCKET_ERROR;
}
}
break;
}
}