From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a1d846d0e0466c9b X-Google-Attributes: gid103376,public From: do_while@ridgecrest.ca.us (Do-While Jones) Subject: Re: Program (not task) Activation Date: 1998/04/27 Message-ID: <6i2egl$o5$1@owens.ridgecrest.ca.us>#1/1 X-Deja-AN: 348140219 References: <#CDmPrma9GA.300@ntawwabp.compuserve.com> <6hjtju$kiq$1@owens.ridgecrest.ca.us> Organization: RidgeNet - SLIP/PPP Internet, Ridgecrest, CA. (760) 371-3501 Newsgroups: comp.lang.ada Date: 1998-04-27T00:00:00+00:00 List-Id: Jerry van Dijk posted a useful demo program, which Michael Brenner expanded to include tests to make sure the expected error code were returned. Michael's claimed results can't really be the results from the program he included in his message because there are five results, but only four test cases. He clearly (and very kindly) deleted the "rabbits" test (which would have recursively called itself until the stack crashed). He also changed exitcode 1 to exitcode 7. But these are minor changes. He probably edited his test program and forgot to revise the results. (Maybe he inserted an old copy of the program file in his message.) Anyway, it isn't important. What is important is that when he ran his test on NT 4.0, he got non-zero results when he should have. When I ran his program on Windows 95, I got zero every time. (I couldn't run his "exitcode" program because that must have been a C program he wrote but failed to include in the message.) So, my original question ("Does anyone know why Windows 95 did not return an error code?") still stands. Jerry asked, "Also, since you are using Ada 95, why the difficult code?" The short answer is that this was legacy Ada 83 code written for UNIX. I just compiled it on Windows 95 and was surprised that it worked at all. The long answer is that I wanted to make the system call safer and more Ada-like. In C, procedures are written as functions. I hate that. I wrote SHELL.Command as a procedure that RAISES AN EXCEPTION if it fails. This relieves application programs of having to check the result to see if it is zero or not. If I knew the values of E2BIG, ENOENT, etc., I would make my SHELL package even more difficult by adding another function that converts the error value to a string ("Argument list too big.", "Command interpreter not found", etc.) I don't like to have to remember to check a function result to see if a procedure failed or not. I made the SHELL.Command procedure difficult so that programs that call SHELL.Command could be simple. Do-While Jones +--------------------------------+ | Know Ada | | [Ada's Portrait] | | Will Travel | | wire do_while@ridgecrest.ca.us | +--------------------------------+