3 ms·
OpenVMS has a system-wide convention for coding exit status [1]. The lowest 3 bits of the status value is used to denote severity (0:warning, 1:success, 2:erro
by zoomablemind 5y ago
OpenVMS has a system-wide convention for coding exit status [1].
The lowest 3 bits of the status value is used to denote severity (0:warning, 1:success, 2:error, 3:info, 4:severe/fatal).
In addition to that, each "facility" (either system or user service/application) defines its set of status values and corresp. messages, which can be incorporated for use with system message facilty. So that on a program exit a user can query the resulting status/message to get an explanation and possible remedies, if applicable (HELP /MESSSAGE $STATUS).
[1]:https://wiki.vmssoftware.com/$STATUS https://wiki.vmssoftware.com/$STATUS
- nerdponx 5y agoI really like this idea, I might try using it in one of my own programs (knowing fully that it's not a generally accepted standard, but at least I can document what the codes mean)
- BruceEel 5y agoThis is very neat indeed. It could perhaps become an unofficial standard of sorts if enough developers adopt it...
- _kst_ 5y agoOne issue with that is that using 1 for success conflicts with the nearly universal Unix convention of using 0 for success. C requires exit(0) to indicate a successful status. The OpenVMS C library translates that to a status of 1. A lot of C code uses exit(1) to indicate failure, but it indicates success in OpenVMS. (Use EXIT_FAILURE, a macro defined in <stdlib.h>, instead.)
- zoomablemind 5y ago> ... Use EXIT_FAILURE, a macro defined in <stdlib.h> ...EXIT_SUCCESS too. This at least would provide a basic portability.