diff options
Diffstat (limited to 'vms/generate_config_vms_h_gawk.com')
-rw-r--r-- | vms/generate_config_vms_h_gawk.com | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/vms/generate_config_vms_h_gawk.com b/vms/generate_config_vms_h_gawk.com index 11493e5d..03ad2015 100644 --- a/vms/generate_config_vms_h_gawk.com +++ b/vms/generate_config_vms_h_gawk.com @@ -242,40 +242,34 @@ $ write cvh "#define NO_ALLOCA" $ write cvh "#define STACK_DIRECTION (-1)" $ write cvh "" $ write cvh "void decc$exit(int status);" -$ write cvh "void __posix_exit(int status);" $ write cvh "#define _exit(foo) vms_exit(foo)" $ write cvh "#define exit(foo) vms_exit(foo)" $ write cvh "" -$ write cvh "#define EXIT_FATAL (STS$M_INHIB_MSG | STS$K_SEVERE)" +$ write cvh "/* Use POSIX exit codes here */" +$ write cvh "#ifdef EXIT_FAILURE" +$ write cvh "#undef EXIT_FAILURE" +$ write cvh "#endif" +$ write cvh "#define EXIT_FAILURE (1)" +$ write cvh "" +$ write cvh "#define EXIT_FATAL (2)" $ write cvh "" $ write cvh "#ifndef C_FACILITY_NO" $ write cvh "#define C_FACILITY_NO 0x350000" $ write cvh "#endif" $ write cvh "" -$ write cvh "/* Use old exit codes for DCL, correct for other cases */ +$ write cvh "/* Build a Posix Exit with VMS severity */ $ write cvh "static void vms_exit(int status) {" -$ write cvh " char * shell;" $ write cvh " int vms_status;" -$ write cvh " int use_old_exit = 0;" -$ write cvh " shell = getenv(""SHELL"");" -$ write cvh " if (shell != NULL) {" -$ write cvh " if (strcmp(shell, ""DCL"") == 0) {" -$ write cvh " use_old_exit = 1;" -$ write cvh " }" -$ write cvh " } else {" -$ write cvh " use_old_exit = 1;" -$ write cvh " }" -$ write cvh " if (use_old_exit == 1) {" -$ write cvh " decc$exit(status);" -$ write cvh " }" $ write cvh " /* Fake the __posix_exit with severity added */" -$ write cvh " /* Undocumented correct way to do the above unless */" -$ write cvh " /* backwards compatibilty is needed */" +$ write cvh " /* Undocumented correct way to do this. */" $ write cvh " vms_status = C_FACILITY_NO | 0xA000 | STS$M_INHIB_MSG;" +$ write cvh " vms_status |= (status << 3);" $ write cvh " if (status == EXIT_FAILURE) {" -$ write cvh " vms_status |= (1 << 3) | STS$K_ERROR;" +$ write cvh " vms_status |= STS$K_ERROR;" $ write cvh " } else if (status == EXIT_FATAL) {" -$ write cvh " vms_status |= (2 << 3) | STS$K_SEVERE;" +$ write cvh " vms_status |= STS$K_SEVERE;" +$ write cvh " } else {" +$ write cvh " vms_status |= STS$K_SUCCESS;" $ write cvh " }" $ write cvh " decc$exit(vms_status);" $ write cvh "}" |