From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26035 invoked from network); 21 Jul 2004 06:26:28 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Jul 2004 06:26:28 -0000 Received: (qmail 61461 invoked from network); 21 Jul 2004 06:26:21 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Jul 2004 06:26:21 -0000 Received: (qmail 21230 invoked by alias); 21 Jul 2004 06:25:40 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7722 Received: (qmail 21219 invoked from network); 21 Jul 2004 06:25:40 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 21 Jul 2004 06:25:40 -0000 Received: (qmail 60182 invoked from network); 21 Jul 2004 06:24:01 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO binome.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 21 Jul 2004 06:23:59 -0000 Received: by binome.blorf.net (Postfix, from userid 1000) id 2E113197; Tue, 20 Jul 2004 23:23:57 -0700 (PDT) Date: Tue, 20 Jul 2004 23:23:56 -0700 From: Wayne Davison To: zsh-users@sunsite.dk Subject: Re: coloring STDERR to terminal Message-ID: <20040721062356.GA6709@blorf.net> References: <20040701181459.GF2033@ay.vinc17.org> <20040702124259.GS2033@ay.vinc17.org> <20040720045514.V326@willy_wonka> <20040720151617.N326@willy_wonka> <20040720233037.GI28269@blorf.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6+20040523i 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 On Tue, Jul 20, 2004 at 08:15:26PM -0700, Bart Schaefer wrote: > you can't invoke it blindly/automatically on every spawned command, > because it will play havoc with any text editor or other fullscreen > UI. This works the other way around -- you invoke a shell inside it and it colors all the stderr I/O of everything the shell runs. I ran an editor just fine (vim) from a zsh running under it without any havoc. > E.g. your sample program always writes stdout first and then stderr, > even when both are found to be available by the same call to select(). Yeah, I thought of that too while I was eating. I have them reversed in the latest code on my website. I also enhanced the code to forward the SIGWINCH signal (so that the shell resizes properly) and I moved some of the code into functions (to make it easier to read). It seems to work adequately in my limited testing, but it's probably not super portable. Compiling note -- under Linux you need to specify -lutil, like this: gcc -o color-my-world color-my-world.c -lutil ..wayne..