From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5836 invoked from network); 28 Oct 1997 01:36:58 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 28 Oct 1997 01:36:58 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id UAA01651; Mon, 27 Oct 1997 20:28:19 -0500 (EST) Resent-Date: Mon, 27 Oct 1997 20:27:48 -0500 (EST) From: Deborah Ariel Pickett Message-Id: <199710280128.MAA26043@molly.cs.monash.edu.au> Subject: Re: showing 'talk' status in PROMPT To: luomat+zsh+users@luomat.peak.org (Timothy J Luoma) Date: Tue, 28 Oct 1997 12:28:13 +1100 (EST) Cc: zsh-users@math.gatech.edu In-Reply-To: <199710270443.XAA17820@luomat.peak.org> from "Timothy J Luoma" at Oct 26, 97 11:43:35 pm Reply-To: tlm@yoyo.cc.monash.edu.au X-TLM-Quote: It's a dinglehopper! X-Mailer: ELM [version 2.4 PL24 ME8b] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"8Z4ph.0.WO.J-JLq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1108 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > I am using this to let me know if I have turned off messages on my terminal: > mesg () { ... > } > Does anyone see any problems with this, or have a better way to do this? I do this by rather a different way. Every so often, I check the status of my TTY to see whether it has write access granted to others. I figure that I don't type 'mesg' very often, so checking every minute or so isn't much of a performance loss. I wanted to be able to just do something like 'mesg >/dev/null' to use the exit status of mesg to determing if messages are on or not without cluttering up my screen with "is n" or "is y". But the writers of mesg on Ultrix in all their wisdom, printed the message to stderr, and also used stderr as the tty to check. So it just couldn't work. I finally wrote a tiny perl script to do it: #!/usr/monash/bin/perl # Return y or n based on whether others can write to our tty. # usage: mesg-status $TTY if ((stat($ARGV[0]))[2] & 022) { print "y\n"; } else { print "n\n"; } so I just invoke this every now and again and insert it into my prompt in the usual ways. Granted, it isn't as efficient as the rewriting of the mesg function, but I suppose it makes up for that by always being correct, if, say, something else tries to change the status of my tty. -- Debbie Pickett http://www.cs.monash.edu.au/~debbiep/ tlm@yoyo.cc.monash.edu.au "Long and wide, eternity from side to side, lead me through the rapids, guide me to the shore. There's a place that's far beyond this time and space, when each of us comes face to face with something more." - _Siren Song_, Alan Parsons