[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] cvs diff exit status
From: |
Donald Sharp |
Subject: |
Re: [PATCH] cvs diff exit status |
Date: |
Fri, 1 Dec 2000 10:44:38 -0500 |
User-agent: |
Mutt/1.2.4i |
It's not. cvs turns the return codes from the diff() function into
useless information:
from main.c( I'm adding in my comments ):
/* call the diff() function */
err = (*(cm->func)) (argc, argv);
/* At this point err is 0 - for no diff, 1 for a diff, 2 for error */
/* This is exit rather than return because apparently that keeps
some tools which check for memory leaks happier. */
/* Here we exit the program, it turns 1 and 2 into program failures */
exit (err ? EXIT_FAILURE : 0);
donald
On Fri, Dec 01, 2000 at 10:36:06AM -0500, Noel L Yap wrote:
> The exit status of "cvs diff" is exactly the same as the exit status of "diff"
> (man diff for more info). Why not test the exit status itself:
> cvs diff blah
> if [ $? -lt 2 ]
> then
> echo success
> else
> echo failure
> fi
>
>
>
>
> address@hidden on 2000.12.01 09:59:07
>
> To: address@hidden
> cc: (bcc: Noel L Yap)
> Subject: [PATCH] cvs diff exit status
>
>
>
>
> When the cvs diff command is run it attempts to return one of
> three status codes to main:
>
> 0 - files same
> 1 - files different
> 2 - Some sort of error has occurred
>
> main interprets and return codes > 0 as a cvs program failure.
> I've changed diff.c to return only success or failure. Success
> is either the '0' or '1' state outlined above. Failure is the
> '2' state.
>
> The reason that I have done this is because the current cvs
> code returns EXIT_FAILURE for both '1' and '2' outlined above.
> When I run a cvs diff command and check the programs return code
> I have no way of telling whether cvs ran successfully or cvs found
> some diffs without parsing the output from cvs as well.
>
> Thanks!
>
> donald
>
>