From: nobu.nakada@... Date: 2002-05-22T17:08:47+09:00 Subject: [ruby-dev:17180] Re: コマンドラインオプションの順序制約 なかだです。 At Wed, 22 May 2002 16:48:54 +0900, Kazuhiro NISHIYAMA wrote: > -T などのオプションの後に他のオプションがかけないというのは > そういう仕様なのでしょうか? > > #!/usr/bin/ruby -wTKe で$KCODE="NONE"になっていて驚いたのですが。 それはちょっと意表を突かれるかも。空白も同じような。 Index: ruby.c =================================================================== RCS file: /cvs/ruby/src/ruby/ruby.c,v retrieving revision 1.58 diff -u -2 -p -r1.58 ruby.c --- ruby.c 2002/05/14 06:22:26 1.58 +++ ruby.c 2002/05/22 08:05:36 @@ -562,5 +562,5 @@ proc_options(argc, argv) rb_set_safe_level(v); } - break; + goto reswitch; case 'I': @@ -627,5 +627,5 @@ proc_options(argc, argv) case ' ': if (s[1] == '-') s+=2; - break; + goto reswitch; default: @@ -657,8 +657,10 @@ proc_options(argc, argv) else { while (s && *s) { - while (ISSPACE(*s)) s++; if (*s == '-') { s++; - if (ISSPACE(*s)) continue; + if (ISSPACE(*s)) { + do {s++;} while (ISSPACE(*s)); + continue; + } } if (!*s) break; -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦