From owner-freebsd-questions Mon Mar 4 23:51:55 2002 Delivered-To: freebsd-questions@freebsd.org Received: from post-11.mail.nl.demon.net (post-11.mail.nl.demon.net [194.159.73.21]) by hub.freebsd.org (Postfix) with ESMTP id 1722C37B417 for ; Mon, 4 Mar 2002 23:51:48 -0800 (PST) Received: from [212.238.194.207] (helo=mailhost.raggedclown.net) by post-11.mail.nl.demon.net with esmtp (Exim 3.33 #1) id 16i9je-0006lx-00 for questions@FreeBSD.org; Tue, 05 Mar 2002 07:51:46 +0000 Received: from angel.raggedclown.net (angel.raggedclown.intra [192.168.1.7]) by mailhost.raggedclown.net (Ragged Clown Mail Gateway [buffy]) with ESMTP id 992D013040 for ; Tue, 5 Mar 2002 08:51:45 +0100 (CET) Received: by angel.raggedclown.net (Ragged Clown Host [angel], from userid 1005) id A5E8F22595; Tue, 5 Mar 2002 08:51:41 +0100 (CET) Date: Tue, 5 Mar 2002 08:51:41 +0100 From: Cliff Sarginson To: FreeBSD Questions Subject: Re: Cannot change X screen resolution Message-ID: <20020305075141.GA10395@raggedclown.net> References: <20020305120749.B64582@wantadilla.lemis.com> <20020304222820.N96680-100000@earl-grey.cloud9.net> <20020305141610.E64582@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Mar 04, 2002 at 11:10:18PM -0600, Bob Giesen wrote: > > > Question, how *DO* you capture the output of the X startup? > > > > $ startx 2>&1 > /var/tmp/startuplog > > In redirection, order is important. The above command will send > stderr output (file descriptor "2") to the console (not to the > logfile), which is where stdout (file descriptor "1") is going at the > time the stderr redirection is evaluated. > If you want errors logged and want to use the stdout-address > shorthand ("2>&1," rather than typing out a logfile pathname twice), > you must redirect stderr after redirecting stdout: > > $ startx >/var/tmp/startuplog 2>&1 > > Bob > > P.S. If you're curious about what the programmers deemed standard > output verus error-class messages (which is sometimes subjective), > you could, of course, use separate filenames for error messages and > standard output, e.g.: > > $ startx 2>/var/tmp/startuperrorlog >/var/tmp/startuplog > OT but... If you are a new "C" programmer you might also be moderately curious to run the following two short programs, guessing first what you expect to happen, and then seeing what does happen. #include main() { int i = 100; while(i--) { fprintf(stderr,"a"); /* write to stderr */ printf("b"); /* write to stdout without a newline */ } } #include main() { int i = 100; while(i--) { fprintf(stderr,"a"); /* write to stderr */ printf("b\n"); /* write to stdout with a newline */ } } It's left as an exercise for the reader to work out what is happening, and how to "cure" it, and maybe explain a good reason for it (there is one) :) -- Regards Cliff Sarginson -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message