Path: utzoo!mnetor!uunet!husc6!cmcl2!beta!unm-la!unmvax!nmtsun!hydrovax From: hydrovax@nmtsun.nmt.edu (M. Warner Losh) Newsgroups: comp.lang.c Subject: Re: exit(-1), 0 is sometimes magic Message-ID: <1234@nmtsun.nmt.edu> Date: 17 Jan 88 18:57:12 GMT References: <502@cresswell.quintus.UUCP> <6935@brl-smoke.ARPA> <1179@wjvax.UUCP> <2305@bloom-beacon.MIT.EDU> Organization: NMT Hydrology program Lines: 25 Keywords: exit, zero, flaming Summary: Isn't OS specific, it's shell specific. Mark Eichin write that using exit(0) is OS sepcific, when in fact it is ENVIRONMENT specific. True enough that all of the SHELLS that UN*X uses use an exit status of zero to mean success (at least all of the one's that I know of). It is the SHELL, NOT THE OPERATING SYSTEM, that is the factor here. If you were programming on VMS, where you could have the dcl shell (or more correctly (from a VMS point of view :-), command interpreter [sic on spelling]) that treats an exit status of on ODD number as success, and an EVEN (for error, I quess) number as an error. On the same machine, running the same OS, you can also have DEC/Shell, which assumes a more "unix" oriented posture. That is, it expects the "exit(0)" convention. As a side note. exit(0) in UNIX isn't quit correct. The UNIX shell, as far as I know, doesn't give a hill of beans wheather you say exit(0), exit(1000), exit (magic_number).... It is the SHELL SCRIPTS that people write that impose this "standard" upon UNIX. I could be wrong about this, but I seem to remeber reading in one of the books/manuals/mag articles about unix that this was the case. I know it's common practice, but is it required? Plesae resond only if YOU KNOW FOR SURE. -- bitnet: lush@nmt.csnet M. Warner Losh csnet: warner%hydrovax@nmtsun uucp: ...{cmcl2, ihnp4}!lanl!unmvax!nmtsun!warner%hydrovax ...{cmcl2, ihnp4}!lanl!unmvax!nmtsun!hydrovax Warning: Hydrovax is both a machine, and an account, so be careful.