Hi,

At Fri, 15 Jul 2011 21:28:50 +0900,
Luis Lavena wrote in [ruby-core:38075]:
> On RubyInstaller we replaced that with plain stubs and the
> original scripts from Ruby's source code, see here:

I see.  There is only irb.bat, not irb sans the suffix.  In
that sense, it's natural to fail, but maybe unexpected
behavior.  Now I'm thinking to make -S option search with .bat
(and .cmd too) suffix if it is not found.  How do you feel
about this?

=0C
diff --git a/ruby.c b/ruby.c
index 93b12d8..b8258ea 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1288,14 +1288,42 @@ process_options(int argc, char **argv, struct
cmdline_options *opt)
 	    }
 	    else if (opt->do_search) {
 		char *path =3D getenv("RUBYPATH");
+#ifdef DOSISH
+		char *batch =3D NULL;
+		size_t batchlen =3D 0;
+#endif

 		opt->script =3D 0;
 		if (path) {
 		    opt->script =3D dln_find_file_r(argv[0], path, fbuf, sizeof(fbuf));
 		}
+#ifdef DOSISH
 		if (!opt->script) {
-		    opt->script =3D dln_find_file_r(argv[0], getenv(PATH_ENV), fbuf,
sizeof(fbuf));
+		    batchlen =3D strlen(argv[0]);
+		    batch =3D ALLOC_N(char,  batchlen + 5);
+		    memcpy(batch, argv[0], batchlen);
+		    memcpy(batch + batchlen, ".bat", 5);
+		    opt->script =3D dln_find_file_r(batch, path, fbuf, sizeof(fbuf));
+		    if (!opt->script) {
+			memcpy(batch + batchlen, ".cmd", 5);
+			opt->script =3D dln_find_file_r(batch, path, fbuf, sizeof(fbuf));
+		    }
+		}
+#endif
+		if (!opt->script && (path =3D getenv(PATH_ENV)) !=3D NULL) {
+		    opt->script =3D dln_find_file_r(argv[0], path, fbuf, sizeof(fbuf));
 		}
+#ifdef DOSISH
+		if (!opt->script) {
+		    memcpy(batch + batchlen, ".bat", 5);
+		    opt->script =3D dln_find_file_r(batch, path, fbuf, sizeof(fbuf));
+		    if (!opt->script) {
+			memcpy(batch + batchlen, ".cmd", 5);
+			opt->script =3D dln_find_file_r(batch, path, fbuf, sizeof(fbuf));
+		    }
+		}
+		if (batch) xfree(batch);
+#endif
 		if (!opt->script)
 		    opt->script =3D argv[0];
 	    }
=0C

--=20
Nobu Nakada