Debug: _exit() process-termination
[exim.git] / src / src / exim.c
index 98174d61a2bfc444964d6da62339ec4ad4f7424e..4e4b6bb754570a71a635cd0d82d5ae2b917baf52 100644 (file)
@@ -727,9 +727,13 @@ exit(rc);
 
 
 void
-exim_underbar_exit(int rc)
+exim_underbar_exit(int rc, const uschar * process)
 {
 store_exit();
+DEBUG(D_any)
+  debug_printf(">>>>>>>>>>>>>>>> Exim pid=%d %s%s%sterminating with rc=%d "
+    ">>>>>>>>>>>>>>>>\n", (int)getpid(),
+    process ? "(" : "", process, process ? ") " : "", rc);
 _exit(rc);
 }
 
@@ -972,15 +976,6 @@ fprintf(fp, "Support for:");
   tcp_init();
   if (f.tcp_fastopen_ok) fprintf(fp, " TCP_Fast_Open");
 #endif
-#ifdef EXPERIMENTAL_LMDB
-  fprintf(fp, " Experimental_LMDB");
-#endif
-#ifdef EXPERIMENTAL_QUEUEFILE
-  fprintf(fp, " Experimental_QUEUEFILE");
-#endif
-#if defined(EXPERIMENTAL_SRS) || defined(EXPERIMENTAL_SRS_NATIVE)
-  fprintf(fp, " Experimental_SRS");
-#endif
 #ifdef EXPERIMENTAL_ARC
   fprintf(fp, " Experimental_ARC");
 #endif
@@ -993,6 +988,18 @@ fprintf(fp, "Support for:");
 #ifdef EXPERIMENTAL_DSN_INFO
   fprintf(fp, " Experimental_DSN_info");
 #endif
+#ifdef EXPERIMENTAL_LMDB
+  fprintf(fp, " Experimental_LMDB");
+#endif
+#ifdef EXPERIMENTAL_QUEUE_RAMP
+  fprintf(fp, " Experimental_Queue_Ramp");
+#endif
+#ifdef EXPERIMENTAL_QUEUEFILE
+  fprintf(fp, " Experimental_QUEUEFILE");
+#endif
+#if defined(EXPERIMENTAL_SRS) || defined(EXPERIMENTAL_SRS_NATIVE)
+  fprintf(fp, " Experimental_SRS");
+#endif
 #ifdef EXPERIMENTAL_TLS_RESUME
   fprintf(fp, " Experimental_TLS_resume");
 #endif
@@ -3006,6 +3013,11 @@ for (i = 1; i < argc; i++)
          queue_only_set = TRUE;
          }
 
+      /* -odd: testsuite-only: add no inter-process delays */
+
+       else if (Ustrcmp(argrest, "d") == 0)
+         f.testsuite_delays = FALSE;
+
       /* -odf: foreground delivery (smail-compatible option); same effect as
         -odi: interactive (synchronous) delivery (sendmail-compatible option)
       */
@@ -3130,8 +3142,7 @@ for (i = 1; i < argc; i++)
 
       case 'm':
       case 'o':
-       if (!*argrest) {}
-       else badarg = TRUE;
+       if (*argrest) badarg = TRUE;
        break;
 
       /* -oP <name>: set pid file path for daemon
@@ -3149,27 +3160,24 @@ for (i = 1; i < argc; i++)
 
       case 'r':
       case 's':
-       if (!*argrest)
-         {
-         int *tp = (*argrest == 'r')?
-           &arg_receive_timeout : &arg_smtp_receive_timeout;
-         if (argrest[1] == 0)
-           {
-           if (i+1 < argc) *tp= readconf_readtime(argv[++i], 0, FALSE);
-           }
-         else *tp = readconf_readtime(argrest + 1, 0, FALSE);
-         if (*tp < 0)
-           exim_fail("exim: bad time value %s: abandoned\n", argv[i]);
-         }
-       else badarg = TRUE;
+       {
+       int * tp = argrest[-1] == 'r'
+         ? &arg_receive_timeout : &arg_smtp_receive_timeout;
+       if (*argrest)
+         *tp = readconf_readtime(argrest, 0, FALSE);
+       else if (i+1 < argc)
+         *tp = readconf_readtime(argv[++i], 0, FALSE);
+
+       if (*tp < 0)
+         exim_fail("exim: bad time value %s: abandoned\n", argv[i]);
+       }
        break;
 
       /* -oX <list>: Override local_interfaces and/or default daemon ports */
 
       case 'X':
-       if (!*argrest)
-         override_local_interfaces = argv[++i];
-       else badarg = TRUE;
+       if (*argrest) badarg = TRUE;
+       else override_local_interfaces = argv[++i];
        break;
 
       /* Unknown -o argument */
@@ -4355,7 +4363,7 @@ if (list_queue)
 if (count_queue)
   {
   set_process_info("counting the queue");
-  queue_count();
+  fprintf(stdout, "%u\n", queue_count());
   exit(EXIT_SUCCESS);
   }
 
@@ -4603,7 +4611,7 @@ if (msg_action_arg > 0 && msg_action != MSG_LOAD)
     else if ((pid = fork()) == 0)
       {
       (void)deliver_message(argv[i], forced_delivery, deliver_give_up);
-      exim_underbar_exit(EXIT_SUCCESS);
+      exim_underbar_exit(EXIT_SUCCESS, US"cmdline-delivery");
       }
     else if (pid < 0)
       {
@@ -4623,10 +4631,10 @@ turn into a queue runner, with an optional starting message id. */
 if (queue_interval == 0 && !f.daemon_listen)
   {
   DEBUG(D_queue_run) debug_printf("Single queue run%s%s%s%s\n",
-    (start_queue_run_id == NULL)? US"" : US" starting at ",
-    (start_queue_run_id == NULL)? US"" : start_queue_run_id,
-    (stop_queue_run_id == NULL)?  US"" : US" stopping at ",
-    (stop_queue_run_id == NULL)?  US"" : stop_queue_run_id);
+    start_queue_run_id ? US" starting at " : US"",
+    start_queue_run_id ? start_queue_run_id: US"",
+    stop_queue_run_id ?  US" stopping at " : US"",
+    stop_queue_run_id ?  stop_queue_run_id : US"");
   if (*queue_name)
     set_process_info("running the '%s' queue (single queue run)", queue_name);
   else
@@ -5706,7 +5714,7 @@ while (more)
       rc = deliver_message(message_id, FALSE, FALSE);
       search_tidyup();
       exim_underbar_exit(!mua_wrapper || rc == DELIVER_MUA_SUCCEEDED
-        ? EXIT_SUCCESS : EXIT_FAILURE);
+        ? EXIT_SUCCESS : EXIT_FAILURE, US"cmdline-delivery");
       }
 
     if (pid < 0)