From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Benjamin Riefenstahl Newsgroups: gmane.emacs.devel Subject: Re: Issues with Windows gcc -mno-cygwin (Mingw) Date: 20 Mar 2003 17:21:57 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <2561-Tue18Mar2003195457+0200-eliz@elta.co.il> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1048177957 9181 80.91.224.249 (20 Mar 2003 16:32:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 20 Mar 2003 16:32:37 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Mar 20 17:32:35 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18w2x8-0002I8-00 for ; Thu, 20 Mar 2003 17:31:38 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18w2yS-0005Ph-00 for ; Thu, 20 Mar 2003 17:33:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18w2wK-0000o8-01 for emacs-devel@quimby.gnus.org; Thu, 20 Mar 2003 11:30:48 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18w2q3-00077I-00 for emacs-devel@gnu.org; Thu, 20 Mar 2003 11:24:19 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18w2pF-0006u2-00 for emacs-devel@gnu.org; Thu, 20 Mar 2003 11:23:30 -0500 Original-Received: from [193.28.100.184] (helo=mail.epost.de) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18w2nl-0006Rk-00; Thu, 20 Mar 2003 11:21:57 -0500 Original-Received: from cicero.benny.turtle-trading.net.epost.de (193.99.153.6) by mail.epost.de (6.7.015) id 3E5ED89400206C1C; Thu, 20 Mar 2003 17:21:55 +0100 Original-To: Jason Rumney In-Reply-To: Original-Lines: 43 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-cc: andrewi@gnu.org Original-cc: Eli Zaretskii X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12490 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12490 --=-=-= Hi Jason, Eli, Jason Rumney 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 writes: > > Emacs doesn't use O_BINARY directly to load files. "Eli Zaretskii" 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=fmode.diff 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 #endif + #ifdef WINDOWSNT + #include + #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 - #include /* _fmode */ #include #include #include --- 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 ---- --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel --=-=-=--