diff options
-rw-r--r-- | ChangeLog | 161 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | README.EXT | 2 | ||||
-rw-r--r-- | README.jp | 2 | ||||
-rw-r--r-- | array.c | 87 | ||||
-rw-r--r-- | bignum.c | 6 | ||||
-rw-r--r-- | class.c | 21 | ||||
-rw-r--r-- | compar.c | 4 | ||||
-rw-r--r-- | config.guess | 4 | ||||
-rw-r--r-- | config.sub | 2 | ||||
-rw-r--r-- | configure | 512 | ||||
-rw-r--r-- | configure.in | 18 | ||||
-rw-r--r-- | dir.c | 6 | ||||
-rw-r--r-- | dln.c | 4 | ||||
-rw-r--r-- | dln.h | 7 | ||||
-rw-r--r-- | enum.c | 5 | ||||
-rw-r--r-- | env.h | 7 | ||||
-rw-r--r-- | error.c | 12 | ||||
-rw-r--r-- | eval.c | 92 | ||||
-rw-r--r-- | ext/extmk.rb.in | 2 | ||||
-rw-r--r-- | ext/socket/extconf.rb | 2 | ||||
-rw-r--r-- | ext/socket/getaddrinfo.c | 4 | ||||
-rw-r--r-- | ext/socket/socket.c | 45 | ||||
-rw-r--r-- | ext/tk/lib/tktext.rb | 39 | ||||
-rw-r--r-- | file.c | 6 | ||||
-rw-r--r-- | gc.c | 6 | ||||
-rw-r--r-- | hash.c | 6 | ||||
-rw-r--r-- | inits.c | 4 | ||||
-rw-r--r-- | intern.h | 19 | ||||
-rw-r--r-- | io.c | 65 | ||||
-rw-r--r-- | lib/cgi.rb | 61 | ||||
-rw-r--r-- | lib/cgi/session.rb | 2 | ||||
-rw-r--r-- | lib/debug.rb | 314 | ||||
-rw-r--r-- | lib/net/telnet.rb | 749 | ||||
-rw-r--r-- | lib/telnet.rb | 742 | ||||
-rw-r--r-- | lib/thread.rb | 6 | ||||
-rw-r--r-- | lib/timeout.rb | 3 | ||||
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | marshal.c | 6 | ||||
-rw-r--r-- | math.c | 4 | ||||
-rw-r--r-- | misc/ruby-mode.el | 46 | ||||
-rw-r--r-- | node.h | 5 | ||||
-rw-r--r-- | numeric.c | 14 | ||||
-rw-r--r-- | object.c | 8 | ||||
-rw-r--r-- | pack.c | 4 | ||||
-rw-r--r-- | parse.y | 20 | ||||
-rw-r--r-- | prec.c | 4 | ||||
-rw-r--r-- | process.c | 6 | ||||
-rw-r--r-- | random.c | 4 | ||||
-rw-r--r-- | range.c | 4 | ||||
-rw-r--r-- | re.c | 6 | ||||
-rw-r--r-- | re.h | 6 | ||||
-rw-r--r-- | regex.c | 6 | ||||
-rw-r--r-- | ruby.c | 2 | ||||
-rw-r--r-- | ruby.h | 8 | ||||
-rw-r--r-- | rubyio.h | 4 | ||||
-rw-r--r-- | rubysig.h | 7 | ||||
-rw-r--r-- | sample/test.rb | 6 | ||||
-rw-r--r-- | signal.c | 4 | ||||
-rw-r--r-- | sprintf.c | 2 | ||||
-rw-r--r-- | string.c | 39 | ||||
-rw-r--r-- | struct.c | 6 | ||||
-rw-r--r-- | time.c | 4 | ||||
-rw-r--r-- | util.c | 4 | ||||
-rw-r--r-- | util.h | 5 | ||||
-rw-r--r-- | variable.c | 8 | ||||
-rw-r--r-- | version.c | 4 | ||||
-rw-r--r-- | version.h | 4 |
69 files changed, 1836 insertions, 1450 deletions
@@ -1,3 +1,58 @@ +Sat Apr 29 04:58:12 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> + + * array.c (rb_ary_unshift_m): performance improvement. + +Fri Apr 28 00:19:22 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> + + * array.c (rb_ary_unshift_m): takes items to push. + +Wed Apr 26 15:23:02 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * string.c (rb_str_succ): insert carrying character just before + the leftmost alpha numeric character. + + * string.c (rb_str_succ): proper behavior for "".succ and "\377".succ. + + * string.c (rb_str_succ): use realloc and memmove. + +Tue Apr 25 14:30:13 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * io.c (rb_io_gets_internal): shortcut when rs == rb_default_rs. + +Sat Apr 22 23:14:41 2000 SHIROYAMA Takayuki <psi@fortune.nest.or.jp> + + * configure.in: MacOS X support. + +Fri Apr 21 21:44:34 2000 WATANABE Hirofumi <eban@os.rim.or.jp> + + * io.c (rb_io_s_pipe): should set FMODE_SYNC. + +Thu Apr 20 16:59:22 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> + + * eval.c (massign): `*lvalue = false' should assign `[false]' to + lvalue. + +Wed Apr 19 08:35:08 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * class.c (rb_singleton_class): generate singleton class for + special constants: nil, true, false. + +Wed Apr 19 02:09:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * class.c (rb_singleton_class): singleton method for nil, true, + false is possible now. + + * eval.c (rb_eval): ditto. + +Mon Apr 17 15:16:31 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * io.c (rb_io_close): to detect some exceptional status, writable + IO should be flushed before close; + +Sat Apr 15 18:29:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * array.c (rb_ary_collect_bang): Array#filter renamed. + Tue Apr 11 21:14:42 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp> * config_s.dj: add @sitedir@. @@ -115,7 +170,7 @@ Tue Mar 21 12:57:50 2000 Yukihiro Matsumoto <matz@netlab.co.jp> Sat Mar 18 12:36:09 2000 Nobuyoshi Nakada <nobu.nokada@softhome.net> - * eval.c (rb_backtrace, make_backtrace): removed unsed variable + * eval.c (rb_backtrace, make_backtrace): removed unused variable `lev'. * eval.c (rb_attr): calls `method_added' at attribute definition. @@ -548,7 +603,7 @@ Mon Jan 24 02:56:44 2000 Yukihiro Matsumoto <matz@netlab.co.jp> * eval.c (rb_eval): when defining class is already there, and superclass differ, throw away the old class. - * variable.c (rb_const_set): gives warining again on constant + * variable.c (rb_const_set): gives warning again on constant redefinition. * error.c (Init_Exception): SyntaxError, NameError, LoadError and @@ -704,7 +759,7 @@ Mon Dec 27 12:35:47 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp> Sun Dec 26 23:15:13 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp> * win32/win32.c (mypopen): raise catchable error instead of rb_fatal. - * win32/win32.c (mypclose): fix process handle laek. + * win32/win32.c (mypclose): fix process handle leak. Sun Dec 26 16:17:11 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp> @@ -735,7 +790,7 @@ Tue Dec 21 17:21:28 1999 Koji Oda <oda@bsd1.qnes.nec.co.jp> Mon Dec 20 19:08:12 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> - * file.c (rb_file_s_expand_path): handle dir separetor correctly. + * file.c (rb_file_s_expand_path): handle dir separator correctly. Sun Dec 19 22:56:31 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp> @@ -768,7 +823,7 @@ Wed Dec 15 01:35:29 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Mon Dec 13 15:15:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * regex.c (re_adjust_startpos): separate startpos adjustment - because of major performace drawback. + because of major performance drawback. * class.c (rb_singleton_class): tainted status of the singleton class must be synchronized with the object. @@ -931,7 +986,7 @@ Sat Nov 20 10:10:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Fri Nov 19 18:06:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp> - * dir.c (glob): recurseve wildcard match by `**' ala zsh. + * dir.c (glob): recursive wildcard match by `**' ala zsh. Fri Nov 19 11:44:26 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp> @@ -981,7 +1036,7 @@ Sat Nov 13 07:34:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp> assign shared variables within methods. * eval.c (rb_eval): remove warnings from constants modification, - becase they are no longer constants. + because they are no longer constants. * parse.y (node_assign): modified for shared variables. @@ -1364,7 +1419,7 @@ Wed Sep 1 00:28:27 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Fri Aug 28 17:32:55 1999 Yasuhiro Fukuma <yasuf@big.or.jp> * eval.c (rb_eval): should set return value (nil) explicitly if a - value is ommited for return statement. + value is omitted for return statement. Thu Aug 26 15:06:11 1999 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp> @@ -1389,7 +1444,7 @@ Fri Aug 20 20:50:58 1999 Kenji Nagasawa <kenn@hma.att.ne.jp> Thu Aug 19 10:50:43 1999 WATANABE Tetsuya <tetsu@jpn.hp.com> - * gc.c (rb_gc): add volatile to avoid GCC optimaize bug(?). + * gc.c (rb_gc): add volatile to avoid GCC optimize bug(?). Wed Aug 18 23:48:10 1999 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -1404,7 +1459,7 @@ Fri Aug 13 15:41:39 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Fri Aug 13 03:16:07 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * io.c (argf_forward): since $stdout may be non-IO, ARGF.file is - not granteed to be IO. check and forwarding added to every ARGF + not guaranteed to be IO. check and forwarding added to every ARGF method. * io.c (set_outfile): $stdout/$stderr may not be IO now. @@ -1544,7 +1599,7 @@ Fri Jul 30 02:11:48 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * io.c (rb_io_fptr_close): do not call rb_sys_wait() on finalize. - * eval.c (yield_under_i): cbase context should be maintaind for + * eval.c (yield_under_i): cbase context should be maintained for Module#module_eval(). suggested by <inaba@st.rim.or.jp>. Wed Jul 28 01:18:28 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> @@ -1583,7 +1638,7 @@ Fri Jul 23 02:49:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Thu Jul 22 19:37:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp> - * eval.c (rb_thread_join): get_backtrace() may retrun Qnil. + * eval.c (rb_thread_join): get_backtrace() may return Qnil. typecheck added. Tue Jul 20 14:36:43 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> @@ -1634,7 +1689,7 @@ Fri Jul 16 10:58:22 1999 WATANABE Tetsuya <tetsu@jpn.hp.com> Fri Jul 16 09:58:15 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp> - * many files: clean up unsed variables found by gcc -Wall. + * many files: clean up unused variables found by gcc -Wall. * lib/mkmf.rb: better cygwin support etc. @@ -1966,7 +2021,7 @@ Fri Jun 11 23:27:00 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp> Fri Jun 11 15:21:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp> - * gc.c (rb_gc_mark_locations): add safty margin 1. + * gc.c (rb_gc_mark_locations): add safety margin 1. * eval.c (ruby_run): should protect toplevel node tree. @@ -1975,7 +2030,7 @@ Fri Jun 11 15:21:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Fri Jun 11 01:50:25 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * eval.c (ruby_run): Init_stack() was called too late; local - variables happend to be higher (or lower) than stack_start. + variables happened to be higher (or lower) than stack_start. Thu Jun 10 16:41:48 1999 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -2080,7 +2135,7 @@ Tue Jun 1 15:29:33 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * eval.c (module_setup): need to add PUSH_VAR/POP_VAR to clear dyna vars link list. - * version.h (RUBY_RELEASE_CODE): integer macro contant for source + * version.h (RUBY_RELEASE_CODE): integer macro constant for source version detection. Sun May 30 22:19:12 1999 Kenji Nagasawa <kenn@tcp-ip.or.jp> @@ -2133,7 +2188,7 @@ Fri May 28 17:16:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * ext/socket/socket.c (setipaddr): re-wrote using ip_addrsetup(). - * ext/sockt/socket.c (ip_addrsetup): decode symbolic address + * ext/socket/socket.c (ip_addrsetup): decode symbolic address <broadcast>. Thu May 27 12:27:42 1999 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -2331,7 +2386,7 @@ Thu May 6 13:21:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Thu May 4 12:34:18 1999 Koji Arai <JCA02266@nifty.ne.jp> - * parse.y (parse_string): there shuould be newline escape by + * parse.y (parse_string): there should be newline escape by backslashes in strings. * parse.y (parse_qstring): ditto. @@ -2696,7 +2751,7 @@ Fri Mar 12 02:12:50 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Thu Mar 11 18:23:50 1999 WATANABE Tetsuya <tetsu@jpn.hp.com> - * ext/socket/socket.c (Init_socket): UDPsocket was ommited. + * ext/socket/socket.c (Init_socket): UDPsocket was omitted. Thu Mar 11 16:43:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -2775,8 +2830,8 @@ Tue Mar 2 17:04:19 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Mon Mar 1 14:05:12 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * eval.c (rb_call0): adjust argv for optional arguments. super - without arguments emit superclasse method with the value from - optinal arguments. enabled as experiment. + without arguments emit superclass method with the value from + optional arguments. enabled as experiment. Sun Feb 28 14:04:07 1999 WATANABE Hirofumi <eban@os.rim.or.jp> @@ -2864,9 +2919,9 @@ Tue Feb 23 14:21:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Tue Feb 23 12:32:41 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> - * eval.c (rb_load): tilde expandion moved to find_file. + * eval.c (rb_load): tilde expansion moved to find_file. - * eval.c (find_file): tilde expandion added. + * eval.c (find_file): tilde expansion added. Tue Feb 23 10:50:20 1999 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -2913,18 +2968,18 @@ Fri Feb 19 00:25:57 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * time.c (time_plus): Time#+ should not receive Time object operand. - * string.c (rb_str_substr): nagative length raises exception now. + * string.c (rb_str_substr): negative length raises exception now. * array.c (beg_len): if end == -1, it points end of the array. - * array.c (rb_ary_subseq): nagative length raises exception now. + * array.c (rb_ary_subseq): negative length raises exception now. Thu Feb 18 20:57:04 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp> * time.c (rb_strftime): strftime() may return 0 on success too. - * time.c (time_strftime): `\0' within format string shoule not be - ommited in the result. + * time.c (time_strftime): `\0' within format string should not be + omitted in the result. * time.c (rb_strftime): zero length format. @@ -2992,7 +3047,7 @@ Mon Feb 15 11:43:22 1999 GOTO Kentaro <gotoken@math.sci.hokudai.ac.jp> Sun Feb 14 22:36:40 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp> - * sprintf.c (rb_f_sprintf): `%G' was ommited. + * sprintf.c (rb_f_sprintf): `%G' was omitted. Sun Feb 14 12:47:48 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp> @@ -3001,7 +3056,7 @@ Sun Feb 14 12:47:48 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp> * numeric.c (Init_Numeric): FloatDomainError added. * configure.in (AC_REPLACE_FUNCS): add checks for functions - insinf, isnan, and finite. + isinf, isnan, and finite. Sat Feb 13 01:24:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -3075,7 +3130,7 @@ Sat Feb 6 22:56:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Sat Feb 6 03:06:17 1999 Yukihiro Matsumoto <matz@netlab.co.jp> - * re.c (match_getter): accessng $~ without matching caused SEGV. + * re.c (match_getter): accessing $~ without matching caused SEGV. Fri Feb 5 22:11:08 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp> @@ -3107,7 +3162,7 @@ Thu Feb 4 11:56:24 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * configure.in (strtod): add strtod compatible check. - * numeric.c (rb_num2long): missing/vsnprintf.c does not supprt + * numeric.c (rb_num2long): missing/vsnprintf.c does not support floating points. * numeric.c (flo_to_s): ditto. @@ -3147,7 +3202,7 @@ Wed Feb 3 15:03:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp> Tue Feb 2 17:11:26 1999 WATANABE Tetsuya <tetsu@jpn.hp.com> - * string.c (rb_str_gsub_bang): too small realoc condition. + * string.c (rb_str_gsub_bang): too small realloc condition. Mon Feb 1 10:01:17 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp> @@ -3164,7 +3219,7 @@ Sat Jan 30 08:45:16 1999 IKARASHI Akira <ikarashi@itlb.te.noda.sut.ac.jp> Sat Jan 30 13:38:24 1999 Yukihiro Matsumoto <matz@netlab.co.jp> * regex.c (re_compile_pattern): mbchars should match with \w - within character classs. Was matching with \W. + within character class. Was matching with \W. * regex.c (re_match): \w should match with multi byte characters, not its first byte. @@ -3461,7 +3516,7 @@ Mon Dec 7 22:08:22 1998 Yukihiro Matsumoto <matz@netlab.co.jp> Mon Dec 7 18:24:50 1998 WATANABE Tetsuya <tetsu@jpn.hp.com> - * ruby.c (set_arg0): $0 supprt for HP-UX. + * ruby.c (set_arg0): $0 support for HP-UX. Mon Dec 7 01:30:28 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> @@ -3624,7 +3679,7 @@ Wed Nov 11 10:54:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp> Tue Nov 10 00:22:11 1998 EGUCHI Osamu <eguchi@shizuokanet.ne.jp> - * configure.in: elf supprt for FreeBSD 3.x + * configure.in: elf support for FreeBSD 3.x Tue Nov 10 00:05:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -3755,7 +3810,7 @@ Fri Oct 16 15:31:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp> Thu Oct 15 13:54:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp> - * parse.y (arg): local variabls can be accessed within right side + * parse.y (arg): local variables can be accessed within right side expression in assignment, notably in blocks. Wed Oct 14 00:18:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -3869,7 +3924,7 @@ Mon Sep 14 14:42:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp> * regex.c (re_match): beginning and end of the string, do not automatically match `\b'. - * string.c (scan_once): comsume at leaset on character. + * string.c (scan_once): consume at least on character. * regex.c (re_search): wrong behavior for negative range. @@ -4197,7 +4252,7 @@ Fri Jul 3 11:20:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp> * numeric.c (fix_mul): use FIX2LONG() instead of FIX2INT() for 64bit architectures. - * marshal.c (r_bytes): remove weird casting bwetween pointer and int. + * marshal.c (r_bytes): remove weird casting between pointer and int. * process.c (proc_setsid): new method Process#setsid(). @@ -4656,7 +4711,7 @@ Tue Apr 28 00:07:38 1998 Yukihiro Matsumoto <matz@netlab.co.jp> Mon Apr 27 16:59:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp> * ext/gtk/gtk.c (Init_gtk): use timeout, not idle to avoid - comsuming CPU too much. + consuming CPU too much. * lib/tk.rb: use tcltklib#_invoke instead of `_eval'. @@ -4997,7 +5052,7 @@ Tue Mar 31 13:23:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp> Mon Mar 30 11:12:29 1998 Yukihiro Matsumoto <matz@netlab.co.jp> - * file.c (f_test): raises exception for unkown command. + * file.c (f_test): raises exception for unknown command. * eval.c (Init_eval): `class_eval': alias to the module_eval. @@ -5114,7 +5169,7 @@ Wed Mar 18 17:46:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp> * ruby.c (load_file): new file object constant DATA. Only available for the script from the file. - * regex.c (re_match): forwading failure point popped too much. + * regex.c (re_match): forwarding failure point popped too much. Tue Mar 17 18:23:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -5229,7 +5284,7 @@ Fri Mar 6 17:23:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp> primitive classes (mostly perfect). * ext/curses/curses.c (curses_finalize): restore original state at - interpreter temination. + interpreter termination. * ext/curses/curses.c (curses_addstr): forgot to check argument type (caused SEGV). now uses STR2CSTR() macro. @@ -5273,7 +5328,7 @@ Tue Mar 3 11:21:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp> Tue Mar 3 08:04:56 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp> - * struct.c (struct_alloc): imcomplete struct initialization made + * struct.c (struct_alloc): incomplete struct initialization made GC to access unallocated addresses. Mon Mar 2 16:28:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -5644,7 +5699,7 @@ Tue Jan 6 00:27:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp> Mon Jan 5 16:59:13 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> - * file.c (file_s_basename): removes any extention by ".*". + * file.c (file_s_basename): removes any extension by ".*". Sun Jan 4 19:36:22 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp> @@ -5782,7 +5837,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 + * parse.y (yycompile): do not clear eval_tree. thus enable multiple command line script by option `-e'. * eval.c (rb_eval): END execute just once. @@ -5863,7 +5918,7 @@ Mon Dec 1 15:24:41 1997 Yukihiro Matsumoto <matz@netlab.co.jp> Wed Nov 26 18:18:05 1997 Yukihiro Matsumoto <matz@netlab.co.jp> - * lib/mkmf.rb: generate Makefile for extention modules out of ruby + * lib/mkmf.rb: generate Makefile for extension modules out of ruby source tree. use like `ruby -r mkmf extconf.rb'. * numeric.c (fix2str): enlarge buffer to prevent overflow on some @@ -6061,7 +6116,7 @@ Fri Oct 3 10:51:10 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * eval.c (ruby_options): f_require() called too early. - * eval.c (rb_provide): module extentions should always be `.o'. + * eval.c (rb_provide): module extensions should always be `.o'. Thu Oct 2 11:38:31 1997 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -6257,7 +6312,7 @@ Mon Sep 1 13:42:48 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * class.c (rb_define_attr): always defines accessors. - * eval.c (rb_call): alias occured in the module body caused SEGV. + * eval.c (rb_call): alias occurred in the module body caused SEGV. * parse.y: did not generate here document strings properly. @@ -6276,7 +6331,7 @@ Fri Aug 29 11:10:21 1997 Yukihiro Matsumoto <matz@netlab.co.jp> unnamed fundamental classes, such as Object, String, etc. * variable.c (rb_name_class): can't name class before String class - is initilialized. + is initialized. * inits.c (rb_call_inits): unrecognized dependency from GC to Array. @@ -6310,7 +6365,7 @@ Wed Aug 27 11:32:42 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * variable.c (fc_i): some classes/modules does not have iv_tbl. - * variable.c (find_class_path): avoid inifinite loop. + * variable.c (find_class_path): avoid infinite loop. Tue Aug 26 13:43:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -6327,7 +6382,7 @@ Tue Aug 26 13:43:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * object.c (Init_Object): superclass()'s method argument setting was wrong again. - * class.c (mod_anscestors): list superclasses and included modules + * class.c (mod_ancestors): list superclasses and included modules in priority order. Mon Aug 25 11:53:11 1997 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -6342,7 +6397,7 @@ Mon Aug 25 11:53:11 1997 Yukihiro Matsumoto <matz@netlab.co.jp> Sat Aug 23 21:39:05 1997 Yukihiro Matsumoto <matz@netlab.co.jp> - * parse.y (asignable): remove unnecessary local variable + * parse.y (assignable): remove unnecessary local variable initialize by nil. Fri Aug 22 14:26:40 1997 Yukihiro Matsumoto <matz@netlab.co.jp> @@ -6407,7 +6462,7 @@ Fri Aug 15 15:49:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * eval.c (call_trace_func): block context switch in the trace function. - * eval.c (rb_eval): clear method cache at class extention. + * eval.c (rb_eval): clear method cache at class extension. * object.c (obj_type): returns object's class even if it defines singleton methods. @@ -130,6 +130,7 @@ lib/net/ftp.rb lib/net/pop.rb lib/net/protocol.rb lib/net/smtp.rb +lib/net/telnet.rb lib/observer.rb lib/open3.rb lib/ostruct.rb @@ -129,7 +129,7 @@ You can redistribute it and/or modify it under either the terms of the GPL 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * Ruby home-page diff --git a/README.EXT b/README.EXT index cd0be84b56..90673661e9 100644 --- a/README.EXT +++ b/README.EXT @@ -881,7 +881,7 @@ Returns the name of the class. int rb_respond_to(VALUE object, ID id) -Returns true if the object reponds to the message specified by id. +Returns true if the object responds to the message specified by id. ** Instance Variables @@ -172,7 +172,7 @@ Public License)¤Þ¤¿¤Ï°Ê²¼¤Ë¼¨¤¹¾ò·ï¤ÇËÜ¥×¥í¥°¥é¥à¤òºÆÇÛÉÛ¤Ç 4. ¾¤Î¥×¥í¥°¥é¥à¤Ø¤Î°úÍѤϤ¤¤«¤Ê¤ëÌÜŪ¤Ç¤¢¤ì¼«Í³¤Ç¤¹¡¥¤¿ ¤À¤·¡¤ËÜ¥×¥í¥°¥é¥à¤Ë´Þ¤Þ¤ì¤ë¾¤Îºî¼Ô¤Ë¤è¤ë¥³¡¼¥É¤Ï¡¤¤½ - ¤ì¤¾¤ì¤Îºî¼Ô¤Î°Õ¸þ¤Ë¤è¤ëÀ©¸Â¤¬²Ã¤¨¤é¤ë¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡¥ + ¤ì¤¾¤ì¤Îºî¼Ô¤Î°Õ¸þ¤Ë¤è¤ëÀ©¸Â¤¬²Ã¤¨¤é¤ì¤ë¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡¥ ¶ñÂÎŪ¤Ë¤Ïgc.c(°ìÉô)¡¤util.c(°ìÉô)¡¤st.[ch]¡¤regex.[ch] ¤ª¤è¤Ó ./missing¥Ç¥£¥ì¥¯¥È¥ê²¼¤Î¥Õ¥¡¥¤¥ë·²¤¬³ºÅö¤·¤Þ¤¹¡¥ @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** array.c - @@ -7,8 +7,10 @@ created at: Fri Aug 6 09:46:12 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" #include "util.h" @@ -276,8 +278,15 @@ rb_ary_push_m(argc, argv, ary) VALUE *argv; VALUE ary; { - while (argc--) { - rb_ary_store(ary, RARRAY(ary)->len, *argv++); + if (argc > 0) { + long len = RARRAY(ary)->len; + + --argc; + /* make rooms by copying the last item */ + rb_ary_store(ary, len + argc, argv[argc]); + + if (argc) /* if any rest */ + MEMCPY(RARRAY(ary)->ptr + len, argv, VALUE, argc); } return ary; } @@ -340,6 +349,26 @@ rb_ary_unshift(ary, item) return ary; } +static VALUE +rb_ary_unshift_m(argc, argv, ary) + int argc; + VALUE *argv; + VALUE ary; +{ + if (argc > 0) { + long len = RARRAY(ary)->len; + + /* make rooms by setting the last item */ + rb_ary_store(ary, len + argc - 1, Qnil); + + /* sliding items */ + MEMMOVE(RARRAY(ary)->ptr + argc, RARRAY(ary)->ptr, VALUE, len); + + MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc); + } + return ary; +} + VALUE rb_ary_entry(ary, offset) VALUE ary; @@ -980,6 +1009,27 @@ rb_ary_collect(ary) return collect; } +static VALUE +rb_ary_collect_bang(ary) + VALUE ary; +{ + long i; + + rb_ary_modify(ary); + for (i = 0; i < RARRAY(ary)->len; i++) { + RARRAY(ary)->ptr[i] = rb_yield(RARRAY(ary)->ptr[i]); + } + return ary; +} + +static VALUE +rb_ary_filter(ary) + VALUE ary; +{ + rb_warn("Array#filter is deprecated; use Array#collect!"); + return rb_ary_collect_bang(ary); +} + VALUE rb_ary_delete(ary, item) VALUE ary; @@ -1092,19 +1142,6 @@ rb_ary_delete_if(ary) } static VALUE -rb_ary_filter(ary) - VALUE ary; -{ - long i; - - rb_ary_modify(ary); - for (i = 0; i < RARRAY(ary)->len; i++) { - RARRAY(ary)->ptr[i] = rb_yield(RARRAY(ary)->ptr[i]); - } - return ary; -} - -static VALUE rb_ary_replace_m(ary, ary2) VALUE ary, ary2; { @@ -1195,17 +1232,9 @@ VALUE rb_ary_concat(x, y) VALUE x, y; { - VALUE *p, *pend; - - rb_ary_modify(x); Check_Type(y, T_ARRAY); - p = RARRAY(y)->ptr; - pend = p + RARRAY(y)->len; - while (p < pend) { - rb_ary_store(x, RARRAY(x)->len, *p); - p++; - } + rb_ary_push_m(RARRAY(y)->len, RARRAY(y)->ptr, x); return x; } @@ -1575,7 +1604,7 @@ Init_Array() rb_define_method(rb_cArray, "push", rb_ary_push_m, -1); rb_define_method(rb_cArray, "pop", rb_ary_pop, 0); rb_define_method(rb_cArray, "shift", rb_ary_shift, 0); - rb_define_method(rb_cArray, "unshift", rb_ary_unshift, 1); + rb_define_method(rb_cArray, "unshift", rb_ary_unshift_m, -1); rb_define_method(rb_cArray, "each", rb_ary_each, 0); rb_define_method(rb_cArray, "each_index", rb_ary_each_index, 0); rb_define_method(rb_cArray, "reverse_each", rb_ary_reverse_each, 0); @@ -1594,11 +1623,13 @@ Init_Array() rb_define_method(rb_cArray, "sort", rb_ary_sort, 0); rb_define_method(rb_cArray, "sort!", rb_ary_sort_bang, 0); rb_define_method(rb_cArray, "collect", rb_ary_collect, 0); + rb_define_method(rb_cArray, "collect!", rb_ary_collect_bang, 0); + rb_define_method(rb_cArray, "map!", rb_ary_collect_bang, 0); + rb_define_method(rb_cArray, "filter", rb_ary_filter, 0); rb_define_method(rb_cArray, "delete", rb_ary_delete, 1); rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at_m, -1); rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0); rb_define_method(rb_cArray, "reject!", rb_ary_delete_if, 0); - rb_define_method(rb_cArray, "filter", rb_ary_filter, 0); rb_define_method(rb_cArray, "replace", rb_ary_replace_m, 1); rb_define_method(rb_cArray, "clear", rb_ary_clear, 0); rb_define_method(rb_cArray, "fill", rb_ary_fill, -1); @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** bignum.c - @@ -6,7 +6,9 @@ $Date$ created at: Fri Jun 10 00:48:55 JST 1994 -************************************************/ + Copyright (C) 1993-2000 Yukihiro Matsumoto + +**********************************************************************/ #include "ruby.h" #include <math.h> @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** class.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include "node.h" @@ -502,15 +502,30 @@ rb_undef_method(klass, name) rb_add_method(klass, rb_intern(name), 0, NOEX_UNDEF); } +#define SPECIAL_SINGLETON(x,c) if (obj == (x)) {\ + if (!FL_TEST(c, FL_SINGLETON)) {\ + c = rb_singleton_class_new(c);\ + rb_singleton_class_attached(c,obj);\ + }\ + return c;\ +} + VALUE rb_singleton_class(obj) VALUE obj; { VALUE klass; - if (rb_special_const_p(obj)) { + if (FIXNUM_P(obj) || SYMBOL_P(obj)) { rb_raise(rb_eTypeError, "can't define singleton"); } + if (rb_special_const_p(obj)) { + SPECIAL_SINGLETON(Qnil, rb_cNilClass); + SPECIAL_SINGLETON(Qfalse, rb_cFalseClass); + SPECIAL_SINGLETON(Qtrue, rb_cTrueClass); + rb_bug("unknown immediate %d", obj); + } + if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON)) { klass = RBASIC(obj)->klass; } @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** compar.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" diff --git a/config.guess b/config.guess index 53ebbce1a9..20ad33d44f 100644 --- a/config.guess +++ b/config.guess @@ -969,6 +969,10 @@ EOF *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; + *:"Mac OS":*:*) + echo `uname -p`-apple-macos${UNAME_RELEASE} + exit 0 ;; + esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.sub b/config.sub index 3c591de61b..1c351e17c2 100644 --- a/config.sub +++ b/config.sub @@ -910,7 +910,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*) + | -interix* | -uwin* | -rhapsody* | -openstep* | -macos | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ @@ -24,6 +24,8 @@ ac_help="$ac_help ac_help="$ac_help --enable-shared build a shared library for Ruby. " ac_help="$ac_help +--with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]" +ac_help="$ac_help --with-search-path specify the additional search path" # Initialize some variables set by options. @@ -591,7 +593,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:595: checking host system type" >&5 +echo "configure:597: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -612,7 +614,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:616: checking target system type" >&5 +echo "configure:618: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -640,7 +642,7 @@ fi if test "$fat_binary" = yes ; then echo $ac_n "checking target architecture""... $ac_c" 1>&6 -echo "configure:644: checking target architecture" >&5 +echo "configure:646: checking target architecture" >&5 case "$target_os" in rhapsody*) @@ -649,6 +651,12 @@ echo "configure:644: checking target architecture" >&5 TARGET_ARCHS="ppc i386" fi ;; + macos*) + echo -n "MacOS X : " + if test "$TARGET_ARCHS" = "" ; then + TARGET_ARCHS="ppc i386" + fi + ;; nextstep*|openstep*) echo -n "NeXTSTEP/OPENSTEP: " if test "$TARGET_ARCHS" = "" ; then @@ -696,7 +704,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," if test x"${build}" != x"${host}"; then echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:700: checking build system type" >&5 +echo "configure:708: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -722,7 +730,7 @@ fi # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:726: checking for $ac_word" >&5 +echo "configure:734: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -755,7 +763,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:759: checking for $ac_word" >&5 +echo "configure:767: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -785,7 +793,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:789: checking for $ac_word" >&5 +echo "configure:797: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -836,7 +844,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:840: checking for $ac_word" >&5 +echo "configure:848: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -868,7 +876,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:872: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:880: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -879,12 +887,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 883 "configure" +#line 891 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -910,12 +918,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:914: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:922: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:919: checking whether we are using GNU C" >&5 +echo "configure:927: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -924,7 +932,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:928: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -943,7 +951,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:947: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:955: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -975,7 +983,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:979: checking how to run the C preprocessor" >&5 +echo "configure:987: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -990,13 +998,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 994 "configure" +#line 1002 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1007,13 +1015,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1011 "configure" +#line 1019 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1017: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1025: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1024,13 +1032,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1028 "configure" +#line 1036 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1056,13 +1064,13 @@ echo "$ac_t""$CPP" 1>&6 if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1060: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1068: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 1066 "configure" +#line 1074 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -1080,7 +1088,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 1084 "configure" +#line 1092 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -1107,7 +1115,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1111: checking for $ac_word" >&5 +echo "configure:1119: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1140,7 +1148,7 @@ test -n "$YACC" || YACC="yacc" # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1144: checking for $ac_word" >&5 +echo "configure:1152: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1172,7 +1180,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1176: checking for $ac_word" >&5 +echo "configure:1184: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1207,7 +1215,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1211: checking for $ac_word" >&5 +echo "configure:1219: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1241,7 +1249,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1245: checking for $ac_word" >&5 +echo "configure:1253: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1277,7 +1285,7 @@ case "$target_os" in # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args. set dummy ${ac_tool_prefix}nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1281: checking for $ac_word" >&5 +echo "configure:1289: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1309,7 +1317,7 @@ fi # Extract the first word of "${ac_tool_prefix}dllwrap", so it can be a program name with args. set dummy ${ac_tool_prefix}dllwrap; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1313: checking for $ac_word" >&5 +echo "configure:1321: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLWRAP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1341,7 +1349,7 @@ fi # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1345: checking for $ac_word" >&5 +echo "configure:1353: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1373,7 +1381,7 @@ fi # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1377: checking for $ac_word" >&5 +echo "configure:1385: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1406,7 +1414,7 @@ fi esac echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1410: checking whether ln -s works" >&5 +echo "configure:1418: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1427,7 +1435,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1431: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1439: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1457,17 +1465,17 @@ fi # checks for UNIX variants that set C preprocessor variables ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1461: checking for minix/config.h" >&5 +echo "configure:1469: checking for minix/config.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1466 "configure" +#line 1474 "configure" #include "confdefs.h" #include <minix/config.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1506,12 +1514,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:1510: checking for Cygwin environment" >&5 +echo "configure:1518: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1515 "configure" +#line 1523 "configure" #include "confdefs.h" int main() { @@ -1522,7 +1530,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:1526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -1539,19 +1547,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:1543: checking for mingw32 environment" >&5 +echo "configure:1551: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1548 "configure" +#line 1556 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:1555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -1570,7 +1578,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1574: checking for executable suffix" >&5 +echo "configure:1582: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1580,7 +1588,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1601,13 +1609,13 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6 ac_exeext=$EXEEXT echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1605: checking for object suffix" >&5 +echo "configure:1613: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1611: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1626,7 +1634,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1630: checking size of int" >&5 +echo "configure:1638: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1634,7 +1642,7 @@ else ac_cv_sizeof_int=4 else cat > conftest.$ac_ext <<EOF -#line 1638 "configure" +#line 1646 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1645,7 +1653,7 @@ main() exit(0); } EOF -if { (eval echo configure:1649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -1665,7 +1673,7 @@ EOF echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:1669: checking size of short" >&5 +echo "configure:1677: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1673,7 +1681,7 @@ else ac_cv_sizeof_short=2 else cat > conftest.$ac_ext <<EOF -#line 1677 "configure" +#line 1685 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1684,7 +1692,7 @@ main() exit(0); } EOF -if { (eval echo configure:1688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -1704,7 +1712,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1708: checking size of long" >&5 +echo "configure:1716: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1712,7 +1720,7 @@ else ac_cv_sizeof_long=4 else cat > conftest.$ac_ext <<EOF -#line 1716 "configure" +#line 1724 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1723,7 +1731,7 @@ main() exit(0); } EOF -if { (eval echo configure:1727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1743,7 +1751,7 @@ EOF echo $ac_n "checking size of void*""... $ac_c" 1>&6 -echo "configure:1747: checking size of void*" >&5 +echo "configure:1755: checking size of void*" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1751,7 +1759,7 @@ else ac_cv_sizeof_voidp=4 else cat > conftest.$ac_ext <<EOF -#line 1755 "configure" +#line 1763 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1762,7 +1770,7 @@ main() exit(0); } EOF -if { (eval echo configure:1766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_voidp=`cat conftestval` else @@ -1782,7 +1790,7 @@ EOF echo $ac_n "checking size of float""... $ac_c" 1>&6 -echo "configure:1786: checking size of float" >&5 +echo "configure:1794: checking size of float" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1790,7 +1798,7 @@ else ac_cv_sizeof_float=4 else cat > conftest.$ac_ext <<EOF -#line 1794 "configure" +#line 1802 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1801,7 +1809,7 @@ main() exit(0); } EOF -if { (eval echo configure:1805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_float=`cat conftestval` else @@ -1821,7 +1829,7 @@ EOF echo $ac_n "checking size of double""... $ac_c" 1>&6 -echo "configure:1825: checking size of double" >&5 +echo "configure:1833: checking size of double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1829,7 +1837,7 @@ else ac_cv_sizeof_double=8 else cat > conftest.$ac_ext <<EOF -#line 1833 "configure" +#line 1841 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1840,7 +1848,7 @@ main() exit(0); } EOF -if { (eval echo configure:1844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_double=`cat conftestval` else @@ -1861,19 +1869,19 @@ EOF echo $ac_n "checking for prototypes""... $ac_c" 1>&6 -echo "configure:1865: checking for prototypes" >&5 +echo "configure:1873: checking for prototypes" >&5 if eval "test \"`echo '$''{'rb_cv_have_prototypes'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1870 "configure" +#line 1878 "configure" #include "confdefs.h" int foo(int x) { return 0; } int main() { return foo(10); ; return 0; } EOF -if { (eval echo configure:1877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1885: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_have_prototypes=yes else @@ -1894,19 +1902,19 @@ EOF fi echo $ac_n "checking token paste string""... $ac_c" 1>&6 -echo "configure:1898: checking token paste string" >&5 +echo "configure:1906: checking token paste string" >&5 if eval "test \"`echo '$''{'rb_cv_tokenpaste'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1903 "configure" +#line 1911 "configure" #include "confdefs.h" #define paste(a,b) a##b int main() { int xy = 1; return paste(x,y); ; return 0; } EOF -if { (eval echo configure:1910: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_tokenpaste=ansi else @@ -1932,12 +1940,12 @@ EOF fi echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6 -echo "configure:1936: checking for variable length prototypes and stdarg.h" >&5 +echo "configure:1944: checking for variable length prototypes and stdarg.h" >&5 if eval "test \"`echo '$''{'rb_cv_stdarg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1941 "configure" +#line 1949 "configure" #include "confdefs.h" #include <stdarg.h> @@ -1954,7 +1962,7 @@ int main() { return foo(10, "", 3.14); ; return 0; } EOF -if { (eval echo configure:1958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_stdarg=yes else @@ -1975,19 +1983,19 @@ EOF fi echo $ac_n "checking for gcc attribute noreturn""... $ac_c" 1>&6 -echo "configure:1979: checking for gcc attribute noreturn" >&5 +echo "configure:1987: checking for gcc attribute noreturn" >&5 if eval "test \"`echo '$''{'rb_cv_have_attr_noreturn'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1984 "configure" +#line 1992 "configure" #include "confdefs.h" void exit(int x) __attribute__ ((noreturn)); int main() { ; return 0; } EOF -if { (eval echo configure:1991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_have_attr_noreturn=yes else @@ -2011,6 +2019,7 @@ case "$target_os" in nextstep*) ;; openstep*) ;; rhapsody*) ;; +macos*) ;; human*) ac_cv_func_getpgrp_void=yes;; beos*) ;; cygwin*) ;; @@ -2020,7 +2029,7 @@ os2_emx*) LIBS="-lm $LIBS" *) LIBS="-lm $LIBS";; esac echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:2024: checking for crypt in -lcrypt" >&5 +echo "configure:2033: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2028,7 +2037,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <<EOF -#line 2032 "configure" +#line 2041 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2039,7 +2048,7 @@ int main() { crypt() ; return 0; } EOF -if { (eval echo configure:2043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2067,7 +2076,7 @@ else fi echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:2071: checking for dlopen in -ldl" >&5 +echo "configure:2080: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2075,7 +2084,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 2079 "configure" +#line 2088 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2086,7 +2095,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:2090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2114,7 +2123,7 @@ else fi # Dynamic linking for SunOS/Solaris and SYSV echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "configure:2118: checking for shl_load in -ldld" >&5 +echo "configure:2127: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2122,7 +2131,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <<EOF -#line 2126 "configure" +#line 2135 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2133,7 +2142,7 @@ int main() { shl_load() ; return 0; } EOF -if { (eval echo configure:2137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2161,7 +2170,7 @@ else fi # Dynamic linking for HP-UX echo $ac_n "checking for setlocale in -lxpg4""... $ac_c" 1>&6 -echo "configure:2165: checking for setlocale in -lxpg4" >&5 +echo "configure:2174: checking for setlocale in -lxpg4" >&5 ac_lib_var=`echo xpg4'_'setlocale | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2169,7 +2178,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lxpg4 $LIBS" cat > conftest.$ac_ext <<EOF -#line 2173 "configure" +#line 2182 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2180,7 +2189,7 @@ int main() { setlocale() ; return 0; } EOF -if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2213,12 +2222,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:2217: checking for $ac_hdr that defines DIR" >&5 +echo "configure:2226: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2222 "configure" +#line 2231 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -2226,7 +2235,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:2230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -2251,7 +2260,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:2255: checking for opendir in -ldir" >&5 +echo "configure:2264: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2259,7 +2268,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 2263 "configure" +#line 2272 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2270,7 +2279,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:2274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2292,7 +2301,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:2296: checking for opendir in -lx" >&5 +echo "configure:2305: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2300,7 +2309,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 2304 "configure" +#line 2313 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2311,7 +2320,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:2315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2334,12 +2343,12 @@ fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2338: checking for ANSI C header files" >&5 +echo "configure:2347: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2343 "configure" +#line 2352 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2347,7 +2356,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2360: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2364,7 +2373,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2368 "configure" +#line 2377 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2382,7 +2391,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2386 "configure" +#line 2395 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2403,7 +2412,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2407 "configure" +#line 2416 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2414,7 +2423,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2438,12 +2447,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:2442: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2451: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2447 "configure" +#line 2456 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -2459,7 +2468,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2485,17 +2494,17 @@ for ac_hdr in stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h\ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2489: checking for $ac_hdr" >&5 +echo "configure:2498: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2494 "configure" +#line 2503 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2523,12 +2532,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:2527: checking for uid_t in sys/types.h" >&5 +echo "configure:2536: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2532 "configure" +#line 2541 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -2557,12 +2566,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2561: checking for size_t" >&5 +echo "configure:2570: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2566 "configure" +#line 2575 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2590,12 +2599,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:2594: checking for st_blksize in struct stat" >&5 +echo "configure:2603: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2599 "configure" +#line 2608 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -2603,7 +2612,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:2607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -2625,12 +2634,12 @@ fi save_LIBOJBS="$LIBOBJS" echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:2629: checking for st_blocks in struct stat" >&5 +echo "configure:2638: checking for st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2634 "configure" +#line 2643 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -2638,7 +2647,7 @@ int main() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:2642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -2662,12 +2671,12 @@ fi LIBOBJS="$save_LIBOBJS" echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:2666: checking for st_rdev in struct stat" >&5 +echo "configure:2675: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2671 "configure" +#line 2680 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -2675,7 +2684,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:2679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2688: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -2697,7 +2706,7 @@ fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:2701: checking type of array argument to getgroups" >&5 +echo "configure:2710: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2705,7 +2714,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <<EOF -#line 2709 "configure" +#line 2718 "configure" #include "confdefs.h" /* Thanks to Mike Rendell for this test. */ @@ -2730,7 +2739,7 @@ main() } EOF -if { (eval echo configure:2734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -2744,7 +2753,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext <<EOF -#line 2748 "configure" +#line 2757 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -2768,12 +2777,12 @@ EOF echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2772: checking return type of signal handlers" >&5 +echo "configure:2781: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2777 "configure" +#line 2786 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -2790,7 +2799,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2803: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2811,19 +2820,19 @@ EOF # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2815: checking for working alloca.h" >&5 +echo "configure:2824: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2820 "configure" +#line 2829 "configure" #include "confdefs.h" #include <alloca.h> int main() { void *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -2844,12 +2853,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2848: checking for alloca" >&5 +echo "configure:2857: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2853 "configure" +#line 2862 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -2877,7 +2886,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -2909,12 +2918,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2913: checking whether alloca needs Cray hooks" >&5 +echo "configure:2922: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2918 "configure" +#line 2927 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -2939,12 +2948,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2943: checking for $ac_func" >&5 +echo "configure:2952: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2948 "configure" +#line 2957 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2967,7 +2976,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2994,7 +3003,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2998: checking stack direction for C alloca" >&5 +echo "configure:3007: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3002,7 +3011,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3006 "configure" +#line 3015 "configure" #include "confdefs.h" find_stack_direction () { @@ -3021,7 +3030,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3043,12 +3052,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:3047: checking for pid_t" >&5 +echo "configure:3056: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3052 "configure" +#line 3061 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3077,17 +3086,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:3081: checking for vfork.h" >&5 +echo "configure:3090: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3086 "configure" +#line 3095 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3091: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3100: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3112,18 +3121,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:3116: checking for working vfork" >&5 +echo "configure:3125: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:3122: checking for vfork" >&5 +echo "configure:3131: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3127 "configure" +#line 3136 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -3146,7 +3155,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:3150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -3168,7 +3177,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 3172 "configure" +#line 3181 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -3263,7 +3272,7 @@ main() { } } EOF -if { (eval echo configure:3267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -3286,7 +3295,7 @@ EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:3290: checking for 8-bit clean memcmp" >&5 +echo "configure:3299: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3294,7 +3303,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 3298 "configure" +#line 3307 "configure" #include "confdefs.h" main() @@ -3304,7 +3313,7 @@ main() } EOF -if { (eval echo configure:3308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -3326,12 +3335,12 @@ for ac_func in dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ isinf isnan finite do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3330: checking for $ac_func" >&5 +echo "configure:3339: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3335 "configure" +#line 3344 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3354,7 +3363,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3387,12 +3396,12 @@ for ac_func in fmod killpg drand48 random wait4 waitpid syscall getcwd\ dlopen sigprocmask sigaction _setjmp setsid getrlimit do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3391: checking for $ac_func" >&5 +echo "configure:3400: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3396 "configure" +#line 3405 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3415,7 +3424,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3440,12 +3449,12 @@ fi done echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:3444: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:3453: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3449 "configure" +#line 3458 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -3453,7 +3462,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:3457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3466: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -3474,12 +3483,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:3478: checking for tm_zone in struct tm" >&5 +echo "configure:3487: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3483 "configure" +#line 3492 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -3487,7 +3496,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:3491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -3507,12 +3516,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:3511: checking for tzname" >&5 +echo "configure:3520: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3516 "configure" +#line 3525 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -3522,7 +3531,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:3526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -3545,14 +3554,14 @@ fi if test "$ac_cv_func_strftime" = no; then cat > conftest.$ac_ext <<EOF -#line 3549 "configure" +#line 3558 "configure" #include "confdefs.h" int main() { extern int daylight; int i = daylight; ; return 0; } EOF -if { (eval echo configure:3556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_DAYLIGHT 1 @@ -3572,7 +3581,7 @@ EOF else echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6 -echo "configure:3576: checking for BSD signal semantics" >&5 +echo "configure:3585: checking for BSD signal semantics" >&5 if eval "test \"`echo '$''{'rb_cv_bsd_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3580,7 +3589,7 @@ else rb_cv_bsd_signal=no else cat > conftest.$ac_ext <<EOF -#line 3584 "configure" +#line 3593 "configure" #include "confdefs.h" #include <stdio.h> @@ -3602,7 +3611,7 @@ main() } EOF -if { (eval echo configure:3606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_bsd_signal=yes else @@ -3626,7 +3635,7 @@ EOF fi echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:3630: checking whether getpgrp takes no argument" >&5 +echo "configure:3639: checking whether getpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3634,7 +3643,7 @@ else { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3638 "configure" +#line 3647 "configure" #include "confdefs.h" /* @@ -3689,7 +3698,7 @@ main() } EOF -if { (eval echo configure:3693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_getpgrp_void=yes else @@ -3713,7 +3722,7 @@ EOF fi echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:3717: checking whether setpgrp takes no argument" >&5 +echo "configure:3726: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3721,7 +3730,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3725 "configure" +#line 3734 "configure" #include "confdefs.h" #ifdef HAVE_UNISTD_H @@ -3741,7 +3750,7 @@ main() } EOF -if { (eval echo configure:3745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -3766,7 +3775,7 @@ fi echo $ac_n "checking for working strtod""... $ac_c" 1>&6 -echo "configure:3770: checking for working strtod" >&5 +echo "configure:3779: checking for working strtod" >&5 if eval "test \"`echo '$''{'rb_cv_func_strtod'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3774,7 +3783,7 @@ else rb_cv_func_strtod=no else cat > conftest.$ac_ext <<EOF -#line 3778 "configure" +#line 3787 "configure" #include "confdefs.h" double strtod (); @@ -3804,7 +3813,7 @@ main() } EOF -if { (eval echo configure:3808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_func_strtod=yes else @@ -3822,14 +3831,14 @@ echo "$ac_t""$rb_cv_func_strtod" 1>&6 test $rb_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o" echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3826: checking whether byte ordering is bigendian" >&5 +echo "configure:3835: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 3833 "configure" +#line 3842 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3840,11 +3849,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3844: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3853: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 3848 "configure" +#line 3857 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3855,7 +3864,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3868: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -3875,7 +3884,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3879 "configure" +#line 3888 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -3888,7 +3897,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:3892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -3912,12 +3921,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3916: checking for working const" >&5 +echo "configure:3925: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3921 "configure" +#line 3930 "configure" #include "confdefs.h" int main() { @@ -3966,7 +3975,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:3970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3987,14 +3996,14 @@ EOF fi echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:3991: checking whether char is unsigned" >&5 +echo "configure:4000: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <<EOF -#line 3998 "configure" +#line 4007 "configure" #include "confdefs.h" #ifdef __CHAR_UNSIGNED__ yes @@ -4016,7 +4025,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 4020 "configure" +#line 4029 "configure" #include "confdefs.h" /* volatile prevents gcc2 from optimizing the test away on sparcs. */ #if !defined(__STDC__) || __STDC__ != 1 @@ -4026,7 +4035,7 @@ main() { volatile char c = 255; exit(c < 0); } EOF -if { (eval echo configure:4030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -4051,7 +4060,7 @@ fi echo $ac_n "checking whether right shift preserve sign bit""... $ac_c" 1>&6 -echo "configure:4055: checking whether right shift preserve sign bit" >&5 +echo "configure:4064: checking whether right shift preserve sign bit" >&5 if eval "test \"`echo '$''{'rb_cv_rshift_sign'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4059,7 +4068,7 @@ else rb_cv_rshift_sign=yes else cat > conftest.$ac_ext <<EOF -#line 4063 "configure" +#line 4072 "configure" #include "confdefs.h" int @@ -4071,7 +4080,7 @@ main() } EOF -if { (eval echo configure:4075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_rshift_sign=yes else @@ -4099,19 +4108,19 @@ EOF fi echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6 -echo "configure:4103: checking count field in FILE structures" >&5 +echo "configure:4112: checking count field in FILE structures" >&5 if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4108 "configure" +#line 4117 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_cnt = 0; ; return 0; } EOF -if { (eval echo configure:4115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_cnt" else @@ -4121,14 +4130,14 @@ fi rm -f conftest* if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 4125 "configure" +#line 4134 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->__cnt = 0; ; return 0; } EOF -if { (eval echo configure:4132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="__cnt" else @@ -4139,14 +4148,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 4143 "configure" +#line 4152 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_r = 0; ; return 0; } EOF -if { (eval echo configure:4150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4159: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_r" else @@ -4157,14 +4166,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 4161 "configure" +#line 4170 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->readCount = 0; ; return 0; } EOF -if { (eval echo configure:4168: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="readCount" else @@ -4175,14 +4184,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 4179 "configure" +#line 4188 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_rcount = 0; ; return 0; } EOF -if { (eval echo configure:4186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_rcount" else @@ -4239,7 +4248,7 @@ fi echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6 -echo "configure:4243: checking whether ELF binaries are produced" >&5 +echo "configure:4252: checking whether ELF binaries are produced" >&5 if eval "test \"`echo '$''{'rb_cv_binary_elf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4247,7 +4256,7 @@ else rb_cv_binary_elf=yes else cat > conftest.$ac_ext <<EOF -#line 4251 "configure" +#line 4260 "configure" #include "confdefs.h" /* Test for whether ELF binaries are produced */ @@ -4267,7 +4276,7 @@ main() { } EOF -if { (eval echo configure:4271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_binary_elf=yes else @@ -4315,12 +4324,13 @@ STATIC= if test "$with_dln_a_out" != yes; then rb_cv_dlopen=unknown echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6 -echo "configure:4319: checking whether OS depend dynamic link works" >&5 +echo "configure:4328: checking whether OS depend dynamic link works" >&5 if test "$GCC" = yes; then case "$target_os" in nextstep*) ;; openstep*) ;; rhapsody*) ;; + macos*) ;; human*) ;; bsdi*) ;; cygwin*) ;; @@ -4399,6 +4409,10 @@ echo "configure:4319: checking whether OS depend dynamic link works" >&5 LDFLAGS="" DLDFLAGS="$ARCH_FLAG" rb_cv_dlopen=yes ;; + macos*) LDSHARED='cc -dynamic -bundle -undefined suppress' + LDFLAGS="" + DLDFLAGS="$ARCH_FLAG" + rb_cv_dlopen=yes ;; aix*) LDSHARED='/usr/ccs/bin/ld' XLDFLAGS='-Wl,-bE:ruby.imp' DLDFLAGS='-eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc' @@ -4434,12 +4448,12 @@ if test "$ac_cv_header_a_out_h" = yes; then if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then cat confdefs.h > config.h echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6 -echo "configure:4438: checking whether matz's dln works" >&5 +echo "configure:4452: checking whether matz's dln works" >&5 if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4443 "configure" +#line 4457 "configure" #include "confdefs.h" #define USE_DLN_A_OUT @@ -4449,7 +4463,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4467: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_dln_a_out=yes else @@ -4506,9 +4520,9 @@ EOF #define DLEXT ".bundle" EOF ;; - cygwin*) DLEXT=dll + macos*) DLEXT=bundle cat >> confdefs.h <<\EOF -#define DLEXT ".dll" +#define DLEXT ".bundle" EOF ;; os2_emx*) DLEXT=dll @@ -4539,6 +4553,8 @@ case "$target_os" in STRIP='strip -A -n';; rhapsody*) STRIP='strip -A -n';; + macos*) + STRIP='strip -A -n';; esac EXTSTATIC= @@ -4556,7 +4572,7 @@ fi case "$target_os" in human*) echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6 -echo "configure:4560: checking for _harderr in -lsignal" >&5 +echo "configure:4576: checking for _harderr in -lsignal" >&5 ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4564,7 +4580,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsignal $LIBS" cat > conftest.$ac_ext <<EOF -#line 4568 "configure" +#line 4584 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4575,7 +4591,7 @@ int main() { _harderr() ; return 0; } EOF -if { (eval echo configure:4579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4603,7 +4619,7 @@ else fi echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6 -echo "configure:4607: checking for hmemset in -lhmem" >&5 +echo "configure:4623: checking for hmemset in -lhmem" >&5 ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4611,7 +4627,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lhmem $LIBS" cat > conftest.$ac_ext <<EOF -#line 4615 "configure" +#line 4631 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4622,7 +4638,7 @@ int main() { hmemset() ; return 0; } EOF -if { (eval echo configure:4626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4652,12 +4668,12 @@ fi for ac_func in select gettimeofday do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4656: checking for $ac_func" >&5 +echo "configure:4672: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4661 "configure" +#line 4677 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4680,7 +4696,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4705,7 +4721,7 @@ fi done echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6 -echo "configure:4709: checking whether PD libc _dtos18 fail to convert big number" >&5 +echo "configure:4725: checking whether PD libc _dtos18 fail to convert big number" >&5 if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4713,7 +4729,7 @@ else rb_cv_missing__dtos18=no else cat > conftest.$ac_ext <<EOF -#line 4717 "configure" +#line 4733 "configure" #include "confdefs.h" #include <stdio.h> @@ -4725,7 +4741,7 @@ main () } EOF -if { (eval echo configure:4729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_missing__dtos18=yes else @@ -4747,7 +4763,7 @@ EOF fi echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6 -echo "configure:4751: checking whether PD libc fconvert fail to round" >&5 +echo "configure:4767: checking whether PD libc fconvert fail to round" >&5 if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4755,7 +4771,7 @@ else rb_cv_missing_fconvert=no else cat > conftest.$ac_ext <<EOF -#line 4759 "configure" +#line 4775 "configure" #include "confdefs.h" #include <stdio.h> @@ -4768,7 +4784,7 @@ main () } EOF -if { (eval echo configure:4772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rb_cv_missing_fconvert=yes else @@ -4976,8 +4992,15 @@ test "$program_suffix" != NONE && RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}" RUBY_LIB_PREFIX="${prefix}/lib/ruby" RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}" -RUBY_SITE_LIB_PATH="${RUBY_LIB_PREFIX}/site_ruby" -RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}" +sitedir="${prefix}/lib/ruby/site_ruby" +# Check whether --with-sitedir or --without-sitedir was given. +if test "${with_sitedir+set}" = set; then + withval="$with_sitedir" + sitedir=$withval +fi + +RUBY_SITE_LIB_PATH="${sitedir}" +RUBY_SITE_LIB_PATH2="${sitedir}/${MAJOR}.${MINOR}" cat >> confdefs.h <<EOF #define RUBY_LIB "${RUBY_LIB_PATH}" @@ -5242,6 +5265,7 @@ s%@LIBRUBY@%$LIBRUBY%g s%@LIBRUBYARG@%$LIBRUBYARG%g s%@SOLIBS@%$SOLIBS%g s%@arch@%$arch%g +s%@sitedir@%$sitedir%g s%@configure_args@%$configure_args%g CEOF diff --git a/configure.in b/configure.in index 6fd4117c29..83cb5783a7 100644 --- a/configure.in +++ b/configure.in @@ -44,6 +44,12 @@ AC_ARG_ENABLE(fat-binary, TARGET_ARCHS="ppc i386" fi ;; + macos*) + echo -n "MacOS X : " + if test "$TARGET_ARCHS" = "" ; then + TARGET_ARCHS="ppc i386" + fi + ;; nextstep*|openstep*) echo -n "NeXTSTEP/OPENSTEP: " if test "$TARGET_ARCHS" = "" ; then @@ -155,6 +161,7 @@ case "$target_os" in nextstep*) ;; openstep*) ;; rhapsody*) ;; +macos*) ;; human*) ac_cv_func_getpgrp_void=yes;; beos*) ;; cygwin*) ;; @@ -407,6 +414,7 @@ if test "$with_dln_a_out" != yes; then nextstep*) ;; openstep*) ;; rhapsody*) ;; + macos*) ;; human*) ;; bsdi*) ;; cygwin*) ;; @@ -485,6 +493,10 @@ if test "$with_dln_a_out" != yes; then LDFLAGS="" DLDFLAGS="$ARCH_FLAG" rb_cv_dlopen=yes ;; + macos*) LDSHARED='cc -dynamic -bundle -undefined suppress' + LDFLAGS="" + DLDFLAGS="$ARCH_FLAG" + rb_cv_dlopen=yes ;; aix*) LDSHARED='/usr/ccs/bin/ld' XLDFLAGS='-Wl,-bE:ruby.imp' DLDFLAGS='-eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc' @@ -553,8 +565,8 @@ else AC_DEFINE(DLEXT, ".bundle");; rhapsody*) DLEXT=bundle AC_DEFINE(DLEXT, ".bundle");; - cygwin*) DLEXT=dll - AC_DEFINE(DLEXT, ".dll");; + macos*) DLEXT=bundle + AC_DEFINE(DLEXT, ".bundle");; os2_emx*) DLEXT=dll AC_DEFINE(DLEXT, ".dll");; *) DLEXT=so @@ -578,6 +590,8 @@ case "$target_os" in STRIP='strip -A -n';; rhapsody*) STRIP='strip -A -n';; + macos*) + STRIP='strip -A -n';; esac EXTSTATIC= @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** dir.c - @@ -7,8 +7,10 @@ created at: Wed Jan 5 09:51:01 JST 1994 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** dln.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "config.h" #include "defines.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** dln.h - @@ -6,7 +6,10 @@ $Date$ created at: Wed Jan 19 16:53:09 JST 1994 -************************************************/ + Copyright (C) 1993-2000 Yukihiro Matsumoto + +**********************************************************************/ + #ifndef DLN_H #define DLN_H @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** enum.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include "node.h" @@ -338,6 +338,7 @@ Init_Enumerable() rb_define_method(rb_mEnumerable,"select", enum_find_all, 0); rb_define_method(rb_mEnumerable,"reject", enum_reject, 0); rb_define_method(rb_mEnumerable,"collect", enum_collect, 0); + rb_define_method(rb_mEnumerable,"map", enum_collect, 0); rb_define_method(rb_mEnumerable,"min", enum_min, 0); rb_define_method(rb_mEnumerable,"max", enum_max, 0); rb_define_method(rb_mEnumerable,"member?", enum_member, 1); @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** env.h - @@ -6,7 +6,10 @@ $Date$ created at: Mon Jul 11 11:53:03 JST 1994 -************************************************/ + Copyright (C) 1993-2000 Yukihiro Matsumoto + +**********************************************************************/ + #ifndef ENV_H #define ENV_H @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** error.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include "env.h" @@ -404,6 +404,7 @@ typedef struct { int n; } syserr_index_entry; +static VALUE syserr_error; static VALUE syserr_list_b_general[16+1]; static VALUE syserr_list_b_os0[2+1]; static VALUE syserr_list_b_os1[5+1]; @@ -464,6 +465,11 @@ set_syserr(i, name) VALUE error = rb_define_class_under(rb_mErrno, name, rb_eSystemCallError); rb_define_const(error, "Errno", INT2FIX(i)); #ifdef __BEOS__ + if (i == B_ERROR) { + syserr_error = error; + rb_global_variable(&syserr_error); + return error; + } i -= B_GENERAL_ERROR_BASE; ix = (i >> 12) & 0xf; offset = (i >> 8) & 0xf; @@ -497,6 +503,7 @@ get_syserr(int i) VALUE *list; int ix, offset; + if (i == B_ERROR) return syserr_error; i -= B_GENERAL_ERROR_BASE; ix = (i >> 12) & 0xf; offset = (i >> 8) & 0xf; @@ -690,6 +697,7 @@ init_syserr() MEMZERO(syserr_list[ix + offset].list, VALUE, syserr_list[ix + offset].n); } } + set_syserr(B_ERROR, "ERROR"); #else syserr_list = ALLOC_N(VALUE, sys_nerr+1); MEMZERO(syserr_list, VALUE, sys_nerr+1); @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** eval.c - @@ -7,8 +7,10 @@ created at: Thu Jun 10 14:22:17 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" #include "node.h" @@ -1837,10 +1839,11 @@ static void return_check _((void)); #define return_value(v) prot_tag->retval = (v) static VALUE -rb_eval(self, node) +rb_eval(self, n) VALUE self; - NODE * volatile node; + NODE *n; { + NODE * volatile node = n; int state; volatile VALUE result = Qnil; @@ -2745,6 +2748,10 @@ rb_eval(self, node) rb_warning("discarding old %s", rb_id2name(node->nd_mid)); } rb_clear_cache_by_id(node->nd_mid); + if (node->nd_noex) { /* toplevel */ + rb_warning("overriding global function `%s'", + rb_id2name(node->nd_mid)); + } } if (SCOPE_TEST(SCOPE_PRIVATE) || node->nd_mid == init) { @@ -2754,7 +2761,7 @@ rb_eval(self, node) noex = NOEX_PROTECTED; } else { - noex = NOEX_PUBLIC; + noex = node->nd_noex; } if (body && origin == ruby_class && body->nd_noex & NOEX_UNDEF) { noex |= NOEX_UNDEF; @@ -2782,16 +2789,16 @@ rb_eval(self, node) VALUE klass; NODE *body = 0; - if (rb_special_const_p(recv)) { + if (rb_safe_level() >= 4 && !OBJ_TAINTED(recv)) { + rb_raise(rb_eSecurityError, "Insecure; can't define singleton method"); + } + if (FIXNUM_P(recv) || SYMBOL_P(recv)) { rb_raise(rb_eTypeError, - "can't define method \"%s\" for %s", + "can't define singleton method \"%s\" for %s", rb_id2name(node->nd_mid), rb_class2name(CLASS_OF(recv))); } - if (rb_safe_level() >= 4 && !OBJ_TAINTED(recv)) { - rb_raise(rb_eSecurityError, "can't define singleton method"); - } if (OBJ_FROZEN(recv)) rb_error_frozen("object"); klass = rb_singleton_class(recv); if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &body)) { @@ -2995,10 +3002,11 @@ rb_eval(self, node) } static VALUE -module_setup(module, node) +module_setup(module, n) VALUE module; - NODE * volatile node; + NODE *n; { + NODE * volatile node = n; int state; struct FRAME frame; VALUE result; /* OK */ @@ -3428,37 +3436,30 @@ massign(self, node, val, check) list = node->nd_head; - if (val) { - if (TYPE(val) != T_ARRAY) { - if (NIL_P(val)) - val = rb_ary_new2(0); - else - val = rb_ary_new3(1, val); + if (TYPE(val) != T_ARRAY) { + if (NIL_P(val)) + val = rb_ary_new2(0); + else + val = rb_ary_new3(1, val); + } + len = RARRAY(val)->len; + for (i=0; list && i<len; i++) { + assign(self, list->nd_head, RARRAY(val)->ptr[i], check); + list = list->nd_next; + } + if (check && list) goto arg_error; + if (node->nd_args) { + if (node->nd_args == (NODE*)-1) { + /* ignore rest args */ } - len = RARRAY(val)->len; - for (i=0; list && i<len; i++) { - assign(self, list->nd_head, RARRAY(val)->ptr[i], check); - list = list->nd_next; + else if (!list && i<len) { + assign(self, node->nd_args, rb_ary_new4(len-i, RARRAY(val)->ptr+i), check); } - if (check && list) goto arg_error; - if (node->nd_args) { - if (node->nd_args == (NODE*)-1) { - /* ignore rest args */ - } - else if (!list && i<len) { - assign(self, node->nd_args, rb_ary_new4(len-i, RARRAY(val)->ptr+i), check); - } - else { - assign(self, node->nd_args, rb_ary_new2(0), check); - } + else { + assign(self, node->nd_args, rb_ary_new2(0), check); } - else if (check && i<len) goto arg_error; - } - else if (node->nd_args && node->nd_args != (NODE*)-1) { - assign(self, node->nd_args, Qnil, check); } - if (check && list) goto arg_error; while (list) { i++; assign(self, list->nd_head, Qnil, check); @@ -6199,7 +6200,7 @@ enum thread_status { THREAD_RUNNABLE, THREAD_STOPPED, THREAD_TO_KILL, - THREAD_KILLED, + THREAD_KILLED }; #define WAIT_FD (1<<0) @@ -6261,7 +6262,9 @@ struct thread { #define THREAD_RAISED 0x200 +static thread_t main_thread; static thread_t curr_thread = 0; + static int num_waiting_on_fd = 0; static int num_waiting_on_timer = 0; static int num_waiting_on_join = 0; @@ -6281,8 +6284,6 @@ timeofday() return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6; } -static thread_t main_thread; - #define STACK(addr) (th->stk_pos<(VALUE*)(addr) && (VALUE*)(addr)<th->stk_pos+th->stk_len) #define ADJ(addr) (void*)(STACK(addr)?(((VALUE*)(addr)-th->stk_pos)+th->stk_ptr):(VALUE*)(addr)) @@ -6358,11 +6359,9 @@ thread_free(th) if (th->stk_ptr) free(th->stk_ptr); th->stk_ptr = 0; if (th->locals) st_free_table(th->locals); - if (th->status != THREAD_KILLED) { - if (th->prev) - th->prev->next = th->next; - if (th->next) - th->next->prev = th->prev; + if (th->status != THREAD_KILLED && th->prev) { + th->prev->next = th->next; + th->next->prev = th->prev; } if (th != main_thread) free(th); } @@ -7990,7 +7989,6 @@ rb_f_throw(argc, argv) return_value(value); rb_trap_restore_mask(); JUMP_TAG(TAG_THROW); - /* not reached */ } void diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index 4336fdb51f..cbe0e6e5fa 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -501,7 +501,7 @@ def extmake(target) $objs = nil $local_flags = "" case RUBY_PLATFORM - when /cygwin|beos|openstep|nextstep|rhapsody|i386-os2_emx/ + when /cygwin|beos|openstep|nextstep|rhapsody|macos|i386-os2_emx/ $libs = "" when /mswin32/ $LIBEXT = "lib" diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 6a2937bb3f..1adb7cc1b5 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -6,6 +6,7 @@ case PLATFORM when /mswin32/ test_func = "WSACleanup" have_library("wsock32", "WSACleanup") + have_func("closesocket") when /cygwin/ # $LDFLAGS << " -L/usr/lib" if File.directory?("/usr/lib") # $CFLAGS << " -I/usr/include" @@ -14,6 +15,7 @@ when /cygwin/ when /beos/ test_func = "socket" have_library("net", "socket") + have_func("closesocket") when /i386-os2_emx/ test_func = "socket" have_library("socket", "socket") diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index 0b9d9b6afc..c312b92705 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -421,7 +421,11 @@ getaddrinfo(hostname, servname, hints, res) s = socket(afd->a_af, SOCK_DGRAM, 0); if (s < 0) continue; +#if defined(HAVE_CLOSESOCKET) + closesocket(s); +#else close(s); +#endif if (pai->ai_flags & AI_PASSIVE) { GET_AI(cur->ai_next, afd, afd->a_addrany, port); diff --git a/ext/socket/socket.c b/ext/socket/socket.c index aee13a1a19..2ad653cc4a 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -181,7 +181,7 @@ bsock_close_read(sock) rb_thread_fd_close(fileno(fptr->f)); fptr->mode &= ~FMODE_READABLE; #ifdef NT - free(fptr->f); + myfdclose(fptr->f); #else fclose(fptr->f); #endif @@ -207,7 +207,7 @@ bsock_close_write(sock) shutdown(fileno(fptr->f2), 1); fptr->mode &= ~FMODE_WRITABLE; #ifdef NT - free(fptr->f2); + myfdclose(fptr->f2); #else fclose(fptr->f2); #endif @@ -256,7 +256,8 @@ bsock_getsockopt(sock, lev, optname) VALUE sock, lev, optname; { #if !defined(__BEOS__) - int level, option, len; + int level, option; + socklen_t len; char *buf; OpenFile *fptr; @@ -280,7 +281,7 @@ bsock_getsockname(sock) VALUE sock; { char buf[1024]; - int len = sizeof buf; + socklen_t len = sizeof buf; OpenFile *fptr; GetOpenFile(sock, fptr); @@ -294,7 +295,7 @@ bsock_getpeername(sock) VALUE sock; { char buf[1024]; - int len = sizeof buf; + socklen_t len = sizeof buf; OpenFile *fptr; GetOpenFile(sock, fptr); @@ -374,9 +375,9 @@ s_recv(sock, argc, argv, from) OpenFile *fptr; VALUE str; char buf[1024]; - int fd, alen = sizeof buf; + socklen_t alen = sizeof buf; VALUE len, flg; - int flags; + int fd, flags; rb_scan_args(argc, argv, "11", &len, &flg); @@ -763,7 +764,11 @@ open_inet(class, h, serv, type) } if (status < 0) { +#if defined(HAVE_CLOSESOCKET) + closesocket(fd); +#else close(fd); +#endif fd = -1; continue; } else @@ -771,7 +776,11 @@ open_inet(class, h, serv, type) } if (status < 0) { if (fd >= 0) +#if defined(HAVE_CLOSESOCKET) + closesocket(fd); +#else close(fd); +#endif freeaddrinfo(res0); rb_sys_fail(syscall); } @@ -956,7 +965,7 @@ s_accept(class, fd, sockaddr, len) VALUE class; int fd; struct sockaddr *sockaddr; - int *len; + socklen_t *len; { int fd2; @@ -989,7 +998,7 @@ tcp_accept(sock) { OpenFile *fptr; struct sockaddr_storage from; - int fromlen; + socklen_t fromlen; GetOpenFile(sock, fptr); fromlen = sizeof(from); @@ -1037,7 +1046,11 @@ open_unix(class, path, server) } if (status < 0) { +#if defined(HAVE_CLOSESOCKET) + closesocket(fd); +#else close(fd); +#endif rb_sys_fail(sockaddr.sun_path); } @@ -1057,7 +1070,7 @@ ip_addr(sock) { OpenFile *fptr; struct sockaddr_storage addr; - int len = sizeof addr; + socklen_t len = sizeof addr; GetOpenFile(sock, fptr); @@ -1072,7 +1085,7 @@ ip_peeraddr(sock) { OpenFile *fptr; struct sockaddr_storage addr; - int len = sizeof addr; + socklen_t len = sizeof addr; GetOpenFile(sock, fptr); @@ -1231,7 +1244,7 @@ unix_path(sock) GetOpenFile(sock, fptr); if (fptr->path == 0) { struct sockaddr_un addr; - int len = sizeof(addr); + socklen_t len = sizeof(addr); if (getsockname(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0) rb_sys_fail(0); fptr->path = strdup(addr.sun_path); @@ -1261,7 +1274,7 @@ unix_accept(sock) { OpenFile *fptr; struct sockaddr_un from; - int fromlen; + socklen_t fromlen; GetOpenFile(sock, fptr); fromlen = sizeof(struct sockaddr_un); @@ -1282,7 +1295,7 @@ unix_addr(sock) { OpenFile *fptr; struct sockaddr_un addr; - int len = sizeof addr; + socklen_t len = sizeof addr; GetOpenFile(sock, fptr); @@ -1297,7 +1310,7 @@ unix_peeraddr(sock) { OpenFile *fptr; struct sockaddr_un addr; - int len = sizeof addr; + socklen_t len = sizeof addr; GetOpenFile(sock, fptr); @@ -1500,7 +1513,7 @@ sock_accept(sock) OpenFile *fptr; VALUE sock2; char buf[1024]; - int len = sizeof buf; + socklen_t len = sizeof buf; GetOpenFile(sock, fptr); sock2 = s_accept(rb_cSocket,fileno(fptr->f),(struct sockaddr*)buf,&len); diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb index e1939af5fe..2b5fb9138e 100644 --- a/ext/tk/lib/tktext.rb +++ b/ext/tk/lib/tktext.rb @@ -428,15 +428,9 @@ class TkText<TkTextWin rsearch_with_length(pat,start,stop)[0] end - def dump(type_info, *index) - args = type_info.collect{|inf| - if inf.kind_of? Array - inf[0] = '-' + inf[0] - inf - else - '-' + inf - end - }.flatten + def dump(type_info, *index, &block) + args = type_info.collect{|inf| '-' + inf} + args << '-command' << Proc.new(&block) if iterator? str = tk_send('dump', *(args + index)) result = [] sel = nil @@ -546,26 +540,23 @@ class TkText<TkTextWin end private :_retrieve_backslashed_text - def dump_all(*index) - dump(['all'], *index) + def dump_all(*index, &block) + dump(['all'], *index, &block) end - def dump_command(cmd, *index) - dump([['command', cmd]], *index) + def dump_mark(*index, &block) + dump(['mark'], *index, &block) end - def dump_mark(*index) - dump(['mark'], *index) + def dump_tag(*index, &block) + dump(['tag'], *index, &block) end - def dump_tag(*index) - dump(['tag'], *index) + def dump_text(*index, &block) + dump(['text'], *index, &block) end - def dump_text(*index) - dump(['text'], *index) + def dump_window(*index, &block) + dump(['window'], *index, &block) end - def dump_window(*index) - dump(['window'], *index) - end - def dump_image(*index) - dump(['image'], *index) + def dump_image(*index, &block) + dump(['image'], *index, &block) end end @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** file.c - @@ -7,8 +7,10 @@ created at: Mon Nov 15 12:24:34 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #ifdef NT #include "missing/file.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** gc.c - @@ -7,8 +7,10 @@ created at: Tue Oct 5 09:44:46 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" #include "rubysig.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** hash.c - @@ -7,8 +7,10 @@ created at: Mon Nov 22 18:51:18 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" #include "st.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** inits.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" @@ -1,5 +1,20 @@ -/* Functions and variables that are used by more than one source file of - * the kernel. Not available to extensions and applications. +/********************************************************************** + + intern.h - + + $Author$ + $Date$ + created at: Thu Jun 10 14:22:17 JST 1993 + + Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan + +**********************************************************************/ + +/* + * Functions and variables that are used by more than one source file of + * the kernel. */ /* array.c */ @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** io.c - @@ -7,8 +7,10 @@ created at: Fri Oct 15 18:08:59 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" #include "rubyio.h" @@ -209,7 +211,7 @@ io_write(io, str) } #endif if (fptr->mode & FMODE_SYNC) { - fflush(f); + if (fflush(f) == EOF) rb_sys_fail(fptr->path); } return INT2FIX(n); @@ -241,7 +243,7 @@ rb_io_flush(io) rb_io_check_writable(fptr); f = GetWriteFile(fptr); - if (fflush(f) == EOF) rb_sys_fail(0); + if (fflush(f) == EOF) rb_sys_fail(fptr->path); return io; } @@ -531,6 +533,9 @@ rb_io_gets_internal(argc, argv, io) rsptr = 0; rslen = 0; } + else if (rs == rb_default_rs) { + return rb_io_gets(io); + } else { rslen = RSTRING(rs)->len; if (rslen == 0) { @@ -919,15 +924,13 @@ fptr_finalize(fptr) } } -static void -rb_io_fptr_close(fptr) +void +rb_io_fptr_finalize(fptr) OpenFile *fptr; { - int fd; - + if (!fptr) return; if (fptr->f == NULL && fptr->f2 == NULL) return; - fd = fileno(fptr->f); if (fptr->finalize) { (*fptr->finalize)(fptr); } @@ -935,21 +938,27 @@ rb_io_fptr_close(fptr) fptr_finalize(fptr); } fptr->f = fptr->f2 = NULL; - rb_thread_fd_close(fd); -} -void -rb_io_fptr_finalize(fptr) - OpenFile *fptr; -{ - if (!fptr) return; - rb_io_fptr_close(fptr); if (fptr->path) { free(fptr->path); fptr->path = NULL; } } +static void +rb_io_fptr_close(fptr) + OpenFile *fptr; +{ + int fd; + + if (!fptr) return; + if (fptr->f == NULL && fptr->f2 == NULL) return; + + fd = fileno(fptr->f); + rb_io_fptr_finalize(fptr); + rb_thread_fd_close(fd); +} + VALUE rb_io_close(io) VALUE io; @@ -957,6 +966,9 @@ rb_io_close(io) OpenFile *fptr; fptr = RFILE(io)->fptr; + if (fptr->mode & FMODE_WRITABLE) { + rb_io_flush(io); + } rb_io_fptr_close(fptr); if (fptr->pid) { rb_syswait(fptr->pid); @@ -1335,7 +1347,7 @@ rb_file_sysopen(fname, flags, mode) { NEWOBJ(io, struct RFile); OBJSETUP(io, rb_cFile, T_FILE); - return rb_file_sysopen_internal((VALUE)io, fname, mode); + return rb_file_sysopen_internal((VALUE)io, fname, flags, mode); } #if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) @@ -1736,10 +1748,10 @@ io_reopen(io, nfile) if (fptr == orig) return io; if (orig->f2) { - fflush(orig->f2); + if (fflush(orig->f2) == EOF) rb_sys_fail(orig->path); } else if (orig->mode & FMODE_WRITABLE) { - fflush(orig->f); + if (fflush(orig->f) == EOF) rb_sys_fail(orig->path); } rb_thread_fd_close(fileno(fptr->f)); @@ -1852,10 +1864,10 @@ rb_io_clone(io) MakeOpenFile(clone, fptr); if (orig->f2) { - fflush(orig->f2); + if (fflush(orig->f2) == EOF) rb_sys_fail(orig->path); } else if (orig->mode & FMODE_WRITABLE) { - fflush(orig->f); + if (fflush(orig->f) == EOF) rb_sys_fail(orig->path); } /* copy OpenFile structure */ @@ -1979,8 +1991,9 @@ rb_io_putc(io, ch) if (fputc(c, f) == EOF) rb_sys_fail(fptr->path); - if (fptr->mode & FMODE_SYNC) - fflush(f); + if (fptr->mode & FMODE_SYNC) { + if (fflush(f) == EOF) rb_sys_fail(fptr->path); + } return ch; } @@ -2250,7 +2263,7 @@ rb_io_initialize(argc, argv, io) char *m = "r"; if (RFILE(io)->fptr) { - rb_io_fptr_finalize(RFILE(io)->fptr); + rb_io_close_m(io); free(RFILE(io)->fptr); RFILE(io)->fptr = 0; } @@ -2883,7 +2896,7 @@ rb_io_s_pipe() rb_sys_fail(0); r = prep_stdio(rb_fdopen(pipes[0], "r"), FMODE_READABLE, rb_cIO); - w = prep_stdio(rb_fdopen(pipes[1], "w"), FMODE_WRITABLE, rb_cIO); + w = prep_stdio(rb_fdopen(pipes[1], "w"), FMODE_WRITABLE|FMODE_SYNC, rb_cIO); ary = rb_ary_new2(2); rb_ary_push(ary, r); diff --git a/lib/cgi.rb b/lib/cgi.rb index b973904997..016c66c032 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -3,11 +3,12 @@ $Date$ == CGI SUPPORT LIBRARY -CGI.rb +cgi.rb -Version 1.10 +Version 1.20 -Copyright (C) 1999 Network Applied Communication Laboratory, Inc. +Copyright (C) 2000 Network Applied Communication Laboratory, Inc. +Copyright (C) 2000 Information-technology Promotion Agancy, Japan Wakou Aoyama <wakou@fsinet.or.jp> @@ -182,7 +183,7 @@ class CGI EOL = CR + LF v = $-v $-v = false - VERSION = "1.10" + VERSION = "1.20" RELEASE_DATE = "$Date$" $-v = v @@ -237,7 +238,8 @@ $-v = v =end def CGI::escape(string) str = string.dup - str.gsub!(/[^a-zA-Z0-9_.-]/n){ sprintf("%%%02X", $&.unpack("C")[0]) } + str.gsub!(/ /n, '+') + str.gsub!(/([^a-zA-Z0-9_.-])/n){ sprintf("%%%02X", $1.unpack("C")[0]) } str end @@ -281,7 +283,16 @@ $-v = v when /\Aquot\z/ni then '"' when /\Agt\z/ni then '>' when /\Alt\z/ni then '<' - when /\A#(\d+)\z/n then Integer($1).chr + when /\A#(\d+)\z/n then + if Integer($1) < 256 + Integer($1).chr + else + if $KCODE[0] == ?u or $KCODE[0] == ?U + [Integer($1)].pack("U") + else + "#" + $1 + end + end when /\A#x([0-9a-f]+)\z/ni then $1.hex.chr end } @@ -594,7 +605,17 @@ convert string charset, and set language to "ja". @name = options["name"] @value = Array(options["value"]) - @path = options["path"] + # simple support for IE + if options["path"] + @path = options["path"] + elsif ENV["REQUEST_URI"] + @path = ENV["REQUEST_URI"].sub(/\?.*/n,'') + if ENV["PATH_INFO"] + @path = @path[0...@path.rindex(ENV["PATH_INFO"])] + end + else + @path = ENV["SCRIPT_NAME"] or "" + end @domain = options["domain"] @expires = options["expires"] @secure = options["secure"] == true ? true : false @@ -960,7 +981,7 @@ convert string charset, and set language to "ja". def nn_element_def(element) <<-END.gsub(/element\.downcase/n, element.downcase).gsub(/element\.upcase/n, element.upcase) "<element.upcase" + attributes.collect{|name, value| - next if value == nil + next unless value " " + CGI::escapeHTML(name) + if true == value "" @@ -981,7 +1002,7 @@ convert string charset, and set language to "ja". def nOE_element_def(element) <<-END.gsub(/element\.downcase/n, element.downcase).gsub(/element\.upcase/n, element.upcase) "<element.upcase" + attributes.collect{|name, value| - next if value == nil + next unless value " " + CGI::escapeHTML(name) + if true == value "" @@ -996,7 +1017,7 @@ convert string charset, and set language to "ja". def nO_element_def(element) <<-END.gsub(/element\.downcase/n, element.downcase).gsub(/element\.upcase/n, element.upcase) "<element.upcase" + attributes.collect{|name, value| - next if value == nil + next unless value " " + CGI::escapeHTML(name) + if true == value "" @@ -1340,8 +1361,9 @@ convert string charset, and set language to "ja". { "TYPE" => "image", "SRC" => src, "NAME" => name, "ALT" => alt } else - name["TYPE"] = "image" - name + src["TYPE"] = "image" + src["SRC"] ||= "" + src end input(attributes) end @@ -1881,7 +1903,20 @@ end =begin -== HISTRY +== HISTORY + +=== Version 1.20 - wakou + +2000/04/03 18:31:42 + +- bug fix: CGI#image_button() can't get Hash option + thanks to Takashi Ikeda <ikeda@auc.co.jp> +- CGI::unescapeHTML() + simple support for "〹" +- CGI::Cookie::new() + simple support for IE +- CGI::escape() + ' ' replaced by '+' === Version 1.10 - wakou diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb index edbae8c850..5aa3a06053 100644 --- a/lib/cgi/session.rb +++ b/lib/cgi/session.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2000 Network Applied Communication Laboratory, Inc. +# Copyright (C) 2000 Information-technology Promotion Agancy, Japan require 'cgi' require 'final' diff --git a/lib/debug.rb b/lib/debug.rb index b9a1d5f1c5..8af0aab96d 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -1,3 +1,6 @@ +# Copyright (C) 2000 Network Applied Communication Laboratory, Inc. +# Copyright (C) 2000 Information-technology Promotion Agancy, Japan + if $SAFE > 0 STDERR.print "-r debug.rb is not available in safe mode\n" exit 1 @@ -190,159 +193,158 @@ class DEBUGGER__ def debug_command(file, line, id, binding) MUTEX.lock - DEBUGGER__.set_last_thread(Thread.current) - frame_pos = 0 - binding_file = file - binding_line = line - previous_line = nil - if (ENV['EMACS'] == 't') - stdout.printf "\032\032%s:%d:\n", binding_file, binding_line - else - stdout.printf "%s:%d:%s", binding_file, binding_line, - line_at(binding_file, binding_line) - end - @frames[0] = [binding, file, line, id] - display_expressions(binding) - while input = readline("(rdb:%d) "%thnum(), true) - catch (:debug_error) do - if input == "" - input = DEBUG_LAST_CMD[0] - stdout.print input, "\n" + DEBUGGER__.set_last_thread(Thread.current) + frame_pos = 0 + binding_file = file + binding_line = line + previous_line = nil + if (ENV['EMACS'] == 't') + stdout.printf "\032\032%s:%d:\n", binding_file, binding_line + else + stdout.printf "%s:%d:%s", binding_file, binding_line, + line_at(binding_file, binding_line) + end + @frames[0] = [binding, file, line, id] + display_expressions(binding) + while input = readline("(rdb:%d) "%thnum(), true) + catch (:debug_error) do + if input == "" + input = DEBUG_LAST_CMD[0] + stdout.print input, "\n" + else + DEBUG_LAST_CMD[0] = input + end + + case input + when /^\s*b(?:reak)?\s+((?:.*?+:)?.+)$/ + pos = $1 + if pos.index(":") + file, pos = pos.split(":") + end + file = File.basename(file) + if pos =~ /^\d+$/ + pname = pos + pos = pos.to_i else - DEBUG_LAST_CMD[0] = input + pname = pos = pos.intern.id2name end - - case input - when /^\s*b(?:reak)?\s+((?:.*?+:)?.+)$/ - pos = $1 - if pos.index(":") - file, pos = pos.split(":") - end - file = File.basename(file) - if pos =~ /^\d+$/ - pname = pos - pos = pos.to_i - else - pname = pos = pos.intern.id2name - end - break_points.push [true, 0, file, pos] - stdout.printf "Set breakpoint %d at %s:%s\n", break_points.size, file, - pname - - when /^\s*wat(?:ch)?\s+(.+)$/ - exp = $1 - break_points.push [true, 1, exp] - stdout.printf "Set watchpoint %d\n", break_points.size, exp - - when /^\s*b(?:reak)?$/ - if break_points.find{|b| b[1] == 0} - n = 1 - stdout.print "breakpoints:\n" - for b in break_points - if b[0] and b[1] == 0 - stdout.printf " %d %s:%s\n", n, b[2], b[3] - end - n += 1 + break_points.push [true, 0, file, pos] + stdout.printf "Set breakpoint %d at %s:%s\n", break_points.size, file, pname + + when /^\s*wat(?:ch)?\s+(.+)$/ + exp = $1 + break_points.push [true, 1, exp] + stdout.printf "Set watchpoint %d\n", break_points.size, exp + + when /^\s*b(?:reak)?$/ + if break_points.find{|b| b[1] == 0} + n = 1 + stdout.print "breakpoints:\n" + for b in break_points + if b[0] and b[1] == 0 + stdout.printf " %d %s:%s\n", n, b[2], b[3] end + n += 1 end - if break_points.find{|b| b[1] == 1} - n = 1 - stdout.print "\n" - stdout.print "watchpoints:\n" - for b in break_points - if b[0] and b[1] == 1 - stdout.printf " %d %s\n", n, b[2] - end - n += 1 + end + if break_points.find{|b| b[1] == 1} + n = 1 + stdout.print "\n" + stdout.print "watchpoints:\n" + for b in break_points + if b[0] and b[1] == 1 + stdout.printf " %d %s\n", n, b[2] end + n += 1 end - if break_points.size == 0 - stdout.print "no breakpoints\n" - else - stdout.print "\n" - end + end + if break_points.size == 0 + stdout.print "no breakpoints\n" + else + stdout.print "\n" + end - when /^\s*del(?:ete)?(?:\s+(\d+))?$/ - pos = $1 - unless pos - input = readline("clear all breakpoints? (y/n) ", false) - if input == "y" - for b in break_points - b[0] = false - end + when /^\s*del(?:ete)?(?:\s+(\d+))?$/ + pos = $1 + unless pos + input = readline("clear all breakpoints? (y/n) ", false) + if input == "y" + for b in break_points + b[0] = false end + end + else + pos = pos.to_i + if break_points[pos-1] + break_points[pos-1][0] = false else - pos = pos.to_i - if break_points[pos-1] - break_points[pos-1][0] = false - else - stdout.printf "Breakpoint %d is not defined\n", pos - end + stdout.printf "Breakpoint %d is not defined\n", pos end + end - when /^\s*disp(?:lay)?\s+(.+)$/ - exp = $1 - display.push.push [true, exp] - stdout.printf " %d: %s = %s\n", display.size, exp, - eval(exp, binding) rescue "--" - - when /^\s*disp(?:lay)?$/ - display_expressions(binding) - - when /^\s*undisp(?:lay)?(?:\s+(\d+))?$/ - pos = $1 - unless pos - input = readline("clear all expressions? (y/n) ", false) - if input == "y" - for d in display - d[0] = false - end - end - else - pos = pos.to_i - if display[pos-1] - display[pos-1][0] = false - else - stdout.printf "display expression %d is not defined\n", pos + when /^\s*disp(?:lay)?\s+(.+)$/ + exp = $1 + display.push.push [true, exp] + stdout.printf " %d: %s = %s\n", display.size, exp, + eval(exp, binding) rescue "--" + + when /^\s*disp(?:lay)?$/ + display_expressions(binding) + + when /^\s*undisp(?:lay)?(?:\s+(\d+))?$/ + pos = $1 + unless pos + input = readline("clear all expressions? (y/n) ", false) + if input == "y" + for d in display + d[0] = false end end - - when /^\s*c(?:ont)?$/ - MUTEX.unlock - return - - when /^\s*s(?:tep)?(?:\s+(\d+))?$/ - if $1 - lev = $1.to_i + else + pos = pos.to_i + if display[pos-1] + display[pos-1][0] = false else - lev = 1 + stdout.printf "display expression %d is not defined\n", pos end - @stop_next = lev - return + end - when /^\s*n(?:ext)?(?:\s+(\d+))?$/ - if $1 - lev = $1.to_i - else - lev = 1 - end - @stop_next = lev - @no_step = @frames.size - frame_pos - return + when /^\s*c(?:ont)?$/ + MUTEX.unlock + return - when /^\s*w(?:here)?$/, /^\s*f(?:rame)?$/ - display_frames(frame_pos) + when /^\s*s(?:tep)?(?:\s+(\d+))?$/ + if $1 + lev = $1.to_i + else + lev = 1 + end + @stop_next = lev + return - when /^\s*l(?:ist)?(?:\s+(.+))?$/ - if not $1 - b = previous_line ? previous_line + 10 : binding_line - 5 - e = b + 9 - elsif $1 == '-' - b = previous_line ? previous_line - 10 : binding_line - 5 - e = b + 9 - else - b, e = $1.split(/[-,]/) - if e + when /^\s*n(?:ext)?(?:\s+(\d+))?$/ + if $1 + lev = $1.to_i + else + lev = 1 + end + @stop_next = lev + @no_step = @frames.size - frame_pos + return + + when /^\s*w(?:here)?$/, /^\s*f(?:rame)?$/ + display_frames(frame_pos) + + when /^\s*l(?:ist)?(?:\s+(.+))?$/ + if not $1 + b = previous_line ? previous_line + 10 : binding_line - 5 + e = b + 9 + elsif $1 == '-' + b = previous_line ? previous_line - 10 : binding_line - 5 + e = b + 9 + else + b, e = $1.split(/[-,]/) + if e b = b.to_i e = e.to_i else @@ -412,6 +414,9 @@ class DEBUGGER__ when /^\s*p\s+/ p debug_eval($', binding) + when /^\s*h(?:elp)?/ + debug_print_help() + else v = debug_eval(input, binding) p v unless (v == nil) @@ -420,6 +425,45 @@ class DEBUGGER__ end end + def debug_print_help + print <<EOHELP +Debugger help v.-0.002b +Commands + b[reak] [file or method:]<line> set breakpoint to some position + wat[ch] <expression> set watchpoint to some expression + b[reak] list breakpoints + del[ele][ nnn] delete some or all breakpoints + disp[lay] <expression> add expression into display expression list + undisp[lay][ nnn] delete one particular or all display expressions + c[ont] run until program ends or hit breakpoint + s[tep][ nnn] step (into methods) one line or till line nnn + n[ext][ nnn] go over one line or till line nnn + w[here] display frames + f[rame] alias for where + l[ist][ (-|nn-mm)] list program, - lists backwards + nn-mm lists given lines + up[ nn] move to higher frame + down[ nn] move to lower frame + fin[ish] return to outer frame + q[uit] exit from debugger + v[ar] g[lobal] show global variables + v[ar] l[ocal] show local variables + v[ar] i[nstance] <object> show instance variables of object + v[ar] c[onst] <object> show constants of object + m[ethod] i[nstance] <obj> show methods of object + m[ethod] <class or module> show instance methods of class or module + th[read] l[ist] list all threads + th[read] c[ur[rent]] show current threads + th[read] <nnn> stop thread nnn + th[read] stop <nnn> alias for th[read] <nnn> + th[read] c[ur[rent]] <nnn> alias for th[read] <nnn> + th[read] resume <nnn> run thread nnn + p expression evaluate expression and print its value + h[elp] print this help + <everything else> evaluate +EOHELP + end + def display_expressions(binding) n = 1 for d in display diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb new file mode 100644 index 0000000000..4acaaadd3a --- /dev/null +++ b/lib/net/telnet.rb @@ -0,0 +1,749 @@ +=begin +$Date$ + +== SIMPLE TELNET CLIENT LIBRARY + +net/telnet.rb + +Version 1.30 + +Wakou Aoyama <wakou@fsinet.or.jp> + + +=== MAKE NEW TELNET OBJECT + + host = Net::Telnet::new({ + "Binmode" => false, # default: false + "Host" => "localhost", # default: "localhost" + "Output_log" => "output_log", # default: nil (no output) + "Dump_log" => "dump_log", # default: nil (no output) + "Port" => 23, # default: 23 + "Prompt" => /[$%#>] \z/n, # default: /[$%#>] \z/n + "Telnetmode" => true, # default: true + "Timeout" => 10, # default: 10 + # if ignore timeout then set "Timeout" to false. + "Waittime" => 0, # default: 0 + "Proxy" => proxy # default: nil + # proxy is Telnet or TCPsocket object + }) + +Telnet object has socket class methods. + +if set "Telnetmode" option to false. not telnet command interpretation. +"Waittime" is time to confirm "Prompt". There is a possibility that +the same character as "Prompt" is included in the data, and, when +the network or the host is very heavy, the value is enlarged. + +=== STATUS OUTPUT + + host = Net::Telnet::new({"Host" => "localhost"}){|c| print c } + +connection status output. + +example + + Trying localhost... + Connected to localhost. + + +=== WAIT FOR MATCH + + line = host.waitfor(/match/) + line = host.waitfor({"Match" => /match/, + "String" => "string", + "Timeout" => secs}) + # if ignore timeout then set "Timeout" to false. + +if set "String" option, then Match == Regexp.new(quote("string")) + + +==== REALTIME OUTPUT + + host.waitfor(/match/){|c| print c } + host.waitfor({"Match" => /match/, + "String" => "string", + "Timeout" => secs}){|c| print c} + +of cource, set sync=true or flush is necessary. + + +=== SEND STRING AND WAIT PROMPT + + line = host.cmd("string") + line = host.cmd({"String" => "string", + "Prompt" => /[$%#>] \z/n, + "Timeout" => 10}) + + +==== REALTIME OUTPUT + + host.cmd("string"){|c| print c } + host.cmd({"String" => "string", + "Prompt" => /[$%#>] \z/n, + "Timeout" => 10}){|c| print c } + +of cource, set sync=true or flush is necessary. + + +=== SEND STRING + + host.print("string") + # == host.write("string\n") + + +=== TURN TELNET COMMAND INTERPRETATION + + host.telnetmode # turn on/off + host.telnetmode(true) # on + host.telnetmode(false) # off + + +=== TOGGLE NEWLINE TRANSLATION + + host.binmode # turn true/false + host.binmode(true) # no translate newline + host.binmode(false) # translate newline + + +=== LOGIN + + host.login("username", "password") + host.login({"Name" => "username", + "Password" => "password", + "Prompt" => /[$%#>] \z/n, + "Timeout" => 10}) + +if no password prompt. + + host.login("username") + host.login({"Name" => "username", + "Prompt" => /[$%#>] \z/n, + "Timeout" => 10}) + + +==== REALTIME OUTPUT + + host.login("username", "password"){|c| print c } + host.login({"Name" => "username", + "Password" => "password", + "Prompt" => /[$%#>] \z/n, + "Timeout" => 10}){|c| print c } + +of cource, set sync=true or flush is necessary. + + +== EXAMPLE + +=== LOGIN AND SEND COMMAND + + localhost = Net::Telnet::new({"Host" => "localhost", + "Timeout" => 10, + "Prompt" => /[$%#>] \z/n}) + localhost.login("username", "password"){|c| print c } + localhost.cmd("command"){|c| print c } + localhost.close + + +=== CHECKS A POP SERVER TO SEE IF YOU HAVE MAIL + + pop = Net::Telnet::new({"Host" => "your_destination_host_here", + "Port" => 110, + "Telnetmode" => false, + "Prompt" => /^\+OK/n}) + pop.cmd("user " + "your_username_here"){|c| print c} + pop.cmd("pass " + "your_password_here"){|c| print c} + pop.cmd("list"){|c| print c} + + +== HISTORY + +=== Version 1.30 + +2000/04/03 18:27:02 + +- telnet.rb --> net/telnet.rb + +=== Version 1.20 + +2000/01/24 17:02:57 + +- respond to "IAC WILL x" with "IAC DONT x" +- respond to "IAC WONT x" with "IAC DONT x" +- better dumplog format + thanks to WATANABE Hirofumi <Hirofumi.Watanabe@jp.sony.com> + +=== Version 1.10 + +2000/01/18 17:47:31 + +- bug fix: write method +- respond to "IAC WILL BINARY" with "IAC DO BINARY" + +=== Version 1.00 + +1999/10/04 22:51:26 + +- bug fix: waitfor(preprocess) method + thanks to Shin-ichiro Hara <sinara@blade.nagaokaut.ac.jp> +- add simple support for AO, DM, IP, NOP, SB, SE +- COUTION! TimeOut --> TimeoutError + +=== Version 0.50 + +1999/09/21 21:24:07 + +- add write method + +=== Version 0.40 + +1999/09/17 17:41:41 + +- bug fix: preprocess method + +=== Version 0.30 + +1999/09/14 23:09:05 + +- change prompt check order. + not IO::select([@sock], nil, nil, waittime) and prompt === line + --> prompt === line and not IO::select([@sock], nil, nil, waittime) + +=== Version 0.24 + +1999/09/13 22:28:33 + +- Telnet#login +if ommit password, then not require password prompt. + +=== Version 0.232 + +1999/08/10 05:20:21 + +- STATUS OUTPUT sample code typo. thanks to Tadayoshi Funaba <tadf@kt.rim.or.jp> + host = Telnet.new({"Hosh" => "localhost"){|c| print c } + --> host = Telnet.new({"Host" => "localhost"){|c| print c } + +=== Version 0.231 + +1999/07/16 13:39:42 + +- TRUE --> true, FALSE --> false + +=== Version 0.23 + +1999/07/15 22:32:09 + +- waitfor: if end of file reached, then return nil. + +=== Version 0.22 + +1999/06/29 09:08:51 + +- new, waitfor, cmd: {"Timeout" => false} # ignore timeout + +=== Version 0.21 + +1999/06/28 18:18:55 + +- waitfor: not rescue (EOFError) + +=== Version 0.20 + +1999/06/04 06:24:58 + +- waitfor: support for divided telnet command + +=== Version 0.181 + +1999/05/22 + +- bug fix: print method + +=== Version 0.18 + +1999/05/14 + +- respond to "IAC WON'T SGA" with "IAC DON'T SGA" +- DON'T SGA : end of line --> CR + LF +- bug fix: preprocess method + +=== Version 0.17 + +1999/04/30 + +- bug fix: $! + "\n" --> $!.to_s + "\n" + +=== Version 0.163 + +1999/04/11 + +- STDOUT.write(message) --> yield(message) if iterator? + +=== Version 0.162 + +1999/03/17 + +- add "Proxy" option +- required timeout.rb + +=== Version 0.161 + +1999/02/03 + +- select --> IO::select + +=== Version 0.16 + +1998/10/09 + +- preprocess method change for the better +- add binmode method. +- change default Binmode. TRUE --> FALSE + +=== Version 0.15 + +1998/10/04 + +- add telnetmode method. + +=== Version 0.141 + +1998/09/22 + +- change default prompt. /[$%#>] $/ --> /[$%#>] \Z/ + +=== Version 0.14 + +1998/09/01 + +- IAC WILL SGA send EOL --> CR+NULL +- IAC WILL SGA IAC DO BIN send EOL --> CR +- NONE send EOL --> LF +- add Dump_log option. + +=== Version 0.13 + +1998/08/25 + +- add print method. + +=== Version 0.122 + +1998/08/05 + +- support for HP-UX 10.20 thanks to WATANABE Tetsuya <tetsu@jpn.hp.com> +- socket.<< --> socket.write + +=== Version 0.121 + +1998/07/15 + +- string.+= --> string.concat + +=== Version 0.12 + +1998/06/01 + +- add timeout, waittime. + +=== Version 0.11 + +1998/04/21 + +- add realtime output. + +=== Version 0.10 + +1998/04/13 + +- first release. + +=end + +require "socket" +require "delegate" +require "timeout" + +module Net + class Telnet < SimpleDelegator + + IAC = 255.chr # "\377" # "\xff" # interpret as command: + DONT = 254.chr # "\376" # "\xfe" # you are not to use option + DO = 253.chr # "\375" # "\xfd" # please, you use option + WONT = 252.chr # "\374" # "\xfc" # I won't use option + WILL = 251.chr # "\373" # "\xfb" # I will use option + SB = 250.chr # "\372" # "\xfa" # interpret as subnegotiation + GA = 249.chr # "\371" # "\xf9" # you may reverse the line + EL = 248.chr # "\370" # "\xf8" # erase the current line + EC = 247.chr # "\367" # "\xf7" # erase the current character + AYT = 246.chr # "\366" # "\xf6" # are you there + AO = 245.chr # "\365" # "\xf5" # abort output--but let prog finish + IP = 244.chr # "\364" # "\xf4" # interrupt process--permanently + BREAK = 243.chr # "\363" # "\xf3" # break + DM = 242.chr # "\362" # "\xf2" # data mark--for connect. cleaning + NOP = 241.chr # "\361" # "\xf1" # nop + SE = 240.chr # "\360" # "\xf0" # end sub negotiation + EOR = 239.chr # "\357" # "\xef" # end of record (transparent mode) + ABORT = 238.chr # "\356" # "\xee" # Abort process + SUSP = 237.chr # "\355" # "\xed" # Suspend process + EOF = 236.chr # "\354" # "\xec" # End of file + SYNCH = 242.chr # "\362" # "\xf2" # for telfunc calls + + OPT_BINARY = 0.chr # "\000" # "\x00" # Binary Transmission + OPT_ECHO = 1.chr # "\001" # "\x01" # Echo + OPT_RCP = 2.chr # "\002" # "\x02" # Reconnection + OPT_SGA = 3.chr # "\003" # "\x03" # Suppress Go Ahead + OPT_NAMS = 4.chr # "\004" # "\x04" # Approx Message Size Negotiation + OPT_STATUS = 5.chr # "\005" # "\x05" # Status + OPT_TM = 6.chr # "\006" # "\x06" # Timing Mark + OPT_RCTE = 7.chr # "\a" # "\x07" # Remote Controlled Trans and Echo + OPT_NAOL = 8.chr # "\010" # "\x08" # Output Line Width + OPT_NAOP = 9.chr # "\t" # "\x09" # Output Page Size + OPT_NAOCRD = 10.chr # "\n" # "\x0a" # Output Carriage-Return Disposition + OPT_NAOHTS = 11.chr # "\v" # "\x0b" # Output Horizontal Tab Stops + OPT_NAOHTD = 12.chr # "\f" # "\x0c" # Output Horizontal Tab Disposition + OPT_NAOFFD = 13.chr # "\r" # "\x0d" # Output Formfeed Disposition + OPT_NAOVTS = 14.chr # "\016" # "\x0e" # Output Vertical Tabstops + OPT_NAOVTD = 15.chr # "\017" # "\x0f" # Output Vertical Tab Disposition + OPT_NAOLFD = 16.chr # "\020" # "\x10" # Output Linefeed Disposition + OPT_XASCII = 17.chr # "\021" # "\x11" # Extended ASCII + OPT_LOGOUT = 18.chr # "\022" # "\x12" # Logout + OPT_BM = 19.chr # "\023" # "\x13" # Byte Macro + OPT_DET = 20.chr # "\024" # "\x14" # Data Entry Terminal + OPT_SUPDUP = 21.chr # "\025" # "\x15" # SUPDUP + OPT_SUPDUPOUTPUT = 22.chr # "\026" # "\x16" # SUPDUP Output + OPT_SNDLOC = 23.chr # "\027" # "\x17" # Send Location + OPT_TTYPE = 24.chr # "\030" # "\x18" # Terminal Type + OPT_EOR = 25.chr # "\031" # "\x19" # End of Record + OPT_TUID = 26.chr # "\032" # "\x1a" # TACACS User Identification + OPT_OUTMRK = 27.chr # "\e" # "\x1b" # Output Marking + OPT_TTYLOC = 28.chr # "\034" # "\x1c" # Terminal Location Number + OPT_3270REGIME = 29.chr # "\035" # "\x1d" # Telnet 3270 Regime + OPT_X3PAD = 30.chr # "\036" # "\x1e" # X.3 PAD + OPT_NAWS = 31.chr # "\037" # "\x1f" # Negotiate About Window Size + OPT_TSPEED = 32.chr # " " # "\x20" # Terminal Speed + OPT_LFLOW = 33.chr # "!" # "\x21" # Remote Flow Control + OPT_LINEMODE = 34.chr # "\"" # "\x22" # Linemode + OPT_XDISPLOC = 35.chr # "#" # "\x23" # X Display Location + OPT_OLD_ENVIRON = 36.chr # "$" # "\x24" # Environment Option + OPT_AUTHENTICATION = 37.chr # "%" # "\x25" # Authentication Option + OPT_ENCRYPT = 38.chr # "&" # "\x26" # Encryption Option + OPT_NEW_ENVIRON = 39.chr # "'" # "\x27" # New Environment Option + OPT_EXOPL = 255.chr # "\377" # "\xff" # Extended-Options-List + + NULL = "\000" + CR = "\015" + LF = "\012" + EOL = CR + LF + v = $-v + $-v = false + VERSION = "1.30" + RELEASE_DATE = "$Date$" + $-v = v + + def initialize(options) + @options = options + @options["Binmode"] = false unless @options.has_key?("Binmode") + @options["Host"] = "localhost" unless @options.has_key?("Host") + @options["Port"] = 23 unless @options.has_key?("Port") + @options["Prompt"] = /[$%#>] \z/n unless @options.has_key?("Prompt") + @options["Telnetmode"] = true unless @options.has_key?("Telnetmode") + @options["Timeout"] = 10 unless @options.has_key?("Timeout") + @options["Waittime"] = 0 unless @options.has_key?("Waittime") + + @telnet_option = { "SGA" => false, "BINARY" => false } + + if @options.has_key?("Output_log") + @log = File.open(@options["Output_log"], 'a+') + @log.sync = true + @log.binmode + end + + if @options.has_key?("Dump_log") + @dumplog = File.open(@options["Dump_log"], 'a+') + @dumplog.sync = true + @dumplog.binmode + def @dumplog.log_dump(dir, x) + len = x.length + addr = 0 + offset = 0 + while 0 < len + if len < 16 + line = x[offset, len] + else + line = x[offset, 16] + end + hexvals = line.unpack('H*')[0] + hexvals.concat ' ' * (32 - hexvals.length) + hexvals = format "%s %s %s %s " * 4, *hexvals.unpack('a2' * 16) + line.gsub! /[\000-\037\177-\377]/n, '.' + printf "%s 0x%5.5x: %s%s\n", dir, addr, hexvals, line + addr += 16 + offset += 16 + len -= 16 + end + print "\n" + end + end + + if @options.has_key?("Proxy") + if @options["Proxy"].kind_of?(Telnet) + @sock = @options["Proxy"].sock + elsif @options["Proxy"].kind_of?(TCPsocket) + @sock = @options["Proxy"] + else + raise "Error; Proxy is Telnet or TCPSocket object." + end + else + message = "Trying " + @options["Host"] + "...\n" + yield(message) if iterator? + @log.write(message) if @options.has_key?("Output_log") + @dumplog.log_dump('#', message) if @options.has_key?("Dump_log") + + begin + if @options["Timeout"] == false + @sock = TCPsocket.open(@options["Host"], @options["Port"]) + else + timeout(@options["Timeout"]){ + @sock = TCPsocket.open(@options["Host"], @options["Port"]) + } + end + rescue TimeoutError + raise TimeoutError, "timed-out; opening of the host" + rescue + @log.write($!.to_s + "\n") if @options.has_key?("Output_log") + @dumplog.log_dump('#', $!.to_s + "\n") if @options.has_key?("Dump_log") + raise + end + @sock.sync = true + @sock.binmode + + message = "Connected to " + @options["Host"] + ".\n" + yield(message) if iterator? + @log.write(message) if @options.has_key?("Output_log") + @dumplog.log_dump('#', message) if @options.has_key?("Dump_log") + end + + super(@sock) + end # initialize + + attr :sock + + def telnetmode(mode = 'turn') + if 'turn' == mode + @options["Telnetmode"] = @options["Telnetmode"] ? false : true + else + @options["Telnetmode"] = mode ? true : false + end + end + + def binmode(mode = 'turn') + if 'turn' == mode + @options["Binmode"] = @options["Binmode"] ? false : true + else + @options["Binmode"] = mode ? true : false + end + end + + def preprocess(string) + str = string.dup + + # combine CR+NULL into CR + str.gsub!(/#{CR}#{NULL}/no, CR) if @options["Telnetmode"] + + # combine EOL into "\n" + str.gsub!(/#{EOL}/no, "\n") unless @options["Binmode"] + + str.gsub!(/#{IAC}( + [#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]| + [#{DO}#{DONT}#{WILL}#{WONT}] + [#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}]| + #{SB}[^#{IAC}]*#{IAC}#{SE} + )/xno){ + if IAC == $1 # handle escaped IAC characters + IAC + elsif AYT == $1 # respond to "IAC AYT" (are you there) + 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 + self.write(IAC + WILL + OPT_BINARY) + else + self.write(IAC + WONT + $1[1..1]) + end + '' + elsif DONT[0] == $1[0] # respond to "IAC DON'T x" with "IAC WON'T x" + self.write(IAC + WONT + $1[1..1]) + '' + elsif WILL[0] == $1[0] # respond to "IAC WILL x" + if OPT_BINARY[0] == $1[1] + self.write(IAC + DO + OPT_BINARY) + elsif OPT_ECHO[0] == $1[1] + self.write(IAC + DO + OPT_ECHO) + elsif OPT_SGA[0] == $1[1] + @telnet_option["SGA"] = true + self.write(IAC + DO + OPT_SGA) + else + self.write(IAC + DONT + $1[1..1]) + end + '' + elsif WONT[0] == $1[0] # respond to "IAC WON'T x" + if OPT_ECHO[0] == $1[1] + self.write(IAC + DONT + OPT_ECHO) + elsif OPT_SGA[0] == $1[1] + @telnet_option["SGA"] = false + self.write(IAC + DONT + OPT_SGA) + else + self.write(IAC + DONT + $1[1..1]) + end + '' + else + '' + end + } + + str + end # preprocess + + def waitfor(options) + time_out = @options["Timeout"] + waittime = @options["Waittime"] + + if options.kind_of?(Hash) + prompt = if options.has_key?("Match") + options["Match"] + elsif options.has_key?("Prompt") + options["Prompt"] + elsif options.has_key?("String") + Regexp.new( Regexp.quote(options["String"]) ) + end + time_out = options["Timeout"] if options.has_key?("Timeout") + waittime = options["Waittime"] if options.has_key?("Waittime") + else + prompt = options + end + + if time_out == false + time_out = nil + end + + line = '' + buf = '' + rest = '' + until(prompt === line and not IO::select([@sock], nil, nil, waittime)) + unless IO::select([@sock], nil, nil, time_out) + raise TimeoutError, "timed-out; wait for the next data" + end + begin + c = @sock.sysread(1024 * 1024) + @dumplog.log_dump('<', c) if @options.has_key?("Dump_log") + if @options["Telnetmode"] + if Integer(c.rindex(/#{IAC}#{SE}/no)) < + Integer(c.rindex(/#{IAC}#{SB}/no)) + buf = preprocess(rest + c[0 ... c.rindex(/#{IAC}#{SB}/no)]) + rest = c[c.rindex(/#{IAC}#{SB}/no) .. -1] + elsif pt = c.rindex(/#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no) + buf = preprocess(rest + c[0 ... pt]) + rest = c[pt .. -1] + else + buf = preprocess(c) + rest = '' + end + end + @log.print(buf) if @options.has_key?("Output_log") + line.concat(buf) + yield buf if iterator? + rescue EOFError # End of file reached + if line == '' + line = nil + yield nil if iterator? + end + break + end + end + line + end + + def write(string) + length = string.length + while 0 < length + IO::select(nil, [@sock]) + @dumplog.log_dump('>', string[-length..-1]) if @options.has_key?("Dump_log") + length -= @sock.syswrite(string[-length..-1]) + end + end + + def print(string) + str = string.dup + "\n" + + str.gsub!(/#{IAC}/no, IAC + IAC) if @options["Telnetmode"] + + unless @options["Binmode"] + if @telnet_option["BINARY"] and @telnet_option["SGA"] + # IAC WILL SGA IAC DO BIN send EOL --> CR + str.gsub!(/\n/n, CR) + elsif @telnet_option["SGA"] + # IAC WILL SGA send EOL --> CR+NULL + str.gsub!(/\n/n, CR + NULL) + else + # NONE send EOL --> CR+LF + str.gsub!(/\n/n, EOL) + end + end + + self.write(str) + end + + def cmd(options) + match = @options["Prompt"] + time_out = @options["Timeout"] + + if options.kind_of?(Hash) + string = options["String"] + match = options["Match"] if options.has_key?("Match") + time_out = options["Timeout"] if options.has_key?("Timeout") + else + string = options + end + + self.print(string) + if iterator? + waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c } + else + waitfor({"Prompt" => match, "Timeout" => time_out}) + end + end + + def login(options, password = nil) + if options.kind_of?(Hash) + username = options["Name"] + password = options["Password"] + else + username = options + end + + if iterator? + line = waitfor(/login[: ]*\z/n){|c| yield c } + if password + line.concat( cmd({"String" => username, + "Match" => /Password[: ]*\z/n}){|c| yield c } ) + line.concat( cmd(password){|c| yield c } ) + else + line.concat( cmd(username){|c| yield c } ) + end + else + line = waitfor(/login[: ]*\z/n) + if password + line.concat( cmd({"String" => username, + "Match" => /Password[: ]*\z/n}) ) + line.concat( cmd(password) ) + else + line.concat( cmd(username) ) + end + end + line + end + + end +end diff --git a/lib/telnet.rb b/lib/telnet.rb index 47a0926f8e..b861ffa783 100644 --- a/lib/telnet.rb +++ b/lib/telnet.rb @@ -1,739 +1,9 @@ -=begin -$Date: 2000/01/24 17:02:57 $ +# +# telnet.rb +# -== SIMPLE TELNET CLIENT LIBRARY +$stderr.puts 'Warning: telnet.rb is obsolete: use net/telnet' -telnet.rb +require 'net/telnet' -Version 1.20 - -Wakou Aoyama <wakou@fsinet.or.jp> - - -=== MAKE NEW TELNET OBJECT - - host = Telnet.new({"Binmode" => false, # default: false - "Host" => "localhost", # default: "localhost" - "Output_log" => "output_log", # default: not output - "Dump_log" => "dump_log", # default: not output - "Port" => 23, # default: 23 - "Prompt" => /[$%#>] \z/n, # default: /[$%#>] \z/n - "Telnetmode" => true, # default: true - "Timeout" => 10, # default: 10 - # if ignore timeout then set "Timeout" to false. - "Waittime" => 0, # default: 0 - "Proxy" => proxy}) # default: nil - # proxy is Telnet or TCPsocket object - -Telnet object has socket class methods. - -if set "Telnetmode" option to false. not telnet command interpretation. -"Waittime" is time to confirm "Prompt". There is a possibility that -the same character as "Prompt" is included in the data, and, when -the network or the host is very heavy, the value is enlarged. - -=== STATUS OUTPUT - - host = Telnet.new({"Host" => "localhost"}){|c| print c } - -connection status output. - -example - - Trying localhost... - Connected to localhost. - - -=== WAIT FOR MATCH - - line = host.waitfor(/match/) - line = host.waitfor({"Match" => /match/, - "String" => "string", - "Timeout" => secs}) - # if ignore timeout then set "Timeout" to false. - -if set "String" option, then Match == Regexp.new(quote("string")) - - -==== REALTIME OUTPUT - - host.waitfor(/match/){|c| print c } - host.waitfor({"Match" => /match/, - "String" => "string", - "Timeout" => secs}){|c| print c} - -of cource, set sync=true or flush is necessary. - - -=== SEND STRING AND WAIT PROMPT - - line = host.cmd("string") - line = host.cmd({"String" => "string", - "Prompt" => /[$%#>] \z/n, - "Timeout" => 10}) - - -==== REALTIME OUTPUT - - host.cmd("string"){|c| print c } - host.cmd({"String" => "string", - "Prompt" => /[$%#>] \z/n, - "Timeout" => 10}){|c| print c } - -of cource, set sync=true or flush is necessary. - - -=== SEND STRING - - host.print("string") - # == host.write("string\n") - - -=== TURN TELNET COMMAND INTERPRETATION - - host.telnetmode # turn on/off - host.telnetmode(true) # on - host.telnetmode(false) # off - - -=== TOGGLE NEWLINE TRANSLATION - - host.binmode # turn true/false - host.binmode(true) # no translate newline - host.binmode(false) # translate newline - - -=== LOGIN - - host.login("username", "password") - host.login({"Name" => "username", - "Password" => "password", - "Prompt" => /[$%#>] \z/n, - "Timeout" => 10}) - -if no password prompt. - - host.login("username") - host.login({"Name" => "username", - "Prompt" => /[$%#>] \z/n, - "Timeout" => 10}) - - -==== REALTIME OUTPUT - - host.login("username", "password"){|c| print c } - host.login({"Name" => "username", - "Password" => "password", - "Prompt" => /[$%#>] \z/n, - "Timeout" => 10}){|c| print c } - -of cource, set sync=true or flush is necessary. - - -== EXAMPLE - -=== LOGIN AND SEND COMMAND - - localhost = Telnet.new({"Host" => "localhost", - "Timeout" => 10, - "Prompt" => /[$%#>] \z/n}) - localhost.login("username", "password"){|c| print c } - localhost.cmd("command"){|c| print c } - localhost.close - - -=== CHECKS A POP SERVER TO SEE IF YOU HAVE MAIL - - pop = Telnet.new({"Host" => "your_destination_host_here", - "Port" => 110, - "Telnetmode" => false, - "Prompt" => /^\+OK/n}) - pop.cmd("user " + "your_username_here"){|c| print c} - pop.cmd("pass " + "your_password_here"){|c| print c} - pop.cmd("list"){|c| print c} - - -== HISTORY - -=== Version 1.20 - -2000/01/24 17:02:57 - -- respond to "IAC WILL x" with "IAC DONT x" -- respond to "IAC WONT x" with "IAC DONT x" -- better dumplog format - thanks to WATANABE Hirofumi <Hirofumi.Watanabe@jp.sony.com> - -=== Version 1.10 - -2000/01/18 17:47:31 - -- bug fix: write method -- respond to "IAC WILL BINARY" with "IAC DO BINARY" - -=== Version 1.00 - -1999/10/04 22:51:26 - -- bug fix: waitfor(preprocess) method - thanks to Shin-ichiro Hara <sinara@blade.nagaokaut.ac.jp> -- add simple support for AO, DM, IP, NOP, SB, SE -- COUTION! TimeOut --> TimeoutError - -=== Version 0.50 - -1999/09/21 21:24:07 - -- add write method - -=== Version 0.40 - -1999/09/17 17:41:41 - -- bug fix: preprocess method - -=== Version 0.30 - -1999/09/14 23:09:05 - -- change prompt check order. - not IO::select([@sock], nil, nil, waittime) and prompt === line - --> prompt === line and not IO::select([@sock], nil, nil, waittime) - -=== Version 0.24 - -1999/09/13 22:28:33 - -- Telnet#login -if ommit password, then not require password prompt. - -=== Version 0.232 - -1999/08/10 05:20:21 - -- STATUS OUTPUT sample code typo. thanks to Tadayoshi Funaba <tadf@kt.rim.or.jp> - host = Telnet.new({"Hosh" => "localhost"){|c| print c } - --> host = Telnet.new({"Host" => "localhost"){|c| print c } - -=== Version 0.231 - -1999/07/16 13:39:42 - -- TRUE --> true, FALSE --> false - -=== Version 0.23 - -1999/07/15 22:32:09 - -- waitfor: if end of file reached, then return nil. - -=== Version 0.22 - -1999/06/29 09:08:51 - -- new, waitfor, cmd: {"Timeout" => false} # ignore timeout - -=== Version 0.21 - -1999/06/28 18:18:55 - -- waitfor: not rescue (EOFError) - -=== Version 0.20 - -1999/06/04 06:24:58 - -- waitfor: support for divided telnet command - -=== Version 0.181 - -1999/05/22 - -- bug fix: print method - -=== Version 0.18 - -1999/05/14 - -- respond to "IAC WON'T SGA" with "IAC DON'T SGA" -- DON'T SGA : end of line --> CR + LF -- bug fix: preprocess method - -=== Version 0.17 - -1999/04/30 - -- bug fix: $! + "\n" --> $!.to_s + "\n" - -=== Version 0.163 - -1999/04/11 - -- STDOUT.write(message) --> yield(message) if iterator? - -=== Version 0.162 - -1999/03/17 - -- add "Proxy" option -- required timeout.rb - -=== Version 0.161 - -1999/02/03 - -- select --> IO::select - -=== Version 0.16 - -1998/10/09 - -- preprocess method change for the better -- add binmode method. -- change default Binmode. TRUE --> FALSE - -=== Version 0.15 - -1998/10/04 - -- add telnetmode method. - -=== Version 0.141 - -1998/09/22 - -- change default prompt. /[$%#>] $/ --> /[$%#>] \Z/ - -=== Version 0.14 - -1998/09/01 - -- IAC WILL SGA send EOL --> CR+NULL -- IAC WILL SGA IAC DO BIN send EOL --> CR -- NONE send EOL --> LF -- add Dump_log option. - -=== Version 0.13 - -1998/08/25 - -- add print method. - -=== Version 0.122 - -1998/08/05 - -- support for HP-UX 10.20 thanks to WATANABE Tetsuya <tetsu@jpn.hp.com> -- socket.<< --> socket.write - -=== Version 0.121 - -1998/07/15 - -- string.+= --> string.concat - -=== Version 0.12 - -1998/06/01 - -- add timeout, waittime. - -=== Version 0.11 - -1998/04/21 - -- add realtime output. - -=== Version 0.10 - -1998/04/13 - -- first release. - -=end - -require "socket" -require "delegate" -require "timeout" - -class Telnet < SimpleDelegator - - IAC = 255.chr # "\377" # "\xff" # interpret as command: - DONT = 254.chr # "\376" # "\xfe" # you are not to use option - DO = 253.chr # "\375" # "\xfd" # please, you use option - WONT = 252.chr # "\374" # "\xfc" # I won't use option - WILL = 251.chr # "\373" # "\xfb" # I will use option - SB = 250.chr # "\372" # "\xfa" # interpret as subnegotiation - GA = 249.chr # "\371" # "\xf9" # you may reverse the line - EL = 248.chr # "\370" # "\xf8" # erase the current line - EC = 247.chr # "\367" # "\xf7" # erase the current character - AYT = 246.chr # "\366" # "\xf6" # are you there - AO = 245.chr # "\365" # "\xf5" # abort output--but let prog finish - IP = 244.chr # "\364" # "\xf4" # interrupt process--permanently - BREAK = 243.chr # "\363" # "\xf3" # break - DM = 242.chr # "\362" # "\xf2" # data mark--for connect. cleaning - NOP = 241.chr # "\361" # "\xf1" # nop - SE = 240.chr # "\360" # "\xf0" # end sub negotiation - EOR = 239.chr # "\357" # "\xef" # end of record (transparent mode) - ABORT = 238.chr # "\356" # "\xee" # Abort process - SUSP = 237.chr # "\355" # "\xed" # Suspend process - EOF = 236.chr # "\354" # "\xec" # End of file - SYNCH = 242.chr # "\362" # "\xf2" # for telfunc calls - - OPT_BINARY = 0.chr # "\000" # "\x00" # Binary Transmission - OPT_ECHO = 1.chr # "\001" # "\x01" # Echo - OPT_RCP = 2.chr # "\002" # "\x02" # Reconnection - OPT_SGA = 3.chr # "\003" # "\x03" # Suppress Go Ahead - OPT_NAMS = 4.chr # "\004" # "\x04" # Approx Message Size Negotiation - OPT_STATUS = 5.chr # "\005" # "\x05" # Status - OPT_TM = 6.chr # "\006" # "\x06" # Timing Mark - OPT_RCTE = 7.chr # "\a" # "\x07" # Remote Controlled Trans and Echo - OPT_NAOL = 8.chr # "\010" # "\x08" # Output Line Width - OPT_NAOP = 9.chr # "\t" # "\x09" # Output Page Size - OPT_NAOCRD = 10.chr # "\n" # "\x0a" # Output Carriage-Return Disposition - OPT_NAOHTS = 11.chr # "\v" # "\x0b" # Output Horizontal Tab Stops - OPT_NAOHTD = 12.chr # "\f" # "\x0c" # Output Horizontal Tab Disposition - OPT_NAOFFD = 13.chr # "\r" # "\x0d" # Output Formfeed Disposition - OPT_NAOVTS = 14.chr # "\016" # "\x0e" # Output Vertical Tabstops - OPT_NAOVTD = 15.chr # "\017" # "\x0f" # Output Vertical Tab Disposition - OPT_NAOLFD = 16.chr # "\020" # "\x10" # Output Linefeed Disposition - OPT_XASCII = 17.chr # "\021" # "\x11" # Extended ASCII - OPT_LOGOUT = 18.chr # "\022" # "\x12" # Logout - OPT_BM = 19.chr # "\023" # "\x13" # Byte Macro - OPT_DET = 20.chr # "\024" # "\x14" # Data Entry Terminal - OPT_SUPDUP = 21.chr # "\025" # "\x15" # SUPDUP - OPT_SUPDUPOUTPUT = 22.chr # "\026" # "\x16" # SUPDUP Output - OPT_SNDLOC = 23.chr # "\027" # "\x17" # Send Location - OPT_TTYPE = 24.chr # "\030" # "\x18" # Terminal Type - OPT_EOR = 25.chr # "\031" # "\x19" # End of Record - OPT_TUID = 26.chr # "\032" # "\x1a" # TACACS User Identification - OPT_OUTMRK = 27.chr # "\e" # "\x1b" # Output Marking - OPT_TTYLOC = 28.chr # "\034" # "\x1c" # Terminal Location Number - OPT_3270REGIME = 29.chr # "\035" # "\x1d" # Telnet 3270 Regime - OPT_X3PAD = 30.chr # "\036" # "\x1e" # X.3 PAD - OPT_NAWS = 31.chr # "\037" # "\x1f" # Negotiate About Window Size - OPT_TSPEED = 32.chr # " " # "\x20" # Terminal Speed - OPT_LFLOW = 33.chr # "!" # "\x21" # Remote Flow Control - OPT_LINEMODE = 34.chr # "\"" # "\x22" # Linemode - OPT_XDISPLOC = 35.chr # "#" # "\x23" # X Display Location - OPT_OLD_ENVIRON = 36.chr # "$" # "\x24" # Environment Option - OPT_AUTHENTICATION = 37.chr # "%" # "\x25" # Authentication Option - OPT_ENCRYPT = 38.chr # "&" # "\x26" # Encryption Option - OPT_NEW_ENVIRON = 39.chr # "'" # "\x27" # New Environment Option - OPT_EXOPL = 255.chr # "\377" # "\xff" # Extended-Options-List - - NULL = "\000" - CR = "\015" - LF = "\012" - EOL = CR + LF -v = $-v -$-v = false - VERSION = "1.20" - RELEASE_DATE = "$Date: 2000/01/24 17:02:57 $" -$-v = v - - def initialize(options) - @options = options - @options["Binmode"] = false unless @options.has_key?("Binmode") - @options["Host"] = "localhost" unless @options.has_key?("Host") - @options["Port"] = 23 unless @options.has_key?("Port") - @options["Prompt"] = /[$%#>] \z/n unless @options.has_key?("Prompt") - @options["Telnetmode"] = true unless @options.has_key?("Telnetmode") - @options["Timeout"] = 10 unless @options.has_key?("Timeout") - @options["Waittime"] = 0 unless @options.has_key?("Waittime") - - @telnet_option = { "SGA" => false, "BINARY" => false } - - if @options.has_key?("Output_log") - @log = File.open(@options["Output_log"], 'a+') - @log.sync = true - @log.binmode - end - - if @options.has_key?("Dump_log") - @dumplog = File.open(@options["Dump_log"], 'a+') - @dumplog.sync = true - @dumplog.binmode - def @dumplog.log_dump(dir, x) - len = x.length - addr = 0 - offset = 0 - while 0 < len - if len < 16 - line = x[offset, len] - else - line = x[offset, 16] - end - hexvals = line.unpack('H*')[0] - hexvals.concat ' ' * (32 - hexvals.length) - hexvals = format "%s %s %s %s " * 4, *hexvals.unpack('a2' * 16) - line.gsub! /[\000-\037\177-\377]/n, '.' - printf "%s 0x%5.5x: %s%s\n", dir, addr, hexvals, line - addr += 16 - offset += 16 - len -= 16 - end - print "\n" - end - end - - if @options.has_key?("Proxy") - if @options["Proxy"].kind_of?(Telnet) - @sock = @options["Proxy"].sock - elsif @options["Proxy"].kind_of?(TCPsocket) - @sock = @options["Proxy"] - else - raise "Error; Proxy is Telnet or TCPSocket object." - end - else - message = "Trying " + @options["Host"] + "...\n" - yield(message) if iterator? - @log.write(message) if @options.has_key?("Output_log") - @dumplog.log_dump('#', message) if @options.has_key?("Dump_log") - - begin - if @options["Timeout"] == false - @sock = TCPsocket.open(@options["Host"], @options["Port"]) - else - timeout(@options["Timeout"]){ - @sock = TCPsocket.open(@options["Host"], @options["Port"]) - } - end - rescue TimeoutError - raise TimeoutError, "timed-out; opening of the host" - rescue - @log.write($!.to_s + "\n") if @options.has_key?("Output_log") - @dumplog.log_dump('#', $!.to_s + "\n") if @options.has_key?("Dump_log") - raise - end - @sock.sync = true - @sock.binmode - - message = "Connected to " + @options["Host"] + ".\n" - yield(message) if iterator? - @log.write(message) if @options.has_key?("Output_log") - @dumplog.log_dump('#', message) if @options.has_key?("Dump_log") - end - - super(@sock) - end # initialize - - attr :sock - - def telnetmode(mode = 'turn') - if 'turn' == mode - @options["Telnetmode"] = @options["Telnetmode"] ? false : true - else - @options["Telnetmode"] = mode ? true : false - end - end - - def binmode(mode = 'turn') - if 'turn' == mode - @options["Binmode"] = @options["Binmode"] ? false : true - else - @options["Binmode"] = mode ? true : false - end - end - - def preprocess(string) - str = string.dup - - # combine CR+NULL into CR - str.gsub!(/#{CR}#{NULL}/no, CR) if @options["Telnetmode"] - - # combine EOL into "\n" - str.gsub!(/#{EOL}/no, "\n") unless @options["Binmode"] - - str.gsub!(/#{IAC}( - [#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]| - [#{DO}#{DONT}#{WILL}#{WONT}] - [#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}]| - #{SB}[^#{IAC}]*#{IAC}#{SE} - )/xno){ - if IAC == $1 # handle escaped IAC characters - IAC - elsif AYT == $1 # respond to "IAC AYT" (are you there) - 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 - self.write(IAC + WILL + OPT_BINARY) - else - self.write(IAC + WONT + $1[1..1]) - end - '' - elsif DONT[0] == $1[0] # respond to "IAC DON'T x" with "IAC WON'T x" - self.write(IAC + WONT + $1[1..1]) - '' - elsif WILL[0] == $1[0] # respond to "IAC WILL x" - if OPT_BINARY[0] == $1[1] - self.write(IAC + DO + OPT_BINARY) - elsif OPT_ECHO[0] == $1[1] - self.write(IAC + DO + OPT_ECHO) - elsif OPT_SGA[0] == $1[1] - @telnet_option["SGA"] = true - self.write(IAC + DO + OPT_SGA) - else - self.write(IAC + DONT + $1[1..1]) - end - '' - elsif WONT[0] == $1[0] # respond to "IAC WON'T x" - if OPT_ECHO[0] == $1[1] - self.write(IAC + DONT + OPT_ECHO) - elsif OPT_SGA[0] == $1[1] - @telnet_option["SGA"] = false - self.write(IAC + DONT + OPT_SGA) - else - self.write(IAC + DONT + $1[1..1]) - end - '' - else - '' - end - } - - str - end # preprocess - - def waitfor(options) - time_out = @options["Timeout"] - waittime = @options["Waittime"] - - if options.kind_of?(Hash) - prompt = if options.has_key?("Match") - options["Match"] - elsif options.has_key?("Prompt") - options["Prompt"] - elsif options.has_key?("String") - Regexp.new( Regexp.quote(options["String"]) ) - end - time_out = options["Timeout"] if options.has_key?("Timeout") - waittime = options["Waittime"] if options.has_key?("Waittime") - else - prompt = options - end - - if time_out == false - time_out = nil - end - - line = '' - buf = '' - rest = '' - until(prompt === line and not IO::select([@sock], nil, nil, waittime)) - unless IO::select([@sock], nil, nil, time_out) - raise TimeoutError, "timed-out; wait for the next data" - end - begin - c = @sock.sysread(1024 * 1024) - @dumplog.log_dump('<', c) if @options.has_key?("Dump_log") - if @options["Telnetmode"] - if Integer(c.rindex(/#{IAC}#{SE}/no)) < - Integer(c.rindex(/#{IAC}#{SB}/no)) - buf = preprocess(rest + c[0 ... c.rindex(/#{IAC}#{SB}/no)]) - rest = c[c.rindex(/#{IAC}#{SB}/no) .. -1] - elsif pt = c.rindex(/#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no) - buf = preprocess(rest + c[0 ... pt]) - rest = c[pt .. -1] - else - buf = preprocess(c) - rest = '' - end - end - @log.print(buf) if @options.has_key?("Output_log") - line.concat(buf) - yield buf if iterator? - rescue EOFError # End of file reached - if line == '' - line = nil - yield nil if iterator? - end - break - end - end - line - end - - def write(string) - length = string.length - while 0 < length - IO::select(nil, [@sock]) - @dumplog.log_dump('>', string[-length..-1]) if @options.has_key?("Dump_log") - length -= @sock.syswrite(string[-length..-1]) - end - end - - def print(string) - str = string.dup + "\n" - - str.gsub!(/#{IAC}/no, IAC + IAC) if @options["Telnetmode"] - - unless @options["Binmode"] - if @telnet_option["BINARY"] and @telnet_option["SGA"] - # IAC WILL SGA IAC DO BIN send EOL --> CR - str.gsub!(/\n/n, CR) - elsif @telnet_option["SGA"] - # IAC WILL SGA send EOL --> CR+NULL - str.gsub!(/\n/n, CR + NULL) - else - # NONE send EOL --> CR+LF - str.gsub!(/\n/n, EOL) - end - end - - self.write(str) - end - - def cmd(options) - match = @options["Prompt"] - time_out = @options["Timeout"] - - if options.kind_of?(Hash) - string = options["String"] - match = options["Match"] if options.has_key?("Match") - time_out = options["Timeout"] if options.has_key?("Timeout") - else - string = options - end - - self.print(string) - if iterator? - waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c } - else - waitfor({"Prompt" => match, "Timeout" => time_out}) - end - end - - def login(options, password = nil) - if options.kind_of?(Hash) - username = options["Name"] - password = options["Password"] - else - username = options - end - - if iterator? - line = waitfor(/login[: ]*\z/n){|c| yield c } - if password - line.concat( cmd({"String" => username, - "Match" => /Password[: ]*\z/n}){|c| yield c } ) - line.concat( cmd(password){|c| yield c } ) - else - line.concat( cmd(username){|c| yield c } ) - end - else - line = waitfor(/login[: ]*\z/n) - if password - line.concat( cmd({"String" => username, - "Match" => /Password[: ]*\z/n}) ) - line.concat( cmd(password) ) - else - line.concat( cmd(username) ) - end - end - line - end - -end +Telnet = ::Net::Telnet diff --git a/lib/thread.rb b/lib/thread.rb index 9edda48abe..75822b91be 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -1,7 +1,10 @@ # # thread.rb - thread support classes # $Date$ -# by Yukihiro Matsumoto <matz@caelum.co.jp> +# by Yukihiro Matsumoto <matz@netlab.co.jp> +# +# Copyright (C) 2000 Network Applied Communication Laboratory, Inc. +# Copyright (C) 2000 Information-technology Promotion Agancy, Japan # unless defined? Thread @@ -71,6 +74,7 @@ class Mutex retry end Thread.critical = false + t.run if t self end diff --git a/lib/timeout.rb b/lib/timeout.rb index b6bda6cece..ab55e73ed6 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -1,6 +1,9 @@ # # timeout.rb -- execution timeout # +# Copyright (C) 2000 Network Applied Communication Laboratory, Inc. +# Copyright (C) 2000 Information-technology Promotion Agancy, Japan +# #= SYNOPSIS # # require 'timeout' @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** main.c - @@ -6,7 +6,9 @@ $Date$ created at: Fri Aug 19 13:19:58 JST 1994 -************************************************/ + Copyright (C) 1993-2000 Yukihiro Matsumoto + +**********************************************************************/ #include "ruby.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** marshal.c - @@ -6,7 +6,9 @@ $Date$ created at: Thu Apr 27 16:30:01 JST 1995 -************************************************/ + Copyright (C) 1993-2000 Yukihiro Matsumoto + +**********************************************************************/ #include "ruby.h" #include "rubyio.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** math.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include <math.h> diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index 3b0bb2a2bc..a882f9fba1 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -114,6 +114,31 @@ (defvar ruby-indent-level 2 "*Indentation of ruby statements.") +(eval-when-compile (require 'cl)) +(defun ruby-imenu-create-index () + (let ((index-alist '()) + class-name class-begin method-name method-begin decl) + (goto-char (point-min)) + (while (re-search-forward "^\\s *\\(class\\|def\\)\\s *\\([^(\n ]+\\)" nil t) + (setq decl (buffer-substring (match-beginning 1) (match-end 1))) + (cond + ((string= "class" decl) + (setq class-begin (match-beginning 2)) + (setq class-name (buffer-substring class-begin (match-end 2))) + (push (cons class-name (match-beginning 0)) index-alist) + (ruby-mark-defun) + (save-restriction + (narrow-to-region (region-beginning) (region-end)) + (while (re-search-forward "^\\s *def\\s *\\([^(\n ]+\\)" nil t) + (setq method-begin (match-beginning 1)) + (setq method-name (buffer-substring method-begin (match-end 1))) + (push (cons (concat class-name "#" method-name) (match-beginning 0)) index-alist)))) + ((string= "def" decl) + (setq method-begin (match-beginning 2)) + (setq method-name (buffer-substring method-begin (match-end 2))) + (push (cons method-name (match-beginning 0)) index-alist)))) + index-alist)) + (defun ruby-mode-variables () (set-syntax-table ruby-mode-syntax-table) (setq local-abbrev-table ruby-mode-abbrev-table) @@ -153,6 +178,9 @@ The variable ruby-indent-level controls the amount of indentation. (setq major-mode 'ruby-mode) (ruby-mode-variables) + (make-local-variable 'imenu-create-index-function) + (setq imenu-create-index-function 'ruby-imenu-create-index) + (run-hooks 'ruby-mode-hook)) (defun ruby-current-indentation () @@ -250,8 +278,8 @@ The variable ruby-indent-level controls the amount of indentation. (goto-char indent-point)))) ((looking-at "/") (cond - ((and (not (eobp)) (ruby-expr-beg 'expr-arg)) - (if (re-search-forward "[^\\]/" indent-point t) + ((and (not (eobp)) (ruby-expr-beg)) + (if (re-search-forward "[^\\]\\(\\\\\\\\\\)*/" indent-point t) nil (setq in-string (point)) (goto-char indent-point))) @@ -262,15 +290,21 @@ The variable ruby-indent-level controls the amount of indentation. ((and (not (eobp)) (ruby-expr-beg 'expr-arg) (not (looking-at "%=")) (looking-at "%[Qqrxw]?\\(.\\)")) + (goto-char (match-beginning 1)) (setq w (buffer-substring (match-beginning 1) (match-end 1))) (cond - ((string= w "[") (setq w "]")) + ((string= w "[") (setq w "\\]")) ((string= w "{") (setq w "}")) ((string= w "(") (setq w ")")) - ((string= w "<") (setq w ">"))) - (goto-char (match-end 0)) - (if (search-forward w indent-point t) + ((string= w "<") (setq w ">")) + ((member w '("*" "." "+" "?" "^" "$")) + (setq w (concat "\\" w)))) + (if (re-search-forward + (if (string= w "\\") + "\\\\[^\\]*\\\\" + (concat "[^\\]\\(\\\\\\\\\\)*" w)) + indent-point t) nil (setq in-string (point)) (goto-char indent-point))) @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** node.h - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #ifndef NODE_H #define NODE_H @@ -119,6 +119,7 @@ enum node_type { NODE_ALLOCA, #endif NODE_MEMO, + NODE_LAST }; typedef struct RNode { @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** numeric.c - @@ -8,12 +8,12 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include <math.h> #include <stdio.h> -#if defined(FreeBSD) && __FreeBSD_version < 400012 +#if defined(__FreeBSD__) && __FreeBSD__ < 4 #include <floatingpoint.h> #endif @@ -28,10 +28,6 @@ VALUE rb_cFixnum; VALUE rb_eZeroDivError; VALUE rb_eFloatDomainError; -ID rb_frame_last_func(); -VALUE rb_float_new(); -double rb_big2dbl(); - void rb_num_zerodiv() { @@ -1451,7 +1447,7 @@ fix_zero_p(num) void Init_Numeric() { -#if defined(FreeBSD) && __FreeBSD_version < 400012 +#if defined(__FreeBSD__) && __FreeBSD__ < 4 /* allow divide by zero -- Inf */ fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_INV|FP_X_OFL)); #endif @@ -1459,7 +1455,7 @@ Init_Numeric() to_i = rb_intern("to_i"); rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError); - rb_eFloatDomainError = rb_define_class("FloatDomainError", rb_eStandardError); + rb_eFloatDomainError = rb_define_class("FloatDomainError", rb_eRangeError); rb_cNumeric = rb_define_class("Numeric", rb_cObject); rb_include_module(rb_cNumeric, rb_mComparable); @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** object.c - @@ -7,8 +7,10 @@ created at: Thu Jul 15 12:01:24 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" #include "st.h" @@ -829,6 +831,7 @@ fail_to_type(arg) arg->val == Qfalse ? "false" : rb_class2name(CLASS_OF(arg->val)), arg->s); + return Qnil; /* not reached */ } VALUE @@ -1062,6 +1065,7 @@ Init_Object() rb_define_method(rb_mKernel, "id", rb_obj_id, 0); rb_define_method(rb_mKernel, "__id__", rb_obj_id, 0); rb_define_method(rb_mKernel, "type", rb_obj_type, 0); + rb_define_method(rb_mKernel, "class", rb_obj_type, 0); rb_define_method(rb_mKernel, "clone", rb_obj_clone, 0); rb_define_method(rb_mKernel, "dup", rb_obj_dup, 0); @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** pack.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include <sys/types.h> @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** parse.y - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ %{ @@ -360,7 +360,7 @@ stmt : block_call $$ = 0; } } - | stmt kRESCUE_MOD expr + | stmt kRESCUE_MOD stmt { $$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0); } @@ -1210,7 +1210,7 @@ primary : literal if ($8) $5 = NEW_ENSURE($5, $8); /* NOEX_PRIVATE for toplevel */ - $$ = NEW_DEFN($2, $4, $5, class_nest?0:1); + $$ = NEW_DEFN($2, $4, $5, class_nest?NOEX_PUBLIC:NOEX_PRIVATE); fixpos($$, $4); local_pop(); cur_mid = 0; @@ -1655,10 +1655,6 @@ singleton : var_ref if (nd_type($1) == NODE_SELF) { $$ = NEW_SELF(); } - else if (nd_type($1) == NODE_NIL) { - yyerror("Can't define single method for nil."); - $$ = 0; - } else { $$ = $1; } @@ -2454,9 +2450,13 @@ parse_quotedwords(term, paren) c = '\\'; break; default: - if (ISSPACE(c)) + if (c == term) { + tokadd(c); + continue; + } + if (!ISSPACE(c)) tokadd('\\'); - tokadd(c); + break; } } else if (ISSPACE(c)) { @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** prec.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -*************************************************/ +**********************************************************************/ #include "ruby.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** process.c - @@ -7,8 +7,10 @@ created at: Tue Aug 10 14:30:50 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" #include "rubysig.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** random.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** range.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** re.c - @@ -7,7 +7,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include "re.h" @@ -184,7 +184,7 @@ kcode_reset_option() int rb_reg_mbclen2(c, re) - unsigned char c; + unsigned int c; VALUE re; { int len; @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** re.h - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #ifndef RE_H #define RE_H @@ -39,6 +39,6 @@ void rb_match_busy _((VALUE)); extern int ruby_ignorecase; -int rb_reg_mbclen2 _((unsigned char, VALUE)); +int rb_reg_mbclen2 _((unsigned int, VALUE)); #define mbclen2(c,re) rb_reg_mbclen2((c),(re)) #endif @@ -70,7 +70,7 @@ void *xrealloc _((void*,size_t)); void free _((void*)); #endif -#define NO_ALLOCA */ /* try it out for now */ +#define NO_ALLOCA /* /* try it out for now */ #ifndef NO_ALLOCA /* Make alloca work the best possible way. */ #ifdef __GNUC__ @@ -162,7 +162,7 @@ static char re_syntax_table[256]; static void init_syntax_once _((void)); static const unsigned char *translate = 0; static void init_regs _((struct re_registers*, unsigned int)); -static void bm_init_skip _((int *, unsigned char*, int, const char*)); +static void bm_init_skip _((int *, unsigned char*, int, const unsigned char*)); static int current_mbctype = MBCTYPE_ASCII; #undef P @@ -2618,7 +2618,7 @@ bm_init_skip(skip, pat, m, translate) int *skip; unsigned char *pat; int m; - const char *translate; + const unsigned char *translate; { int j, c; @@ -7,6 +7,8 @@ created at: Tue Aug 10 12:47:31 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan ************************************************/ @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** ruby.h - @@ -6,8 +6,10 @@ created at: Thu Jun 10 14:26:32 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -*************************************************/ +**********************************************************************/ #ifndef RUBY_H #define RUBY_H @@ -552,7 +554,7 @@ rb_type(VALUE obj) if (obj == Qnil) return T_NIL; if (obj == Qfalse) return T_FALSE; if (obj == Qtrue) return T_TRUE; - if (obj == Qtrue) return T_UNDEF; + if (obj == Qundef) return T_UNDEF; if (SYMBOL_P(obj)) return T_SYMBOL; return BUILTIN_TYPE(obj); } @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** rubyio.h - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #ifndef IO_H #define IO_H @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** rubysig.h - @@ -6,7 +6,10 @@ $Date$ created at: Wed Aug 16 01:15:38 JST 1995 -************************************************/ + Copyright (C) 1993-2000 Yukihiro Matsumoto + +**********************************************************************/ + #ifndef SIG_H #define SIG_H diff --git a/sample/test.rb b/sample/test.rb index 2e9d3e08ee..9d77647cf7 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -694,7 +694,11 @@ $x.each_byte {|i| } ok(!$bad) -check "asignment" +s = "a string" +s[0..s.size]="another string" +ok(s == "another string") + +check "assignment" a = nil ok(defined?(a)) ok(a == nil) @@ -6,6 +6,10 @@ $Date$ created at: Tue Dec 20 10:13:44 JST 1994 + Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan + ************************************************/ #include "ruby.h" @@ -7,6 +7,8 @@ created at: Fri Oct 15 10:39:26 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan ************************************************/ @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** string.c - @@ -7,8 +7,10 @@ created at: Mon Aug 9 17:12:58 JST 1993 Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan -************************************************/ +**********************************************************************/ #include "ruby.h" #include "re.h" @@ -767,29 +769,36 @@ rb_str_succ(orig) VALUE str, str2; char *sbeg, *s; int c = -1; + int n = 0; str = rb_str_new(RSTRING(orig)->ptr, RSTRING(orig)->len); + OBJ_INFECT(str, orig); + if (RSTRING(str)->len == 0) return str; sbeg = RSTRING(str)->ptr; s = sbeg + RSTRING(str)->len - 1; while (sbeg <= s) { - if (ISALNUM(*s) && (c = succ_char(s)) == 0) break; + if (ISALNUM(*s)) { + if ((c = succ_char(s)) == 0) break; + n = s - sbeg; + } s--; } - if (s < sbeg) { - if (c == -1 && RSTRING(str)->len > 0) { - RSTRING(str)->ptr[RSTRING(str)->len-1] += 1; - } - else { - str2 = rb_str_new(0, RSTRING(str)->len+1); - RSTRING(str2)->ptr[0] = c; - memcpy(RSTRING(str2)->ptr+1, RSTRING(str)->ptr, RSTRING(str)->len); - str = str2; + if (c == -1) { /* str contains no alnum */ + sbeg = RSTRING(str)->ptr; s = sbeg + RSTRING(str)->len - 1; + c = '\001'; + while (sbeg <= s) { + *s += 1; + if (*s-- != 0) break; } } - - if (OBJ_TAINTED(orig)) { - OBJ_TAINT(str); + if (s < sbeg) { + REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len + 1); + s = RSTRING(str)->ptr + n; + memmove(s+1, s, RSTRING(str)->len - n); + *s = c; + RSTRING(str)->len += 1; + } return str; @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** struct.c - @@ -6,7 +6,9 @@ $Date$ created at: Tue Mar 22 18:44:30 JST 1995 -************************************************/ + Copyright (C) 1993-2000 Yukihiro Matsumoto + +**********************************************************************/ #include "ruby.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** time.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include <sys/types.h> @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** util.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include <stdio.h> @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** util.h - @@ -8,7 +8,8 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ + #ifndef UTIL_H #define UTIL_H diff --git a/variable.c b/variable.c index ec2f9bedc6..949de9d48b 100644 --- a/variable.c +++ b/variable.c @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** variable.c - @@ -6,7 +6,11 @@ $Date$ created at: Tue Apr 19 23:55:15 JST 1994 -************************************************/ + Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 2000 Network Applied Communication Laboratory, Inc. + Copyright (C) 2000 Information-technology Promotion Agancy, Japan + +**********************************************************************/ #include "ruby.h" #include "env.h" @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** version.c - @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto -************************************************/ +**********************************************************************/ #include "ruby.h" #include "version.h" @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.5.3" -#define RUBY_RELEASE_DATE "2000-04-11" +#define RUBY_RELEASE_DATE "2000-05-01" #define RUBY_VERSION_CODE 153 -#define RUBY_RELEASE_CODE 20000411 +#define RUBY_RELEASE_CODE 20000501 |