Path: utzoo!yunexus!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!kth!draken!tut!santra!mjolner!tnvsu1.tele.nokia.fi!eru From: eru@tnvsu1.tele.nokia.fi Newsgroups: gnu.gcc Subject: VMS exit codes Message-ID: <434@mjolner.tele.nokia.fi> Date: 21 Jul 89 11:43:07 GMT Article-I.D.: mjolner.434 Sender: news@mjolner.tele.nokia.fi Reply-To: eru@tnvsu1.tele.nokia.fi () Distribution: gnu Organization: Nokia Telecommunications Lines: 48 Morten Kjeldgaard writes: >resulting program gave me problems. I shaved the program down to the >following, and compiled it with my gcc version 1.35 compiler on a microvax II, >vms 5.1: > >define.c: > > main() > { > printf("vms defined\n"); > } > >Here is what happens when define.exe runs: > >$ run define >vms defined >%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=0000000C, >PC=0000000C, PSL=00000004 I think this is the problem of random program exit codes. There is actually nothing wrong with your program, except that the return value of function "main" is random (or depends on whatever "printf" happens to leave in the registers). The VMS command interpreter is a bit too smart and prints an error message if the exit code the program returns is something that it thinks indicates an error. Various numbers indicate VMS errors and errors in VMS utilities, and they are associated with canned messages. I think even codes normally indicate a serious error and odd codes are just warnings (and are not printed). Codes below 7 are unassigned, that is why a C program that returns 0 in the unix-style gets the mysterious "%NONAME-W-NOMSG, Message number 00000000" upon exit. Try typing "exit 0", "exit 6", "exit 10" etc to VMS to see the messages. The normal "OK"-code is 1. To make programs portable between VMS and unix, one can write something like #ifdef vms #define OK_EXIT 1 #else #define OK_EXIT 0 #endif ... exit(OK_EXIT); Erkki Ruohtula eru@tele.nokia.fi