citmail: completed the '-t' option (extract recipients
authorArt Cancro <ajc@citadel.org>
Mon, 28 May 2007 19:51:32 +0000 (19:51 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 28 May 2007 19:51:32 +0000 (19:51 +0000)
from headers) in the sendmail compatibility interface

citadel/Makefile.in
citadel/citmail.c

index 328526401540fae6fbde8b0812ff33493b87e807..78052251c15fa45b42c802f3993331574de168d3 100644 (file)
@@ -152,8 +152,8 @@ citserver: $(SERV_OBJS)
 aidepost: aidepost.o config.o
        $(CC) aidepost.o config.o citadel_dirs.o $(LDFLAGS) -o aidepost $(LIBS)
 
-citmail: citmail.o citadel_dirs.o
-       $(CC) citmail.o citadel_dirs.o $(LDFLAGS) -o citmail $(LIBS)
+citmail: citmail.o citadel_dirs.o tools.o
+       $(CC) citmail.o citadel_dirs.o tools.o $(LDFLAGS) -o citmail $(LIBS)
 
 # setup does need LIBS defined, because it uses network functions which are in -lsocket -lnsl on Solaris.
 setup: setup.o tools.o citadel_dirs.o
index 63f75bd3d0702c06884e8e26f3ca04b5b0ba49ed..5a2fd94d3c11ab816149d5f785bc77caac887437 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdarg.h>
 #include <limits.h>
 #include "citadel.h"
+#include "tools.h"
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
 #endif
@@ -254,7 +255,21 @@ int main(int argc, char **argv) {
                        }
 
                        if (add_these_recipients) {
-                               /* FIXME do something with them */
+                               int num_recp_on_this_line;
+                               char this_recp[256];
+
+                               num_recp_on_this_line = num_tokens(add_these_recipients, ',');
+                               for (i=0; i<num_recp_on_this_line; ++i) {
+                                       extract_token(this_recp, add_these_recipients,
+                                               i, ',', sizeof this_recp);
+                                       striplt(this_recp);
+                                       if (strlen(this_recp) > 0) {
+                                               ++num_recipients;
+                                               recipients = realloc(recipients,
+                                                       (num_recipients * sizeof (char *)));
+                                               recipients[num_recipients - 1] = strdup(this_recp);
+                                       }
+                               }
                        }
                }