rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: arnold@cc.gatech.edu (Arnold Robbins)
To: rc@archone.tamu.edu
Subject: signal blocking?
Date: Tue, 7 Apr 1992 16:18:00 -0500	[thread overview]
Message-ID: <9204072118.AA00942@terminus.cc.gatech.edu> (raw)

Is there an easy way to block a signal inside a signal handler?  I'm using
MGR from BellCore (fast!), and I've been trying to set up a signal handler
for SIGWINCH so that the rows and columns in stty get reset whenever I resize
a window.  However, when you do an stty of the rows and columns, MGR
kindly sends you another SIGWINCH too!  So I need to temporarily block
SIGWINCH (ignore it basically) inside my SIGWINCH handler.

Here's what I ended up doing.  Simple, but not terribly elegant.  Note
that the trailing sleep is needed or else the SIGWINCH comes in before
we're ready.

fn handle_winch {
size=() {
	fn sigwinch 	# temporary
	stty -echo
	echo '^[4I'
	size=(`{gawk '{ printf "%d %d\n", $3/12, $4/20 ; exit }'})
	stty echo
	stty columns $size(1) rows $size(2)
	sleep 1
	fn sigwinch { handle_winch }
} }

fn sigwinch { handle_winch }
--
Arnold Robbins --- College of Computing			| Laundry increases
Georgia Tech, Atlanta, GA 30332-0280			| exponentially in the
Domain: arnold@cc.gatech.edu	 Phone: +1 404 894 9214 | number of children.
UUCP: uunet!cc.gatech.edu!arnold FAX:   +1 404 853 9378 |  -- Miriam Robbins


             reply	other threads:[~1992-04-07 21:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <91Dec18.230318cst.18887@archone.tamu.edu>
     [not found] ` <199201222335.28010.rc.badaj@vetsci.su.oz.au>
     [not found]   ` <92Jan28.114835cst.18891@archone.tamu.edu>
1992-04-07 21:18     ` Arnold Robbins [this message]
1992-04-07 22:12       ` schwartz
1992-04-08  1:37       ` John Mackin
1992-04-07 22:22 Arnold Robbins
1992-04-07 22:25 Arnold Robbins
1992-04-07 23:24 ` schwartz
1992-04-08 13:18 Chet Ramey
1992-04-08 18:33 ` schwartz
1992-04-08 15:49 Byron Rakitzis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9204072118.AA00942@terminus.cc.gatech.edu \
    --to=arnold@cc.gatech.edu \
    --cc=rc@archone.tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).