vomlehn@bubba.UUCP (10/31/85)
I've been working on a make-like program for the Mac, written in Megamax C and have noticed that most programs have no way to return a status to the finder. The ability to do so is useful for programs which want to execute multiple applications but only want to go on to the next one if the previous one completed successfully. A make-like utility is one example, a shell is another. The finder passes information to applications in a block of finder information (see the Segment Loader documentation), which is pointed to by a handle residing at 16(A5). This finder information has a header and then an entry for each file selected. The header has a message field, which is a word value containing either a zero (for opening) or a one (for printing). The Megamax exit() routine puts the value it is passed into this field so that the startup program may examine it to see whether the application finished successfully. The Megamax Batch facility considers values of either zero or one to indicate that the application it ran finished successfully, and other value indicates failure. The problem with this is that many UNIX applications use zero to indicate success and one to indicate failure and this means considering the Mac a special case. I think a better alternative is to use the UPPER byte of the message field ONLY. This way applications which don't know about this convention will always execute successfully but programs which exit with a status of one will be considered to have returned a bad status. As a note, UNIX only allows one byte of information to be returned from its exit() routine as well, so a byte should be sufficient.