From 6d2736c0746b752cae7148c8e1637ec6cc9f9c1c Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 14 Feb 2006 15:55:14 +0000 Subject: [PATCH] [PATCH] qmqpc: Read servers from the command line. 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 | 11 +++++++++++ qmail-qmqpc.c | 33 ++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/qmail-qmqpc.8 b/qmail-qmqpc.8 index e11a15e..d8fbbb5 100644 --- a/qmail-qmqpc.8 +++ b/qmail-qmqpc.8 @@ -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), diff --git a/qmail-qmqpc.c b/qmail-qmqpc.c index d5adf05..88de856 100644 --- a/qmail-qmqpc.c +++ b/qmail-qmqpc.c @@ -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); } -- 2.11.0