From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47651 invoked by alias); 18 Jul 2017 19:21:44 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 47627 invoked by uid 89); 18 Jul 2017 19:21:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,SPF_PASS autolearn=ham version=3.3.2 spammy=Singles, singles, Sound, Hx-spam-relays-external:ESMTPA X-HELO: mx009.vodafonemail.xion.oxcs.net Received: from mx009.vodafonemail.xion.oxcs.net (HELO mx009.vodafonemail.xion.oxcs.net) (153.92.174.39) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Jul 2017 19:21:42 +0000 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id 094BDD9B3F2 for ; Tue, 18 Jul 2017 19:21:40 +0000 (UTC) Received: from Gertrud (p57b9d360.dip0.t-ipconnect.de [87.185.211.96]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id CDFDF199C50 for ; Tue, 18 Jul 2017 19:21:37 +0000 (UTC) From: Achim Gratz To: cygwin-apps@cygwin.com Subject: Re: fflush(NULL) clobbers input streams References: <87k2376jck.fsf@Rainer.invalid> <20170718095456.GC26902@calimero.vinschen.de> <20170718105109.GD26902@calimero.vinschen.de> Date: Tue, 18 Jul 2017 19:21:00 -0000 In-Reply-To: <20170718105109.GD26902@calimero.vinschen.de> (Corinna Vinschen's message of "Tue, 18 Jul 2017 12:51:09 +0200") Message-ID: <87fudtlfen.fsf@Rainer.invalid> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-VADE-STATUS: LEGIT X-SW-Source: 2017-07/txt/msg00045.txt.bz2 Corinna Vinschen writes: > Oh, and a plain C testcase, of course... Call that fflush.c: --8<---------------cut here---------------start------------->8--- #include int main(int argc, char **argv) { char buf[1024]; int i; char *bp = buf; while (1) { while ((i = getc(stdin)) != -1 && (*bp++ = i) != '\n' && bp < &buf[1024]) /* DO NOTHING */ ; *bp = '\0'; fprintf(stdout, "%s", buf); fflush(NULL); if (i == -1) return 0; bp = buf; } } --8<---------------cut here---------------end--------------->8--- Then run: gcc fflush.c -o fflush cat fflush.c | ./fflush 2>/dev/null > fflush.out diff fflush.c fflush.out If things are working, fflush.c and fflush.out should be identical. Currently only the first line makes it into fflush.out on Cygwin. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds