From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25692 invoked by alias); 23 Sep 2004 08:02:32 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25684 invoked from network); 23 Sep 2004 08:02:31 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 23 Sep 2004 08:02:31 -0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx1.redhat.com (8.12.11/8.12.10) with ESMTP id i8N82QOt011034 for ; Thu, 23 Sep 2004 04:02:31 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i8N82P721998 for ; Thu, 23 Sep 2004 04:02:25 -0400 Received: from cygbert.vinschen.de (vpn50-35.rdu.redhat.com [172.16.50.35]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i8N82OV11541 for ; Thu, 23 Sep 2004 01:02:24 -0700 Received: by cygbert.vinschen.de (Postfix, from userid 500) id C101058090; Thu, 23 Sep 2004 10:03:12 +0200 (CEST) Date: Thu, 23 Sep 2004 08:02:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: Re: [RFC] Suggested ways to remove the need for xm-go32.h Message-ID: <20040923080312.GA12351@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <01c49d82$Blat.v2.2.2$23875ec0@zahav.net.il> <20040923050534.GA11936@trixie.casa.cgf.cx> <41526D73.nailWK21NVX4@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41526D73.nailWK21NVX4@mindspring.com> User-Agent: Mutt/1.4.2i X-SW-Source: 2004-09/txt/msg00366.txt.bz2 On Sep 23 02:30, Michael Chastain wrote: > To avoid the wrapper function, perhaps probe for the modes at > run time: > > static const char * read_mode = NULL; > > void set_read_mode () > { > FILE * fp = NULL; > > if (read_mode == NULL) > { > if ((fp = fopen ("/dev/null", "rb")) != NULL) > read_mode = "rb"; > else if ((fp = fopen ("/dev/null", "r")) != NULL) > read_mode = "r"; > else > some sort of error; > } > > if (fp != NULL) > { > if (fclose(fp) != 0 ) > error; > } > } First I thought that's a good idea, but then again, it requires every system to support /dev/null. I'm not sure you'd find a filename which all systems can agree to. I guess a wrapper function would be the way to go here. Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat, Inc.