From c3e6571ea5f53ae37ef28aa74f7d6e48ca52e15f Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sun, 9 Jan 2005 01:19:16 -0500 Subject: [svn-r9786] Purpose: bug fix and document. Description: Unix and probably other systems too, has a small exit value range such as 1 byte. So, exit(256) may end up the same as exit(1). Added caution message to the exit wrappers and changed test programs to exit(1) when errors detected. Platforms tested: tested in copper. verified here that exit(256) was treated just like exit(0). --- fortran/test/fflush1.f90 | 5 ++--- fortran/test/fflush2.f90 | 5 ++--- fortran/test/fortranlib_test.f90 | 5 ++--- fortran/test/t.c | 5 ++++- fortran/test/tf.f90 | 4 +++- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/fortran/test/fflush1.f90 b/fortran/test/fflush1.f90 index 52efb21..bace5f9 100644 --- a/fortran/test/fflush1.f90 +++ b/fortran/test/fflush1.f90 @@ -143,9 +143,8 @@ CALL H5fflush_f(file_id, H5F_SCOPE_GLOBAL_F, error) CALL check("h5fflush_f",error,total_error) - ! if errors detected, exit with non-zero code. This is not truly fortran - ! standard but likely supported by most fortran compilers. - IF (total_error .ne. 0) CALL h5_exit_f (total_error) + ! if errors detected, exit with non-zero code. + IF (total_error .ne. 0) CALL h5_exit_f (1) 001 STOP diff --git a/fortran/test/fflush2.f90 b/fortran/test/fflush2.f90 index 313a2a5..d073810 100644 --- a/fortran/test/fflush2.f90 +++ b/fortran/test/fflush2.f90 @@ -176,8 +176,7 @@ CALL h5close_f(error) CALL check("h5close_types_f",error,total_error) - ! if errors detected, exit with non-zero code. This is not truly fortran - ! standard but likely supported by most fortran compilers. - IF (total_error .ne. 0) CALL h5_exit_f (total_error) + ! if errors detected, exit with non-zero code. + IF (total_error .ne. 0) CALL h5_exit_f (1) END PROGRAM FFLUSH2EXAMPLE diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90 index 208a7e2..d3f22ae 100644 --- a/fortran/test/fortranlib_test.f90 +++ b/fortran/test/fortranlib_test.f90 @@ -336,9 +336,8 @@ CALL h5close_f(error) - ! if errors detected, exit with non-zero code. This is not truly fortran - ! standard but likely supported by most fortran compilers. -! IF (total_error .ne. 0) CALL exit (total_error) + ! if errors detected, exit with non-zero code. + IF (total_error .ne. 0) CALL h5_exit_f (1) END PROGRAM fortranlibtest diff --git a/fortran/test/t.c b/fortran/test/t.c index 0299869..3b51add 100644 --- a/fortran/test/t.c +++ b/fortran/test/t.c @@ -112,7 +112,10 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5_exit_c - * Purpose: Call 'exit()' to terminate application + * Purpose: Call 'exit()' to terminate application. Be careful not to + * overflow the exit value range since UNIX supports a very + * small range such as 1 byte. Therefore, exit(256) may end + * up as exit(0). * Inputs: status - status for exit() to return * Returns: none * Programmer: Quincey Koziol diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90 index 057d47c..f62c3d5 100644 --- a/fortran/test/tf.f90 +++ b/fortran/test/tf.f90 @@ -164,6 +164,9 @@ ! ! Purpose: Exit application ! It is a fortran counterpart for the standard C 'exit()' routine +! Be careful not to overflow the exit value range since +! UNIX supports a very small range such as 1 byte. +! Therefore, exit(256) may end up as exit(0). ! ! Inputs: ! status - Status to return from application @@ -197,4 +200,3 @@ CALL h5_exit_c(status) END SUBROUTINE h5_exit_f - -- cgit v0.12