Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!mailrus!utah-gr!uplherc!esunix!bpendlet From: bpendlet@esunix.UUCP (Bob Pendleton) Newsgroups: comp.lang.c Subject: Any way to catch exit()? Message-ID: <949@esunix.UUCP> Date: 18 Aug 88 14:09:09 GMT Organization: Evans & Sutherland, Salt Lake City, Utah Lines: 21 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.