From owner-freebsd-current Wed Oct 14 11:07:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA00109 for freebsd-current-outgoing; Wed, 14 Oct 1998 11:07:15 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from porkfriedrice.ny.genx.net (porkfriedrice.ny.genx.net [206.64.4.30]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA00102 for ; Wed, 14 Oct 1998 11:07:13 -0700 (PDT) (envelope-from bright@hotjobs.com) Received: from localhost (bright@localhost) by porkfriedrice.ny.genx.net (8.9.1/8.9.1) with ESMTP id OAA03664; Wed, 14 Oct 1998 14:07:36 -0400 (EDT) (envelope-from bright@hotjobs.com) X-Authentication-Warning: porkfriedrice.ny.genx.net: bright owned process doing -bs Date: Wed, 14 Oct 1998 14:07:35 -0400 (EDT) From: Alfred Perlstein X-Sender: bright@porkfriedrice.ny.genx.net To: Darren Whittaker cc: Mike Smith , freebsd-current@FreeBSD.ORG, john.young@openmarket.com Subject: Re: problem in 3.0 In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG urm, first of all, on my box, setting buf[0] = '\0' worked fine for me, second why aren't you using dup2() to get proper semantics on stderr so that it goes to the same place as stdin? hint: #include ... #ifdef CGI_DEBUG dup2(STDOUT_FILENO, STDERR_FILENO); #endif /* CGI_DEBUG */ ... Alfred Perlstein - Programmer, HotJobs Inc. - www.hotjobs.com -- There are operating systems, and then there's FreeBSD. -- http://www.freebsd.org/ 3.0-current On Wed, 14 Oct 1998, Darren Whittaker wrote: > The code appeared to work until I set buf[0] = '\0'; at the start of the > loop, then only one message was displayed. Since err displays to std error > and I have to run this program from a browers I did not see any error > messages. > > -Darren > > ------------------ > Darren Whittaker > Senior Software Engineer > Small Enterprise Group > Open Market, Inc. > > On Wed, 14 Oct 1998, Mike Smith wrote: > > > > The fact of the matter is that date only returned output once, why did it > > > not return output 10 times? > > > > No idea. I can't make it fail in that fashion here, on a range of > > -current systems from mid-September through yesterday's snapshot. > > > > Does the following: > > > > #include > > #include > > > > void main(void) > > { > > int i, j; > > char buf[256]; > > FILE *p; > > > > for (i = 0; i < 100; i++) { > > if ((p = popen("/bin/date", "r")) == NULL) > > err(1, "popen"); > > fgets(buf, sizeof(buf) - 1, p); > > printf(buf); > > if ((pclose(p)) == -1) > > err(1, "pclose"); > > } > > } > > > > do the "right" or the "wrong" thing? > > > > > -Darren > > > > -- > > \\ Sometimes you're ahead, \\ Mike Smith > > \\ sometimes you're behind. \\ mike@smith.net.au > > \\ The race is long, and in the \\ msmith@freebsd.org > > \\ end it's only with yourself. \\ msmith@cdrom.com > > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message