[PATCH] qmqpc: Read servers from the command line.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 14 Feb 2006 15:55:14 +0000 (15:55 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 14 Feb 2006 15:55:14 +0000 (15:55 +0000)
This patch patches qmail-qmqpc.[c8] to allow specification of serves on
the command line. This allows the individual process to control the servers
used, rather than the central /var/qmail/control/qmqpservers. This offers
a simple means to extend ezmlm servers. The patch is for qmail-1.03.

qmail-qmqpc.8
qmail-qmqpc.c

index e11a15e..d8fbbb5 100644 (file)
@@ -3,6 +3,9 @@
 qmail-qmqpc \- queue a mail message via QMQP
 .SH SYNOPSIS
 .B qmail-qmqpc
+[
+.I server
+[...] ]
 .SH DESCRIPTION
 .B qmail-qmqpc
 offers the same interface as
@@ -16,6 +19,13 @@ installation,
 .B qmail-queue
 is replaced with a symbolic link to
 .BR qmail-qmqpc .
+
+If one or more server IP addresses 
+are specified on the command line,
+.B qmail-qmqpc
+will ignore the control files and instead use the QMQP servers specified on the
+command line.
+
 .SH "CONTROL FILES"
 .TP 5
 .I qmqpservers
@@ -23,6 +33,7 @@ IP addresses of QMQP servers, one address per line.
 .B qmail-qmqpc
 will try each address in turn until it establishes a QMQP connection
 or runs out of addresses.
+
 .SH "SEE ALSO"
 qmail-control(5),
 qmail-queue(8),
index d5adf05..88de856 100644 (file)
@@ -135,25 +135,36 @@ char *server;
 
 stralloc servers = {0};
 
-main()
+main(argc,argv)
+int argc;
+char **argv;
 {
   int i;
   int j;
 
   sig_pipeignore();
 
-  if (chdir(auto_qmail) == -1) die_home();
-  if (control_init() == -1) die_control();
-  if (control_readfile(&servers,"control/qmqpservers",0) != 1) die_control();
+  if (!argv[1]) {              /* std behavior */
+    if (chdir(auto_qmail) == -1) die_home();
+    if (control_init() == -1) die_control();
+    if (control_readfile(&servers,"control/qmqpservers",0) != 1) die_control();
 
-  getmess();
+    getmess();
 
-  i = 0;
-  for (j = 0;j < servers.len;++j)
-    if (!servers.s[j]) {
-      doit(servers.s + i);
-      i = j + 1;
-    }
+    i = 0;
+    for (j = 0;j < servers.len;++j)
+      if (!servers.s[j]) {
+       doit(servers.s + i);
+       i = j + 1;
+      }
+  } else {                     /* servers on cmd line */
+
+    getmess();
+
+    i = 1;
+    while (argv[i])
+      doit(argv[i++]);
+  }
 
   _exit(lasterror);
 }