From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26845 invoked from network); 2 Apr 2004 10:18:09 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 2 Apr 2004 10:18:09 -0000 Received: (qmail 3283 invoked by alias); 2 Apr 2004 10:18:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19722 Received: (qmail 10452 invoked from network); 2 Apr 2004 09:51:20 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 2 Apr 2004 09:51:20 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 2 Apr 2004 9:51:20 -0000 Received: (qmail 8945 invoked from network); 2 Apr 2004 09:51:20 -0000 Received: from host217-40-111-177.in-addr.btopenworld.com (HELO NUTMEG.CAM.ARTIMI.COM) (217.40.111.177) by a.mx.sunsite.dk with SMTP; 2 Apr 2004 09:51:17 -0000 Received: from mace ([192.168.1.25]) by NUTMEG.CAM.ARTIMI.COM with Microsoft SMTPSVC(6.0.3790.0); Fri, 2 Apr 2004 10:49:47 +0100 From: "Dave Korn" To: , Subject: RE: zsh and line breaks Date: Fri, 2 Apr 2004 10:49:47 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Thread-Index: AcQYL0j4NlRjXJh7Q/GpEE3Z0SYsagAZFKGw Message-ID: X-OriginalArrivalTime: 02 Apr 2004 09:49:47.0968 (UTC) FILETIME=[D5D26400:01C41897] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 > -----Original Message----- > From: cygwin-owner On Behalf Of Peter A. Castro > Sent: 01 April 2004 22:21 > In system.h I've added a #define in the #ifdef > __CYGWIN__ section of: > #define ORO_TEXT | O_TEXT > And for the #else case: > #define ORO_TEXT > > Then in code which needs it I have modified it to look like this: > > if ((fd = open(name, O_RDONLY ORO_TEXT)) < 0) { > > It's really just utilizing the macro ability of the compiler, > and it's a > style judgement call. I don't have a problem with it, obviously, but > others might look at it and wonder how it could possible > compile if they > didn't look in system.h first. If you think that might present > confusion, then I'll change it to be explicitly "| OR_TEXT" and have > #define O_TEXT to be 0 if not defined at all. > > Any thoughts on this? It's pretty reasonable but as you say could be confusing. Here's another approach that might seem nicer because it's kind of function-like: #ifdef __CYGWIN__ #define MAYBE_ADD_O_TEXT_FLAG(x) (O_TEXT | (x)) #else #define MAYBE_ADD_O_TEXT_FLAG(x) (x) #endif Then say if ((fd = open(name, MAYBE_ADD_O_TEXT_FLAG(O_RDONLY))) < 0) { You might well want to choose a better name for the function-like macro than that, but I think the pattern is slightly clearer. > The primary problem is with running scripts with CR/LFs. > That gets fixed > with adding O_TEXT everywhere. A secondary problem is with redirected > input and/or output which is processed by the shell. > > I've been reviewing this problem and I think maybe I've been > attacking it > incorrectly. I had though that adding O_TEXT everywhere > would solve this > problem. However, the environment is complicating things :) > > Here's the deal: > So where the file located in the filesystem > determines > the default handling of translation when opened as a text file. > This is for normal unix style coding of opens without any O_TEXT or > O_BINARY cruft. > > Now, adding an explicit O_TEXT or O_BINARY forces one mode or > the other, > ignoring the filesystem mount attributes. The problem is, I > don't want > to force the mode, > > Thanks for listening. Any suggestions are welcome. Doesn't the POSIX standard specify something about shells should open stdin, stdout and stderr in textmode? IOW, aren't you obliged to force the mode? cheers, DaveK -- Can't think of a witty .sigline today....