Path: utzoo!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!ucsdhub!isg100!elgar!ag From: ag@elgar.UUCP (Keith Gabryelski) Newsgroups: comp.unix.xenix Subject: SCO XENIX bug prevents smail from working correctly. Summary: return(exitstat) vs. exit(exitstat) bit me hard. Message-ID: <31@elgar.UUCP> Date: 19 Jan 89 00:15:34 GMT Reply-To: ag@elgar.UUCP (Keith Gabryelski) Organization: Elgar Corporation, San Diego, CA Lines: 46 The SCO XENIX C compiler (mine is version 2.2) does not handle a return from main() correctly. A return from main should be the same as an exit from main. It isn't. You can confirm this by compiling, running, and checking the exit status of: main(){ return 0; } and main(){ exit(0); } (On my machine, a 386 box running 2.3.1 OS and 2.2 dev system The former's exit status is 1. The latter's exit status is 0. Smail uses a return from main(). Smail will always exit (if mail was delivered ok) with a status of `2' even though the exitstat is 0. HDB (SCO 2.3.1) barfs (returns exit status info to calling site) on any status other then `0' from rmail (rmail is linked to smail). [Sorry Brian, I should have found this earlier.] `recmail' (news) expects any non-zero return value of MAILER (/usr/bin/smail) to be an indication of an error and returns mail while passing the error along to `rn'. This shows itself to the user as `rn' barfing after any `R' or `r' command (and returning mail to you, the sender) even though mail has been sent. (Mailing to a moderator would also barf, although I haven't tried it). The following patch to smail[main.c] will fix this: 212c212 < return( exitstat ); --- > exit( exitstat ); This gist is, smail must use exit() instead of return to leave main with a status code. Pax, Keith -- ag@elgar.CTS.COM Keith Gabryelski ...!{ucsd, crash}!elgar!ag