Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rochester!rutgers!lll-lcc!lll-tis!ptsfa!hoptoad!academ!uhnix1!sugar!peter From: peter@sugar.UUCP (Peter da Silva) Newsgroups: comp.sys.amiga Subject: Signals... a great tool (Re: What is clist.library?) Message-ID: <455@sugar.UUCP> Date: Sun, 2-Aug-87 19:36:39 EDT Article-I.D.: sugar.455 Posted: Sun Aug 2 19:36:39 1987 Date-Received: Fri, 7-Aug-87 04:26:25 EDT References: <18102@cca.CCA.COM> Sender: news@sugar.UUCP Organization: Sugar Land UNIX - Houston, TX Lines: 27 Keywords: SIGBREAKB_CTRL_C through _CTRL_F Summary: An answer AND a warning. (important). I think having four seperate break levels is a little redundent... does anyone actually use them? But here's what you should do. flags = Wait(whatever_other_signals | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F); if(flags & SIGBREAKF_CTRL_C) { printf("^C\n"); close files in an orderly fashion. exit(RETURN_ERROR); } if(flags & (SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F) ) { do absolute minimal cleanup exit(RETURN_FAIL); } process other signals and messages. Speaking of signals... BEWARE! Just because Wait() says a message has come, don't assume it's actually come. Wait sometimes returns a signal bit set even with no message available on the port... particularly if you've just opened a device. Moral: always check the return from GetMsg(). -- -- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter (I said, NO PHOTOS!)