Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site amiga.amiga.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!pyramid!amiga!bruceb From: bruceb@amiga.UUCP (Bruce Barrett) Newsgroups: net.micro.amiga Subject: Break detection (^C) On the Amiga. Message-ID: <776@amiga.amiga.UUCP> Date: Fri, 28-Feb-86 20:37:17 EST Article-I.D.: amiga.776 Posted: Fri Feb 28 20:37:17 1986 Date-Received: Sat, 1-Mar-86 23:58:09 EST Reply-To: bruceb@amiga.UUCP (Bruce Barrett) Organization: Commodore-Amiga Inc., 983 University Ave #D, Los Gatos CA 95030 Lines: 46 Hi friends, it's me (BruceB) again with a brief lesson on break detection on the Amiga. I think someone actually requested this information, but we're busy guys (and gals) around here and don't always keep track. Anyway, I needed this for my current application so thought I'd share it. If you don't have or don't want to use Lattice's routines for ^C detection you can do the following instead (see program). [BTW Lattice has to be doing something real similar.] Also please note that if your program does a Wait() anyway you can include the ^C (^D, ^E, or ^F) flags as well. Please be warned that SetSignal() will clear the bit you are checking so you should look at oldsigs rather than calling SetSignal() again. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* mybreak.c - look for break (^C) */ /* Note: This does NOT require any of the Lattice libraries or */ /* run time routines. */ /* Public domain, ,and you're welcome to it! */ #include "libraries/dos.h" /* Needed for the control-C */ /* bit number */ main() { int loop; LONG newsigs; LONG oldsigs; loop = TRUE; newsigs = 0; while (loop) { Delay(15); /* Keep it slow */ printf("*"); oldsigs = SetSignal(newsigs, 1 << SIGBREAKB_CTRL_C); if (oldsigs & (1 << SIGBREAKB_CTRL_C) ) { printf ("\nControl-C detected.\nDone.\n"); loop = FALSE; } /* end if if */ } /* end of while */ } /* end of main */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Enjoy! Bruce Barrett