[fpc-pascal] Suppressing ^C signal from stdin

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Jan 1 22:08:39 CET 2014


Sven Barth wrote:
> On 01.01.2014 20:48, Mark Morgan Lloyd wrote:
>> When reading characters from a program's stdin using fpRead(), what's
>> the best way of suppressing ^C so that it doesn't raise SIGTERM or
>> whatever? I want to be able to handle signals indicating e.g. a UPS
>> power-failure message, but not to get trivial stuff from the keyboard.
>>
>> Platform is predominantly Linux, possibly also Solaris and one of the
>> BSDs. Anybody porting the program to Windows will have to do their own
>> dirty work :-)
>>
> 
> For Unix systems you could hook the SIGINT signal:

[Slaps head] ^C is SIGINT, not SIGTERM :-) Still, I've just been looking 
at that siginfo structure and it's going to be interesting to see what 
one can find out from it.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list