Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!princeton!allegra!ulysses!sfmag!sfsup!mpl From: mpl@sfsup.UUCP Newsgroups: comp.os.minix Subject: Re: cal(1) -- really exit(3) Message-ID: <1595@sfsup.UUCP> Date: Mon, 6-Jul-87 11:25:53 EDT Article-I.D.: sfsup.1595 Posted: Mon Jul 6 11:25:53 1987 Date-Received: Wed, 8-Jul-87 03:05:32 EDT References: <3118@felix.UUCP> <2352@hoptoad.uucp> <3169@felix.UUCP> Organization: AT&T-IS, Summit N.J. USA Lines: 40 Summary: how about THIS one, ast! In article <3169@felix.UUCP>, zemon@felix.UUCP writes: > In article <2352@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes: > >Wouldn't it be easier to replace the supplied exit() with one [text deleted] > I think a better solution would be to rename the existing > exit() to _exit() and create an exit() subroutine which > calls _cleanup() and change the tools which don't use stdio > to call _exit(). Whew! I said all that in one breath. :-) That's a good solution, but it also "breaks" some code. How about, in the code which initializes iob (or whatever it's called in MINIX), put the line extern int (*__cleanup)(); extern int _cleanup(); __cleanup = _cleanup; and change exit() to say: int (*__cleanup)(); exit(n) int n; { if (__cleanup) (*__cleanup)(); _exit(n); } This way, if stdio routines are NOT loaded, __cleanup is not set, so there is NO REFERENCE TO _CLEANUP (it won't be loaded ro executed). If stdio IS loaded, __cleanup is set to _cleanup (causing _cleanup to be loaded) and it get's executed before _exit gets called (which does whatever the current exit() does). This maintains FULL code compatibility with REAL UNIX(R). UNIX is a registered trademark of AT&T Well? Any comments? I'd be happy to implement this, if I can ever get my $&^@%&@# hard disk working! Mike Lindner