OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc.c versions 1.34 and 1.35
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc.c 1.34 -> 1.35

--- rc.c 2002/06/28 14:20:23     1.34
+++ rc.c 2002/06/28 17:43:23     1.35
@@ -40,26 +40,31 @@
 {
     ex_t Except;
 
-    ex_try {                /* Configuration block                        */
+    try {                /* Configuration block                        */
         configNew();        /* Construct a new configuration              */
         configLoad(argc, (const char **)argv); /* Load cli, env, and conf */
         configVerify();     /* Test for usage, help, and version options  */
     }
-    ex_catch(Except) {      /* Exceptions of the configuration block      */
+    catch(Except) {      /* Exceptions of the configuration block      */
         if ((rc_return_t)Except.ex_value == RC_WRN_TRM)
             exit(0);
         else if ((rc_return_t)Except.ex_value == RC_ERR_USE)
             clioptPrintusage();
-        else {
-            fprintf(stderr, "Class '%s' threw exception %d in %s:%s():%d.\n",\
-                (char *)Except.ex_class, (int)Except.ex_value,\
-                Except.ex_file, Except.ex_func, Except.ex_line);
+        else
+        if (FAILED((rc_return_t)Except.ex_value)) { /* Error condition */
+            fprintf(stderr, "    Error condition in proc, class '%s',\n    exception %d in %s:%s():%d.\n", (char *)Except.ex_class, (int)Except.ex_value, Except.ex_file, Except.ex_func, Except.ex_line);
+            exit(1); /* Return failure */
         }
-        if (FAILED((rc_return_t)Except.ex_value)) /* NOP on warnings */
-            exit(1); /* Report failure and exit the program */
+#ifdef DEBUG
+        else /* Warning condition */
+            fprintf(stderr, "    Warning condition in proc, class '%s',\n    exception %d in %s:%s():%d.\n", (char *)Except.ex_class, (int)Except.ex_value, Except.ex_file, Except.ex_func, Except.ex_line);
+#else
+        else /* Warning condition */
+            RC_NOP;  /* No operation on warnings */
+#endif
     }
 
-    ex_try { /* Main processing block, the script is built here */
+    try { /* Main processing block, the script is built here */
         rc_proc_t *pProc = NULL;
         pProc = procNew();      /* Construct a new processor, build script  */
         procPopulate(pProc);    /* Populate with run commands               */
@@ -67,16 +72,25 @@
         procDelete(pProc);      /* Destroy the processor                    */
         configDelete();         /* Destroy the configuration                */
     }
-    ex_catch(Except) {  /* Error exceptions thrown during script processing */
-        TRACE("Also, exception dans le processor bloque");
-        if (FAILED((rc_return_t)Except.ex_value)) { /* NOP on warnings */
-            fprintf(stderr, "Class '%s' threw exception %d in %s:%s():%d.\n",\
-                (char *)Except.ex_class, (int)Except.ex_value,\
-                Except.ex_file, Except.ex_func, Except.ex_line);
+    catch(Except) {  /* Error exceptions thrown during script processing */
+        if (FAILED((rc_return_t)Except.ex_value)) { /* Error condition */
+            if ((rc_return_t)Except.ex_value == RC_ERR_FNC)
+                fprintf(stderr, "    Error condition, function file could not be opened.\n");
+            else if ((rc_return_t)Except.ex_value == RC_ERR_DIR)
+                fprintf(stderr, "    Error condition, location dir could not be opened.\n");
+            else if ((rc_return_t)Except.ex_value == RC_ERR_RCF)
+                fprintf(stderr, "    Error condition, rc file could not be opened.\n");
+            else
+                fprintf(stderr, "    Error condition in proc, class '%s',\n    exception %d in %s:%s():%d.\n", (char *)Except.ex_class, (int)Except.ex_value, Except.ex_file, Except.ex_func, Except.ex_line);
             exit(1); /* Return failure */
         }
-        else
+#ifdef DEBUG
+        else /* Warning condition */
+            fprintf(stderr, "    Warning condition in proc, class '%s',\n    exception %d in %s:%s():%d.\n", (char *)Except.ex_class, (int)Except.ex_value, Except.ex_file, Except.ex_func, Except.ex_line);
+#else
+        else /* Warning condition */
             RC_NOP;  /* No operation on warnings */
+#endif
     }
 
     exit(0);        /* Return success */

CVSTrac 2.0.1