[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: incorrect return code on vms...

From: Donald Sharp
Subject: Re: incorrect return code on vms...
Date: Fri, 1 Dec 2000 11:33:12 -0500
User-agent: Mutt/1.2.4i

On Fri, Dec 01, 2000 at 09:47:52AM -0600, David H. Thornley wrote:
> Donald Sharp wrote:
> > 
> > If the return codes for a program are reversed on vms,
> > such that success = 1 and failure = 0, then cvs would
> > always exit with a failure on vms systems.  Attached
> > is a patch to fix this problem.
> > 
> Assuming that VMS has a conforming C compiler, this is not
> a problem.  The C system interprets both 0 and EXIT_SUCCESS
> as successful exits, and EXIT_FAILURE as a failure exit.
> These are defined in <stdlib.h>.

You missunderstand what I did.  This has nothing to do
with the c compiler.  It has everything to do with what
cvs returned as a exit code.  The vms system( according to
the ChangeLog ) interprets return codes from programs as follows:
0 - Program failed
1 - Program Succeeded.

Original code did this:

        exit( err ? EXIT_FAILURE : 0 );

Within cvs err is set to 0 for program success and >0 for failure.

stdlib.h on vms should set EXIT_FAILURE to 0.  Therefore the
above exit() code will always return 0 on vms.  I assumed that EXIT_SUCCESS
would be set to the correct thing.  Hence:

        exit( err ? EXIT_FAILURE : EXIT_SUCCESS );

I #defined EXIT_SUCCESS in system.h ostensibly for old sun boxes
see the comment above the EXIT_FAILURE line in system.h.

If vms isn't setting EXIT_FAILURE or EXIT_SUCCESS then we
need to fix the #defines in system.h to do the right thing
on vms.  

Also we should not be returning 0, we should be using EXIT_SUCCESS
in the code in main() in order for the right thing to be done...

Having said all that I bet this is a moot point in a lot of respects.
Is anyone even using VMS?

> If the operating system has other conventions, and many have,
> then the C compiler needs to create code that will change the
> exit status appropriately.  In this case, it should transform
> 0 to 1 and whatever it uses as EXIT_FAILURE to 0.  In other
> words, do what it takes to make ISO standard C work on the
> system.
> If CVS is telling VMS that it fails when it in fact succeeds,
> then the C compiler is bad, and likely has other failings
> as well.  Find a better compiler, or pester your vendor to
> conform to the standard.
> -- 
> David H. Thornley                          Software Engineer
> at CES International, Inc.:  address@hidden or (763)-694-2556
> at home: (612)-623-0552 or address@hidden or
> _______________________________________________
> Info-cvs mailing list
> address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]