Path: utzoo!attcan!utgpu!watmath!att!ucbvax!decwrl!granite!basalt!pjs From: pjs@basalt.dec.com (Philip Schneider) Newsgroups: comp.windows.x Subject: Re: getting CONTROL C to interrupt X application Message-ID: <525@granite.dec.com> Date: 24 Aug 89 17:36:00 GMT References: <8908231747.AA20273@ATHENA.MIT.EDU> Sender: news@granite.dec.com Reply-To: pjs@basalt.DEC.COM (Philip Schneider) Organization: DEC Advanced Technology Development, Palo Alto, CA Lines: 34 In article <8908231747.AA20273@ATHENA.MIT.EDU> Francois.Bitz@SAM.CS.CMU.EDU writes: >I am trying to find a way to be able to 'stop' an X program >by typing CONTROL C such as can be done with any other >'C' program. Actually I want to use the SIGINT that is generated >by such an action to 'jump' somewhere in my program. This is >sometimes necessary when displaying (or computing) lots of stuff that >might takea long time and the user wants to stop (abort) it . > I'm not sure if this is what you wanted, but how about : if (XPending(dpy)) { XNextEvent(dpy, &event); if (event.type == KeyPress) { XLookupString(&event, &keyPressed, 1, NULL, NULL); if (keyPressed == '^C') { exit(0); } } I guess that instead of calling "exit(0)", what you would want here is the call to whatever routine you execute before you die. Hope this helps. - Philip Schneider Philip J. Schneider | pjs@decwrl.dec.com DEC Advanced Technology Development | decwrl!pjs 100 Hamilton Avenue | (415)853-6538 Palo Alto, CA 94301 | (415)386-8232