Mail Archives: djgpp/2011/01/14/02:30:18
"Rugxulo" <rugxulo AT gmail DOT com> wrote in message
news:1fe05fe1-8da1-4680-98d9-0394c965dc0c AT d8g2000yqf DOT googlegroups DOT com...
>
> [ruby 1.8.7 for DJGPP]
>
I dropped comp.lang.ruby for now. I hope you're checking c.o.m.d.
> --- util.c 2010-11-22 07:21:34 +0000
> +++ ../ruby-1.8.7-p330/util.c 2011-01-13 12:28:14 +0000
> @@ -234,7 +234,7 @@
> memcpy(RSTRING_PTR(str), buf, RSTRING_LEN(str));
> }
>
> -#if defined(__CYGWIN32__) || defined(_WIN32)
> +//#if defined(__CYGWIN32__) || defined(_WIN32)
> #if defined __CYGWIN32__ || defined __MINGW32__
> extern int _open(const char *, int, ...);
> extern int _close(int);
> @@ -250,9 +250,9 @@
> // It doesn't exist, so see if we can open it.
> */
>
> - if ((fd = _open(s, O_CREAT|O_EXCL, 0666)) >= 0) {
> - _close(fd);
> - _unlink(s); /* don't leave it laying around */
> + if ((fd = open(s, O_CREAT|O_EXCL, 0666)) >= 0) {
> + close(fd);
> + unlink(s); /* don't leave it laying around */
> return 1;
> }
> else if (errno == EEXIST) {
> @@ -262,7 +262,7 @@
> return 0;
> }
> #endif
> -#endif
> +//#endif
>
> #if defined __DJGPP__
>
I'm not sure how you got it to build w/204. All I got was errors. Anyway,
starting with a clean util.c, at these lines (which you said are lines 237
and 238):
#if defined(__CYGWIN32__) || defined(_WIN32)
#if defined __CYGWIN32__ || defined __MINGW32__
Try adding "|| defined (__DJGPP__)" to the end of first line:
#if defined(__CYGWIN32__) || defined(_WIN32) || defined (__DJGPP__)
#if defined __CYGWIN32__ || defined __MINGW32__
At the top of the file, you'll probably also want to add "|| defined
(__DJGPP__)" to the end of the line which is used to include <io.h>:
#if defined(__CYGWIN32__) || defined(_WIN32) || defined (__DJGPP__)
#include <io.h>
#endif
Immediately after lines 237/238 are these lines:
extern int _open(const char *, int, ...);
extern int _close(int);
extern int _unlink(const char *);
#endif
Try adding this section after that #endif:
#if defined __DJGPP__
#define _unlink unlink
#endif
unlink() is only available with 204. So, it's possible _unlink may may need
to be rmdir() or remove(), e.g., for 203. That section assumes _open and
_close in <io.h> are correct equivalents. If not, they'll need to be
defined to standard functions:
#if defined __DJGPP__
#define _open open
#define _close close
#define _unlink unlink
#endif
HAVE_UNISTD_H and HAVE_FCNTL_H should be defined in config.h so util.c
includes them.
HTH. I suspect that that is close... Good luck.
Rod Pemberton
- Raw text -