[comp.lang.c] VMS and exit

lamonts@Sds.Sdsc.EDU (Steve Lamont) (01/24/88)

Rahul Dhesi <dhesi@bsu-cs.uucp> says

> In article <551@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe)
> writes:
> >Everything that has been said about VMS and exit(0) so far is false.
> ...
> >I found that *none* of them resulted in any message from DCL;
> >*all* of them produced a quiet exit.
     
> The time frame of discussion is important.  DEC has recently revised
> its C compiler for VMS.  Some things formerly missing are now present,
> and the old exit(0) problem ("No text for message 0000" etc.) has been
> fixed.


At the risk of flogging a deceased equine, I tested Rahul's exit(0) contention.
The results are shown below:

$ type foo.c
#include <stdio.h>

main()

  {
  
    printf( "all done...\n" );
    
    exit( 0 );
    
  }
$ run foo
all done...
%NONAME-W-NOMSG, Message number 00000000

.... as you can see, VMS complains, sorta.

Doesn't *anybody* on this newsgroup actually _check_things_out_ before
they send?  Arrrrrgh!

                                                   spl
----------------------------------------
Internet: LAMONTS@SDS.SDSC.EDU
Bitnet:   LAMONTS@SDSC
Span:	  SDSC::LAMONTS (27.1)
USPS:	  Steve Lamont
	  San Diego Supercomputer Center
	  P.O. Box 85608
	  San Diego, CA 92138
AT&T:	  619.534.5126

ok@quintus.UUCP (01/24/88)

In article <11439@brl-adm.ARPA>, lamonts@Sds.Sdsc.EDU (Steve Lamont) writes:
> ... as you can see, VMS complains, sorta.
> 
> Doesn't *anybody* on this newsgroup actually _check_things_out_ before
> they send?  Arrrrrgh!
Yes we do.  exit(0) *is* silent in VMS 4.5 CC 2.3.
I would still like to know which systems exit(0) and exit(1) don't
work in, and as this misunderstanding shows, it is important that
people quote version numbers in their reports.

mkhaw@teknowledge-vaxc.UUCP (01/24/88)

>> Doesn't *anybody* on this newsgroup actually _check_things_out_ before
>> they send?  Arrrrrgh!
> Yes we do.  exit(0) *is* silent in VMS 4.5 CC 2.3.
> I would still like to know which systems exit(0) and exit(1) don't
> work in, and as this misunderstanding shows, it is important that
> people quote version numbers in their reports.

Well, I can't check this anymore since that particular system is long gone,
but VMS 3.5, C 1.2 most certainly had the exit(0) bug.  I just tried

main() { exit(0); }

on VMS 4.4 and microVMS 4.5, C 2.3-024, and both have the exit(0) bug.
There may also be variations in the version of the runtime library that
affect the results.

Mike Khaw
-- 
internet:  mkhaw@teknowledge-vaxc.arpa
usenet:	   {uunet|sun|ucbvax|decwrl|uw-beaver}!mkhaw%teknowledge-vaxc.arpa
USnail:	   Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303

dhesi@bsu-cs.UUCP (Rahul Dhesi) (01/24/88)

In article <11439@brl-adm.ARPA> lamonts@Sds.Sdsc.EDU (Steve Lamont) writes:
>Doesn't *anybody* on this newsgroup actually _check_things_out_ before
>they send?  Arrrrrgh!

Richard O'Keefe did, and I was following up on his article, so I
said
     ...and the old exit(0) problem ("No text for message 0000" etc.)
     has been fixed.

I could have said "has apparently been fixed" but why should I doubt a
fellow Usneetter's word?
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi

lamonts@Sds.Sdsc.EDU (Steve Lamont) (01/29/88)

"M. Warner Losh" <hydrovax@nmtsun.nmt.EDU> quotes me as follows:

> In article <11439@brl-adm.ARPA>, lamonts@Sds.Sdsc.EDU (Steve Lamont) writes:
> <
> <At the risk of flogging a deceased equine, I tested Rahul's exit(0) contention.
> <The results are shown below:
> <
> <$ type foo.c
> <     exit( 0 );
> < %NONAME-W-NOMSG, Message number 00000000
> <
> [my miscellaneous ranting deleted to preserve bandwidth and to protect the
> guilty (me...;-) ]
>
>    you must have version 2.2 of the VMS compiler (I have the same one),
> because I posted the same results a few days ago.  People tell me that
> C version 2.3 corrects this problem (it really breaks a lot of code,
> but that is beside the point).
>      
> Does anybody WHO HAS 2.3 KNOW FOR SURE?

Sorry... I forgot to say that I _did_ compile under VMS C 2.3... in fact I
just double checked it.  Interestingly enough, if you leave off the 
 
    exit(0);

and just drop out the bottom, you don't get a message.  I don't know if that
was the case under 2.2 or not, since I don't have access to the old version
of the compiler.  Maybe that was what your informant was referring to.  

                                                   spl
----------------------------------------
Internet: LAMONTS@SDS.SDSC.EDU
Bitnet:   LAMONTS@SDSC
Span:	  SDSC::LAMONTS (27.1)
USPS:	  Steve Lamont
	  San Diego Supercomputer Center
	  P.O. Box 85608
	  San Diego, CA 92138
AT&T:	  619.534.5126

ok@quintus.UUCP (Richard A. O'Keefe) (01/30/88)

There *is* a vmsexit().  It is called SYS$EXIT, and is described in
the System Services Manual (page SYS-152 in our copy).  A VMS error
code contains
	a severity code (bottom 3 bits, 0 = warning, 1 = success,)
	a subsystem code (RMS? SYS? DCL? FTN? and so on)
	the error code
	should-this-be-printed?
and something else which I don't remember.  Given that SYS$EXIT()
exists, there is no reason why exit() couldn't be this way:

void exit(n)
    int n;
    {
	n &= 255;
	C-library-shut-down;
	SYS$EXIT(n == 0 ? 1 :
		{severity = 2, subsystem = C, error code = n, don't print});
    }

This would manage to be consistent with both UNIX and VMS.
So I can't believe that EXIT_SUCCESS and EXIT_FAILURE were invented
for DEC's sake.

dave@terminus.UUCP (VAX Headroom @ The End of the Galaxy) (02/03/88)

In article <11537@brl-adm.ARPA>, lamonts@Sds.Sdsc.EDU (Steve Lamont) writes:
> > <     exit( 0 );
> > < %NONAME-W-NOMSG, Message number 00000000
> >...
> and just drop out the bottom, you don't get a message.  I don't know if that
> was the case under 2.2 or not, since I don't have access to the old version

Yes, that is the case under 2.0-2.3.

VMS likes exit() or exit(1) as an "ok" indication.

I propose the use of exit(EXIT_OK) where EXIT_OK is defined correctly for
your machine.