|
From: | Kon Lovett |
Subject: | Re: [Chicken-users] Return value of `system' |
Date: | Wed, 14 Mar 2007 14:11:07 -0700 |
On Mar 14, 2007, at 11:48 AM, Alex Queiroz wrote:
Hallo, On 14 Mar 2007 15:38:46 -0300, Mario Domenech Goulart <address@hidden> wrote:Is the return value one of the functionalities which depend on the capabilities of the host shell? Or the documentation should mention that the return value of `system' corresponds to the exit status of the process which was executed?ANSI C does not guarantee that. You can't really say much about the return value of system.
I think ISO C90 says system should return -1 on error.Anyway, Chicken 'system' procedure will return the errno value if the C 'system' call returns -1. Otherwise it depends:
*nix WIFEXITED(n) ? WEXITSTATUS(n) : (WIFSIGNALED(n) ? WTERMSIG(n) : WSTOPSIG(n)) Not sure how the C 'system' call return value of 127 (for shell failed to exec)
is represented in the return value.! *nix C 'system' call return value. On Windows this is the value returned by the shell.
IMHO this means the return value is almost useless w/o some hoops; i.e. if 'errno' == the return value the return value is error value, but differentiating an exit-status from a signal-code is probably impossible.
Best Wishes, Kon
-- -alex http://www.ventonegro.org/ _______________________________________________ Chicken-users mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/chicken-users
[Prev in Thread] | Current Thread | [Next in Thread] |