[#9642] Re: host.conf は参照しないの? — akira yamada / やまだあきら <akira@...>

15 messages 2000/05/09

[#9672] IO.popen — Koji Arai <JCA02266@...>

新井です。

22 messages 2000/05/13
[#9673] Re: IO.popen — Koji Arai <JCA02266@...> 2000/05/13

新井です。

[#9682] Re: IO.popen — matz@... (Yukihiro Matsumoto) 2000/05/14

まつもと ゆきひろです

[#9676] support mingw32 — WATANABE Hirofumi <eban@...>

わたなべです.

32 messages 2000/05/13
[#9678] Re: support mingw32 — Masaki Suketa <CQN02273@...> 2000/05/14

助田です.

[#9680] Re: support mingw32 — WATANABE Hirofumi <eban@...> 2000/05/14

わたなべです.

[#9686] Re: support mingw32 — Katsuyuki Komatsu <komatsu@...> 2000/05/15

小松です。

[#9687] Re: support mingw32 — WATANABE Hirofumi <Hirofumi.Watanabe@...> 2000/05/15

わたなべです.

[#9806] rescue variable syntax — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

40 messages 2000/05/24
[#9811] Re: rescue variable syntax — ARIMA Yasuhiro <fit0298@...> 2000/05/24

有馬です。

[#9814] Re: rescue variable syntax — matz@... (Yukihiro Matsumoto) 2000/05/24

まつもと ゆきひろです

[#9821] Re: rescue variable syntax — nobu.nakada@... 2000/05/25

なかだです。

[#9823] Re: rescue variable syntax — ARIMA Yasuhiro <fit0298@...> 2000/05/25

有馬です。

[#9833] Re: rescue variable syntax — matz@... (Yukihiro Matsumoto) 2000/05/25

まつもと ゆきひろです

[#9861] Re: rescue variable syntax — gotoken@... (GOTO Kentaro) 2000/05/25

ごとけんです

[#9866] Re: rescue variable syntax — matz@... (Yukihiro Matsumoto) 2000/05/25

まつもと ゆきひろです

[#9870] Re: rescue variable syntax — nagai@... 2000/05/26

永井@知能.九工大です.

[#9873] Re: rescue variable syntax — matz@... (Yukihiro Matsumoto) 2000/05/27

まつもと ゆきひろです

[#9812] Forward: Error in NT makefile (PR#7) — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

21 messages 2000/05/24
[#9820] Re: Forward: Error in NT makefile (PR#7) — Katsuyuki Komatsu <komatsu@...> 2000/05/25

小松です。

[#9842] Re: Forward: Error in NT makefile (PR#7) — WATANABE Hirofumi <Hirofumi.Watanabe@...> 2000/05/25

わたなべです.

[#9855] Re: Forward: Error in NT makefile (PR#7) — Katsuyuki Komatsu <komatsu@...> 2000/05/25

小松です。

[#9879] Re: Forward: Error in NT makefile (PR#7) — WATANABE Hirofumi <eban@...> 2000/05/28

わたなべです.

[#9857] $0 handling on NT — Katsuyuki Komatsu <komatsu@...>

小松です。

18 messages 2000/05/25
[#9869] Re: $0 handling on NT — nobu.nakada@... 2000/05/26

なかだです。

[ruby-dev:9876] Re: $0 handling on NT

From: nobu.nakada@...
Date: 2000-05-27 19:50:36 UTC
List: ruby-dev #9876
なかだです。

  たびたびアレですが。

At Sun, 28 May 2000 03:05:26 +0900,
Nobuyoshi-Nakada wrote:
> > |  それと、Windows で(DOS では少なかったような気がする)日本語のファイル
> > |名をつける人って結構いるんですが、2byte 目に '\' を含むパス名ってどう
> > |したもんでしょうかねぇ。SJIS 決めうちってわけにはいかないし。
> > 
> > win32/win32.cでは、CharPrev()とCharNext()を使ってます。
> 
>   CharNext() ってなに? とか思ったら Win32 API ですか。

  別に日本語のファイル名は Windows の専売特許でもないし、ってこ
とで POSIX なシステムでも対応してみました。おそらくは Windows
でも mbtowc() がちゃんと使えれば CharNext() を使わなくても動く…
はず。

# でも違いが分からない(^^; ていうか、そのための EUC か。

  file.c は cvs からだと大きくなっちゃったので [ruby-dev:9875]
からの差分です。


Sun May 28 04:42:12 2000  Nobuyoshi Nakada  <nobu.nakada@nifty.ne.jp>

	* configure.in: check for locale.h.

	* main.c (main): setlocale.

	* file.c (next_char, lastsep): newly added to support multi-byte
	  file names.

	* file.c (hasdrive): newly added for DOSISH environment.

	* file.c (rb_file_s_expand_path, path_check_1): multi-byte file
	  name support.

	* file.c (rb_file_s_basename): multi-byte file name and DOSISH
	  drive letter support.
	  and should always infect return value.

	* file.c (rb_file_s_dirname): multi-byte file name and DOSISH
	  drive letter support.


Index: configure.in
===================================================================
RCS file: /home/cvs/ruby/configure.in,v
retrieving revision 1.28
diff -u -2 -p -r1.28 configure.in
--- configure.in	2000/05/24 04:33:54	1.28
+++ configure.in	2000/05/27 19:39:33
@@ -184,5 +184,6 @@ AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h\
 		 fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
-		 syscall.h pwd.h a.out.h utime.h memory.h direct.h sys/resource.h)
+		 syscall.h pwd.h a.out.h utime.h memory.h direct.h sys/resource.h\
+		 locale.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
Index: main.c
===================================================================
RCS file: /home/cvs/ruby/main.c,v
retrieving revision 1.4
diff -u -2 -p -r1.4 main.c
--- main.c	2000/05/01 09:41:23	1.4
+++ main.c	2000/05/27 19:39:35
@@ -13,4 +13,8 @@
 #include "ruby.h"
 
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
 #ifdef DJGPP
 unsigned int _stklen = 0x180000;
@@ -35,4 +39,8 @@ main(argc, argv, envp)
 #if defined(__MACOS__) && defined(__MWERKS__)
     argc = ccommand(&argv);
+#endif
+
+#ifdef LC_ALL
+    setlocale(LC_ALL, "");
 #endif
 

--- file.c.old	Sun May 28 02:54:16 2000
+++ file.c	Sun May 28 03:52:03 2000
@@ -71,14 +71,20 @@ char *strrchr _((const char*,const char)
 #endif
 
-#ifdef CharNext
+#if defined(CharNext)
 #define next_char CharNext
+#elif defined(MB_CUR_MAX)
+static char*
+next_char(p)
+    char *p;
+{
+    int n = mbtowc(NULL, p, MB_CUR_MAX);
+    if (n > 0)
+	return p + n;
+    else
+	return p + 1;
+}
 #else
 #define next_char(p) ((p) + 1)
 #endif
-#ifdef CharPrev
-#define prev_char CharPrev
-#else
-#define prev_char(s, p) ((p) - 1)
-#endif
 
 #ifdef __EMX__
@@ -1179,4 +1185,16 @@ rb_file_s_umask(argc, argv)
 #endif
 
+static char* lastsep(path)
+    char *path;
+{
+    char *last = NULL;
+    while (*path) {
+	if (isdirsep(*path))
+	    last = path;
+	path = next_char(path);
+    }
+    return last;
+}
+
 VALUE
 rb_file_s_expand_path(argc, argv)
@@ -1252,6 +1270,9 @@ rb_file_s_expand_path(argc, argv)
 #endif
 	}
-	p = &buf[strlen(buf)];
-	while (p > buf && (t = prev_char(buf, p), isdirsep(*t))) p = t;
+	for (p = t = buf; *t; ) {
+	    char c = *t;
+	    t = next_char(t);
+	    if (!isdirsep(c)) p = t;
+	}
     }
     else {
@@ -1273,6 +1294,8 @@ rb_file_s_expand_path(argc, argv)
 		if (*(s+1) == '\0' || isdirsep(*(s+1))) { 
 		    /* We must go back to the parent */
-		    if (isdirsep(*p) && p > buf) p = prev_char(buf, p);
-		    while (p > buf && !isdirsep(*p)) p = prev_char(buf, p);
+		    if (p > buf) {
+			*p = '\0';
+			p = lastsep(buf);
+		    }
 		    ++s;
 		}
@@ -1345,16 +1368,4 @@ rmext(p, e)
 
 #ifdef DOSISH
-static char* lastsep(path)
-    char *path;
-{
-    char *last = NULL;
-    while (*path) {
-	if (isdirsep(*path))
-	    last = path;
-	path = next_char(path);
-    }
-    return last;
-}
-
 static int hasdrive(path)
     char *path;
@@ -1365,7 +1376,4 @@ static int hasdrive(path)
 	return Qfalse;
 }
-
-#else
-#define lastsep(path) strrchr((path), '/')
 #endif
 


-- 
そうだ 強気に ちょっと インチキに☆彡
    中田 "Bugるくらいがちょうどいいかも;-)" 伸悦

In This Thread