www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/21/17:02:20

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: Re: MORE on O_TEXT/O_BINARY
To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp)
Date: Tue, 21 Jun 94 13:41:26 PDT
Mailer: Elm [revision: 70.85]

marty (leisner AT sdsp DOT mc DOT xerox DOT com) wrote:
> Recompiling the gnu fileutils, I needed to stick this
> in the fileutils lib (or else have to change every open call
> everywhere or change __fmode in each main...):
> 
> 	.data
> 	.globl	__fmode
> __fmode:
> ->	.long	0x000   	; changes from O_TEXTMODE
> 
> 	.text
> 	.globl _open
> _open:
> 	testl	$0xc000,8(%esp)
> 	jnz	L0
> 	andl	$0xc000,__fmode
> 	movl	__fmode,%eax
> 	orl	%eax,8(%esp)
> L0:
> 	movb	$2,%al
> 	jmp	turbo_assist
> 
> I really think the default mode should be binary "unless you need to
> do something special".   

But that was the reasoning behind making text mode the default.  And
whether you like it or not, text mode is the de facto standard for all
DOS compilers, not just djgpp.  And text mode is the standard for
fopen(); you have to explicitly ask for binary mode.
--
				Eric Backus
				ericb AT lsid DOT hp DOT com
				(206) 335-2495

- Raw text -


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