e$B$J$+$@$G$9!#e(B
At Mon, 16 Jul 2007 21:23:01 +0900,
pegacorn wrote in [ruby-dev:31239]:
e$B:#EY$O!"e(Bcygwin e$B4D6-$Ge(B -Wall e$B$rIU$1$F%3%s%Q%$%k$7$F$_$^$7$?!#e(B
gcc -g -O2 -Wall -I. -I.ext/include/i386-cygwin -I./include -I. -DRUBY_EXPORT -c dln.c
dln.c: In function conv_to_posix_path': dln.c:1615: warning: implicit declaration of function
cygwin32_conv_to_posix_path’
gcc -g -O2 -Wall -I. -I.ext/include/i386-cygwin -I./include -I. -DRUBY_EXPORT -c ruby.c
ruby.c: In function ruby_push_include': ruby.c:190: warning: implicit declaration of function
conv_to_posix_path’
conv_to_posix_path()e$B$O85$Oe(Bdln.ce$B$G$b;H$C$F$$$?$N$G$9$,!":#$Oe(B
ruby.ce$B$G$7$+;H$C$F$$$^$;$s!#e(Bruby.ce$B$K$=$N$^$^0\F0$7$F$b$$$$$+$be(B
e$B$7$l$^$;$s$,!":G8e$N%A%’%C%/$O$J$s$@$+0UL#ITL@$@$7!"e(B
rubylib_manglee$B4X78$b$=$m$=$m>C$7$F$$$$$H;W$$$^$9!#e(B
e$B$o$?$J$Y$5$s$O!"e(BPOSIX
pathe$B$X$NJQ49<+BN$r$d$a$K$7$?$$$=$&$G$9$,!#e(B
gcc -g -O2 -Wall -I. -I.ext/include/i386-cygwin -I./include -I. -DRUBY_EXPORT -c ./missing/strftime.c
./missing/strftime.c: In function `strftime’:
./missing/strftime.c:448: warning: int format, long int arg (arg 3)
./missing/strftime.c:448: warning: int format, long int arg (arg 4)
e$B$3$l$O5U$KCM$N$[$&$r%-%c%9%H$7$F$b$$$$$h$&$J!#e(B
compiling socket
gcc -I. -I…/…/.ext/include/i386-cygwin -I…/…/./include -I…/…/./ext/socket -DRUBY_EXTCONF_H=“extconf.h” -I. -g -O2 -Wall -c getnameinfo.c
getnameinfo.c: In function inet_ntop': getnameinfo.c:126: warning: implicit declaration of function
snprintf’
stdio.he$B$/$i$$$O>o$K%$%s%/%k!<%I$7$F$$$$$s$8$c$J$$$G$7$g$&$+!#e(B
compiling tk
gcc -I. -I…/…/.ext/include/i386-cygwin -I…/…/./include -I…/…/./ext/tk -DRUBY_EXTCONF_H=“extconf.h” -D_WIN32 -DWITH_TCL_ENABLE_THREAD=0 -g -O2 -Wall -c tcltklib.c
tcltklib.c: In function eventloop_sleep': tcltklib.c:1262: warning: implicit declaration of function
is_ruby_native_thread’
e$B$3$l$O1J0f$5$s$,$J$K$+$$$C$F$^$;$s$G$7$?$C$1!#e(B
Index: dln.c
— dln.c (revision 12804)
+++ dln.c (working copy)
@@ -1601,30 +1601,4 @@ dln_find_file(const char *fname, const c
}
-#if defined(CYGWIN32)
-const char *
-conv_to_posix_path(char *win32, char *posix, int len)
-{
static char fbuf[MAXPATHLEN];
Index: ruby.c
— ruby.c (revision 12804)
+++ ruby.c (working copy)
@@ -15,4 +15,5 @@
#ifdef CYGWIN
#include <windows.h>
+#include <sys/cygwin.h>
#endif
#ifdef _WIN32_WCE
@@ -117,103 +118,84 @@ extern VALUE rb_load_path;
#define STATIC_FILE_LENGTH 255
-#if defined _WIN32 || defined CYGWIN || defined DJGPP
-static char *
-rubylib_mangle(const char s, unsigned int l)
+#ifndef CharNext / defined as CharNext[AW] on Windows. */
+#define CharNext§ (§ + mblen(p, RUBY_MBCHAR_MAXSIZE))
+#endif
+
+#if defined(CYGWIN32)
+const char *
+conv_to_posix_path(char *win32, char *posix, int len)
{
- static char *newp, *oldp;
- static int newl, oldl, notfound;
- static char newsub[STATIC_FILE_LENGTH + 1];
-
- if (!newp && !notfound) {
- newp = getenv(“RUBYLIB_PREFIX”);
- if (newp) {
-
char *s;
-
-
oldp = newp;
-
while (*newp && !ISSPACE(*newp) && *newp != ';') {
- newp++;
- oldl++; /* Skip digits. */
-
}
-
while (*newp && (ISSPACE(*newp) || *newp == ';')) {
- newp++; /* Skip whitespace. */
-
}
-
newl = strlen(newp);
-
if (newl == 0 || oldl == 0 || newl > STATIC_FILE_LENGTH) {
- rb_fatal(“malformed RUBYLIB_PREFIX”);
-
}
-
strcpy(newsub, newp);
-
s = newsub;
-
while (*s) {
- if (*s == ‘\’)
-
*s = '/';
- s++;
-
}
- }
- else {
-
notfound = 1;
- }
- if (l == 0) {
- l = strlen(s);
- }
- if (!newp || l < oldl || strncasecmp(oldp, s, oldl) != 0) {
- static char ret[STATIC_FILE_LENGTH + 1];
- strncpy(ret, s, l);
- ret[l] = 0;
- return ret;
- }
- if (l + newl - oldl > STATIC_FILE_LENGTH || newl >
STATIC_FILE_LENGTH) {
- rb_fatal(“malformed RUBYLIB_PREFIX”);
- }
- strcpy(newsub + newl, s + oldl);
- newsub[l + newl - oldl] = 0;
- return newsub;
- if (len < strlen(first))
- fprintf(stderr, “PATH length too long: %s\n”, first);
- else
- cygwin32_conv_to_posix_path(first, posix);
- return dst;
}
-#define rubylib_mangled_path(s, l) rb_str_new2(rubylib_mangle((s),
(l)))
-#define rubylib_mangled_path2(s) rb_str_new2(rubylib_mangle((s), 0))
-#else
-#define rubylib_mangled_path(s, l) rb_str_new((s), (l))
-#define rubylib_mangled_path2(s) rb_str_new2(s)
#endif
-void
-ruby_push_include(const char *path, VALUE (*filter) (VALUE))
+static void
+push_include(const char *path, VALUE (*filter) (VALUE))
{
const char sep = PATH_SEP_CHAR;
- if (path == 0)
- return;
-#if defined(CYGWIN)
- {
- char rubylib[FILENAME_MAX];
- conv_to_posix_path(path, rubylib, FILENAME_MAX);
- path = rubylib;
- p = path;
- while (*p) {
- while (*p == sep)
-
p++;
- if (!*p) break;
- for (s = p; *s && *s != sep; s = CharNext(s));
- rb_ary_push(rb_load_path, (*filter)(rb_str_new(p, s - p)));
- if (!*s) break;
- p = s + 1;
}
-#endif
+}
+
+void
+ruby_push_include(const char *path, VALUE (*filter) (VALUE))
+{
+#if defined CYGWIN32
- const char sep = ‘;’;
- const char *p, *s;
- char rubylib[FILENAME_MAX], *buf;
- int len;
-
- p = path;
- while (*p) {
- while (*p == sep)
-
p++;
- if (!*p) break;
- for (s = p; *s && *s != sep; s = CharNext(s));
- if (*s) {
-
buf = ALLOC_N(char, (len = s - p));
-
MEMCPY(buf, p, char, len);
-
cygwin32_conv_to_posix_path(buf, rubylib);
-
free(buf);
-
push_include(rubylib, filter);
-
p = s + 1;
- }
- else {
-
cygwin32_conv_to_posix_path(p, rubylib);
-
push_include(rubylib, filter);
-
break;
}
- rb_ary_concat(rb_load_path, ary);
- }
- else {
- rb_ary_push(rb_load_path, (*filter) (rubylib_mangled_path2(path)));
}
+#else
- push_include(path, filter);
+#endif
}
@@ -259,9 +241,5 @@ translate_char(char *p, int from, int to
if ((unsigned char)*p == from)
p = to;
-#ifdef CharNext / defined as CharNext[AW] on Windows. */
p = CharNext§;
-#else
-
p += mblen(p, RUBY_MBCHAR_MAXSIZE);
-#endif
}
}
@@ -301,6 +279,12 @@ ruby_init_loadpath(void)
libpath[sizeof(libpath) - 1] = ‘\0’;
-#if defined DOSISH || defined CYGWIN
+#if defined DOSISH
translate_char(libpath, ‘\’, ‘/’);
+#elif defined CYGWIN
-
{
-
char rubylib[FILENAME_MAX];
-
cygwin_conv_to_posix_path(libpath, rubylib);
-
strncpy(libpath, rubylib, sizeof(libpath));
-
}
#endif
p = strrchr(libpath, ‘/’);
@@ -323,4 +307,5 @@ ruby_init_loadpath(void)
#define RUBY_RELATIVE(path) (path)
#endif
+#define incpush(path) rb_ary_push(rb_load_path, rb_str_new2(path))
if (rb_safe_level() == 0) {
@@ -329,22 +314,31 @@ ruby_init_loadpath(void)
#ifdef RUBY_SEARCH_PATH
- ruby_incpush(RUBY_RELATIVE(RUBY_SEARCH_PATH));
- incpush(RUBY_RELATIVE(RUBY_SEARCH_PATH));
#endif
- ruby_incpush(RUBY_RELATIVE(RUBY_SITE_LIB2));
- incpush(RUBY_RELATIVE(RUBY_SITE_LIB2));
#ifdef RUBY_SITE_THIN_ARCHLIB
- ruby_incpush(RUBY_RELATIVE(RUBY_SITE_THIN_ARCHLIB));
- incpush(RUBY_RELATIVE(RUBY_SITE_THIN_ARCHLIB));
+#endif
- incpush(RUBY_RELATIVE(RUBY_SITE_ARCHLIB));
- incpush(RUBY_RELATIVE(RUBY_SITE_LIB));
-
+#ifdef RUBY_VENDOR_LIB
- incpush(RUBY_RELATIVE(RUBY_VENDOR_LIB2));
+#ifdef RUBY_VENDOR_THIN_ARCHLIB
- incpush(RUBY_RELATIVE(RUBY_VENDOR_THIN_ARCHLIB));
+#endif
- incpush(RUBY_RELATIVE(RUBY_VENDOR_ARCHLIB));
- incpush(RUBY_RELATIVE(RUBY_VENDOR_LIB));
#endif
-
ruby_incpush(RUBY_RELATIVE(RUBY_SITE_ARCHLIB));
-
ruby_incpush(RUBY_RELATIVE(RUBY_SITE_LIB));
-
ruby_incpush(RUBY_RELATIVE(RUBY_LIB));
- incpush(RUBY_RELATIVE(RUBY_LIB));
#ifdef RUBY_THIN_ARCHLIB
- ruby_incpush(RUBY_RELATIVE(RUBY_THIN_ARCHLIB));
- incpush(RUBY_RELATIVE(RUBY_THIN_ARCHLIB));
#endif
- ruby_incpush(RUBY_RELATIVE(RUBY_ARCHLIB));
- incpush(".");
}
}
Index: missing/strftime.c
===================================================================
— missing/strftime.c (revision 12804)
+++ missing/strftime.c (working copy)
@@ -446,5 +446,5 @@ strftime(char *s, size_t maxsize, const
tbuf[0] = ‘+’;
}
#endif /* MAILHEADER_EXT */
Index: ext/socket/getnameinfo.c
— ext/socket/getnameinfo.c (revision 12804)
+++ ext/socket/getnameinfo.c (working copy)
@@ -36,4 +36,5 @@
#include “ruby/config.h”
+#include <stdio.h>
#include <sys/types.h>
#ifndef _WIN32
@@ -52,7 +53,4 @@
#include <netdb.h>
#if defined(HAVE_RESOLV_H)
-#ifdef _SX
-#include <stdio.h>
-#endif
#include <resolv.h>
#endif
@@ -60,5 +58,4 @@
#ifdef _WIN32
#include <winsock2.h>
-#include <stdio.h>
#define snprintf _snprintf
#endif