Any way to catch exit()?

Bob Pendleton bpendlet at esunix.UUCP
Fri Aug 19 00:09:09 AEST 1988


I'd have thought this was trivial, except that I've spent 2 days
RTFMing and can't find the answer.

I'm writing a library that needs to do some clean up when the program
that is using it is done. Just because I'm such a nice guy I'd like to
let the user program just terminate, any old way, a signal or by
exit() and just automagically do the clean up. Well I can catch a
signal, but I haven't found a portable way to "catch" exit(). I found
the SunOS on_exit() routine, nice. But ULTRIX doesn't seem to have
one, and I've been told that this is going to have to port to System
V.

So, is there a portable way for a routine to dectect when the program
it is part of is trying to exit()?


			Bob P.
-- 
Bob Pendleton @ Evans & Sutherland
UUCP Address:  {decvax,ucbvax,allegra}!decwrl!esunix!bpendlet
Alternate:     utah-cs!esunix!bpendlet
        I am solely responsible for what I say.



More information about the Comp.lang.c mailing list