delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/01/14/02:30:18

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <do_not_have AT notreplytome DOT cmm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Ruby 1.8.7pl330 + DJGPP (was Re: GCC-4.5.2)
Date: Fri, 14 Jan 2011 02:13:31 -0500
Organization: Aioe.org NNTP Server
Lines: 94
Message-ID: <igost9$5av$1@speranza.aioe.org>
References: <4D24895D DOT 5010701 AT iki DOT fi> <4D2BF57A DOT 8080206 AT iki DOT fi> <1fe05fe1-8da1-4680-98d9-0394c965dc0c AT d8g2000yqf DOT googlegroups DOT com>
NNTP-Posting-Host: sg0uvLzlDfZOqmCSVnJXCA.user.speranza.aioe.org
X-Complaints-To: abuse AT aioe DOT org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.2001
X-Notice: Filtered by postfilter v. 0.8.2
X-Newsreader: Microsoft Outlook Express 6.00.2800.2001
X-Priority: 3
X-MSMail-Priority: Normal
Bytes: 3500
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019