*BSD News Article 3925


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!network.ucsd.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!newsserver.pixel.kodak.com!laidbak!tellab5!vpnet!serveme!tallboy!news
From: dj@ctron.com (DJ Delorie)
Newsgroups: comp.unix.bsd
Subject: Polling for ctrl-C
Message-ID: <9208181316.AA23698@athena.ctron>
Date: 18 Aug 92 13:16:10 GMT
Sender: news@tallboy.chi.il.us
Lines: 10

>But the fact is I do not need asynchronous interrupts: for various
>reasons, the program I'm porting cannot be interrupted at any time, so
>the signal handler just sets a global flag, and the main program
>periodically polls this flag.

You could just shut off ctrl-c handling completely, and look for the
^C character when you scan the keyboard (kbhit() and getch()).  1.08
will have setcbrk(), but 1.07 has int 0x21 AH=0x33 already.

DJ