New gen_exit_proc procedure.

Change-Id: Iee9145eca077c46bceb9c767a83011d553d8326b
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/opt.tcl b/lib/opt.tcl
index 0c2a76e..50c8309 100755
--- a/lib/opt.tcl
+++ b/lib/opt.tcl
@@ -540,3 +540,16 @@
   trap { exit_proc } [list SIGTERM SIGINT]
 
 }
+
+
+proc gen_exit_proc { {ret_code 0} } {
+
+  # Call exit_proc if it is defined.  Otherwise, just call exit.
+
+  if { [info procs "exit_proc"] != "" } {
+    exit_proc $ret_code
+  } else {
+    exit $ret_code
+  }
+
+}