Debianization and various other fixes.
[ezmlm] / qmail.c
diff --git a/qmail.c b/qmail.c
index 1ee257b..5c204c0 100644 (file)
--- a/qmail.c
+++ b/qmail.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include "substdio.h"
 #include "readwrite.h"
 #include "wait.h"
 #include "stralloc.h"
 #include "idx.h"
 
-static char *binqqargs[2] = { PROG_QMAIL_QUEUE, 0 } ;
+static char *binqqargs[2] = { 0, 0 } ;
+
+static void setup_qqargs()
+{
+  if(!binqqargs[0])
+    binqqargs[0] = getenv("QMAILQUEUE");
+  if(!binqqargs[0])
+    binqqargs[0] = "/usr/sbin/qmail-queue";
+}
 
 int qmail_open(qq,sa)
 struct qmail *qq;
@@ -21,6 +30,8 @@ stralloc *sa;
   unsigned i,j;
   char **cpp;
 
+  setup_qqargs();
+
   qq->msgbytes = 0L;
   if (pipe(pim) == -1) return -1;
   if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }