Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!minow From: minow@decvax.UUCP (Martin Minow) Newsgroups: net.lang.c Subject: Re: exit() on VMS Message-ID: <178@decvax.UUCP> Date: Wed, 12-Feb-86 18:26:58 EST Article-I.D.: decvax.178 Posted: Wed Feb 12 18:26:58 1986 Date-Received: Fri, 14-Feb-86 02:27:25 EST References: <1046@decwrl.DEC.COM> <3174@umcp-cs.UUCP> Reply-To: minow@decvax.UUCP (Martin minow) Organization: DEC - ULTRIX Engineering Group Lines: 44 In article <3174@umcp-cs.UUCP>, Chris Torek (chris@umcp-cs.UUCP) writes: >I would hope that on VMS, exit(0) maps to status code 1 (success, >no error; it is possible on VMS to have failures without errors >and successes with errors), and that anything else maps to a status >that indicates an `unspecified error'. Unfortunately, on VMS, status code 1 means "success", thus the Unix exit(1) usage to indicate errors fails. On VMS, there is a very large set of error/status codes -- giving unique codes for each unique error. The proper way to return a status code is to specify its symbolic name; the compiler determines its value. The following sequence is portable between Unix, VMS (Vax-C) and Decus C implementations: #ifdef vms #include #include /* * SS$_NORMAL is "normal completion", STS$M_INHIB_MSG supresses * printing a status message. * SS$_ABORT is the general abort status code. */ #define IO_SUCCESS (SS$_NORMAL | STS$M_INHIB_MSG) #define IO_ERROR SS$_ABORT #endif /* * Note: IO_SUCCESS and IO_ERROR are defined in the Decus C stdio.h file */ #ifndef IO_SUCCESS #define IO_SUCCESS 0 #endif #ifndef IO_ERROR #define IO_ERROR 1 #endif ... exit(IO_SUCCESS); /* Normal exit */ exit(IO_ERROR); /* Error exit */ Martin Minow decvax!minow