Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!ncar!husc6!mailrus!cornell!blandy From: blandy@marduk.cs.cornell.edu (Jim Blandy) Newsgroups: comp.sys.amiga Subject: Re: Recognizing the break character? Message-ID: <19460@cornell.UUCP> Date: 21 Jul 88 15:44:31 GMT References: <7200049@m.cs.uiuc.edu> Sender: nobody@cornell.UUCP Reply-To: blandy@cs.cornell.edu (Jim Blandy) Organization: Cornell Univ. CS Dept, Ithaca NY Lines: 33 Let's see - I'm curious about this question too, so I'll post my theories in hopes of a correction... If you're running a program in a CLI, pressing ^C in the CLI window sends a signal to the foreground process that CLI is running. You can use the BREAK command to send signals to programs running under other CLIs (i.e. background CLIs that don't have their own window). The signal number that ^C uses is #defined in as SIGBREAKB_CTRL_C. (For ONCE, I've got my manual nearby while I'm reading news! HAH! Hmm. "Copyright 1985... rev 2" Yuck.) Note that ^D, ^E, and ^F also send their own signals. Okay - how to recognize the signals once you've set them: you can poll the signals directly (using the SetSignal() routine from the Exec library), which tells you the current state of the signals. But you want something asynchronous, I think. You can ask the system to cause an exception on receipt of a signal - this means that you set tc_ExceptCode (in your task structure) to point to a routine to call in the event of the signal, and then call the SetExcept() routine (also in Exec) to indicate that certain signals should cause exceptions. Exec saves your processor state on the stack and all that neat stuff, and passes you some information in D0 and A0 - exception handlers probably want to be in assembly language. This is where I get lost. What am I allowed to do in this exception? Can I call exit()? I suppose one should restore the original contents of the tc_ExceptCode field for the CLI, since we're sharing a process, right? I've tried some variation on this before, and it's always crashed. ...helphelpplehpleh... -- Jim Blandy - blandy@crnlcs.bitnet "insects were insects when man was just a burbling whatisit." - archy