all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Cc: emacs-devel@gnu.org
Subject: Re: Issues with Windows gcc -mno-cygwin (Mingw)
Date: 20 Mar 2003 17:21:57 +0100	[thread overview]
Message-ID: <m3adfqdn4q.fsf@cicero.benny.turtle-trading.net> (raw)
In-Reply-To: <m2adfq8mpw.fsf@nyaumo.jasonr.f2s.com>

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

Hi Jason, Eli,


Jason Rumney <jasonr@gnu.org> writes:
> Is it reasonable for the runtime to change _fmode between _start()
> and main()?  I think it probably is,

The _start() routine only gets into it, because the Makefile specifies
an explicit entry point in the call to the linker.  So _start() is a
modification of the runtime, and Mingw can't garantee anything about
code like that.

> so unless we really need _fmode to be set between _start() and
> main() we should move the assignment to main().

Yes, that seems to work, see attached patch. 


> Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de> writes:
> > Emacs doesn't use O_BINARY directly to load files.

"Eli Zaretskii" <eliz@elta.co.il> writes:
> Oh yes, it does--at least in the DOS_NT versions.  Grep the C
> sources for _BINARY, and you will see it yourself.

I have.  Emacs does use O_BINARY in some, but not in all places.
Especially Finsert_file_content() doesn't use it in calling
emacs_open() and emacs_open() doesn't add O_BINARY either when it
calls the runtime open().

> So the only issue with binary I/O I'm aware of is with standard
> input and output handles.  That's why the code in emacs.c does what
> it does.

Stdin and stdout are not an issue for NT Emacs.  The C runtime is not
used by the relevant code there, instead the OS API is used directly.
The text/binary distinction is not relevant anymore at that level.


so long, benny


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fmode.diff --]
[-- Type: text/x-patch, Size: 2184 bytes --]

Index: emacs.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/emacs.c,v
retrieving revision 1.325
diff -c -p -r1.325 emacs.c
*** emacs.c	18 Dec 2002 06:16:28 -0000	1.325
--- emacs.c	20 Mar 2003 16:17:36 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 40,45 ****
--- 40,49 ----
  #include <sys/ioctl.h>
  #endif
  
+ #ifdef WINDOWSNT
+ #include <fcntl.h>
+ #endif
+ 
  #include "lisp.h"
  #include "commands.h"
  #include "intervals.h"
*************** main (argc, argv
*** 954,964 ****
    uninterrupt_malloc ();
  #endif	/* not SYSTEM_MALLOC */
  
! #ifdef MSDOS
    /* We do all file input/output as binary files.  When we need to translate
       newlines, we do that manually.  */
    _fmode = O_BINARY;
  
  #if __DJGPP__ >= 2
    if (!isatty (fileno (stdin)))
      setmode (fileno (stdin), O_BINARY);
--- 958,970 ----
    uninterrupt_malloc ();
  #endif	/* not SYSTEM_MALLOC */
  
! #if defined (MSDOS) || defined (WINDOWSNT)
    /* We do all file input/output as binary files.  When we need to translate
       newlines, we do that manually.  */
    _fmode = O_BINARY;
+ #endif /* MSDOS || WINDOWSNT */
  
+ #ifdef MSDOS
  #if __DJGPP__ >= 2
    if (!isatty (fileno (stdin)))
      setmode (fileno (stdin), O_BINARY);
Index: unexw32.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/unexw32.c,v
retrieving revision 1.22
diff -c -p -r1.22 unexw32.c
*** unexw32.c	4 Feb 2003 14:03:13 -0000	1.22
--- unexw32.c	20 Mar 2003 16:17:50 -0000
*************** Boston, MA 02111-1307, USA.
*** 23,29 ****
  
  #include <config.h>
  
- #include <stdlib.h> 	/* _fmode */
  #include <stdio.h>
  #include <fcntl.h>
  #include <time.h>
--- 23,28 ----
*************** _start (void)
*** 111,120 ****
  
    /* Grab our malloc arena space now, before CRT starts up. */
    init_heap ();
- 
-   /* The default behavior is to treat files as binary and patch up
-      text files appropriately, in accordance with the MSDOS code.  */
-   _fmode = O_BINARY;
  
    /* This prevents ctrl-c's in shells running while we're suspended from
       having us exit.  */
--- 110,115 ----

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2003-03-20 16:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-18 17:14 Issues with Windows gcc -mno-cygwin (Mingw) Benjamin Riefenstahl
2003-03-18 17:54 ` Eli Zaretskii
2003-03-19 23:31   ` Benjamin Riefenstahl
2003-03-20  4:30     ` Eli Zaretskii
2003-03-20  8:29     ` Jason Rumney
2003-03-20 16:21       ` Benjamin Riefenstahl [this message]
2003-03-18 18:26 ` Jason Rumney
2003-03-19 23:36   ` Benjamin Riefenstahl
  -- strict thread matches above, loose matches on Subject: below --
2003-03-19  7:39 David PONCE
2003-03-19  8:41 ` Jason Rumney
2003-03-19 23:44   ` Benjamin Riefenstahl
2003-03-19 23:40 ` Benjamin Riefenstahl
2003-03-19  9:29 David PONCE
2003-05-14  7:27 David PONCE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3adfqdn4q.fsf@cicero.benny.turtle-trading.net \
    --to=benjamin.riefenstahl@epost.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.