Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: exit(main(argc,argv,env)); Message-ID: <6919@brl-smoke.ARPA> Date: 5 Jan 88 23:13:07 GMT References: <1451@houdi.UUCP> <171@goofy.megatest.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <171@goofy.megatest.UUCP> djones@megatest.UUCP (Dave Jones) writes: >Moral: Start a company policy of not using exit(). Call Lexit() instead. >Have a way of registering cleanup routines with Lexit. A possible solution: ANSI C provides an atexit() function that helps immensely with this. However, in the interim you need to take care of this yourself. One possibility is to use my public-domain implementation of atexit() and atexit-supporting exit(), which requires that your current "exit" library entry be renamed, to "__exit" for example, but otherwise slips right into your current C library. Contact me if you need a copy. - Gwyn@BRL.MIL