Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!mailrus!tut.cis.ohio-state.edu!osu-cis!att!cbnews!lvc From: lvc@cbnews.ATT.COM (Lawrence V. Cipriani) Newsgroups: comp.lang.c Subject: Re: Any way to catch exit()? Summary: define your own exit() routine Message-ID: <967@cbnews.ATT.COM> Date: 26 Aug 88 18:56:31 GMT References: <8808261432.AA11635@ucbvax.Berkeley.EDU> Reply-To: lvc@cbnews.ATT.COM (Lawrence V. Cipriani) Organization: AT&T Bell Laboratories, Columbus Lines: 17 One solution that I have employed is to define my own exit routine. When the program terminates my exit routine is called, and does what I want. void exit(e) int e; { ...whatever... _exit(e); /* still need this sucker */ } This probably is non-portable but should solve your problem (if I understood it correctly). If you have the source code to popen(3) look at it for another example. -- Larry Cipriani, AT&T Network Systems, Columbus OH, cbnews!lvc lvc@cbnews.ATT.COM