changeset 124:4c8cc076c784

Use the nice new mydirname and fix a bug with the archive variable.
author mmj
date Sat, 29 May 2004 23:46:10 +1000
parents 748e6f8d0755
children 2fa5d1026563
files src/mlmmj-send.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/mlmmj-send.c	Sat May 29 23:42:14 2004 +1000
+++ b/src/mlmmj-send.c	Sat May 29 23:46:10 2004 +1000
@@ -384,7 +384,7 @@
 	char *replyto = NULL, *bounceaddr = NULL, *to_addr = NULL;
 	char *relayhost = NULL, *archivefilename = NULL, *tmpstr;
 	char *listctrl = NULL, *subddirname = NULL, *listdir = NULL;
-	char *mlmmjbounce = NULL, *argv0 = strdup(argv[0]);
+	char *mlmmjbounce = NULL, *bindir;
 	DIR *subddir;
 	FILE *subfile = NULL, *mailfile = NULL, *tmpfile;
 	struct dirent *dp;
@@ -393,8 +393,9 @@
 	
 	log_set_name(argv[0]);
 
-	mlmmjbounce = concatstr(2, dirname(argv0), "/mlmmj-bounce");
-	free(argv0);
+	bindir = mydirname(argv[0]);
+	mlmmjbounce = concatstr(2, bindir, "/mlmmj-bounce");
+	free(bindir);
 	
 	while ((opt = getopt(argc, argv, "aVDhm:l:L:R:F:T:r:")) != -1){
 		switch(opt) {
@@ -440,9 +441,6 @@
 		exit(EXIT_FAILURE);
 	}
 
-	if(!listctrl && listdir && listdir[0] == '1')
-		listctrl = strdup("1");
-
 	if(!listctrl)
 		listctrl = strdup("0");
 
@@ -458,10 +456,11 @@
 		exit(EXIT_FAILURE);
 	}
 
-	if(listctrl[0] != '1' && listctrl[0] != '2')
+	if(listctrl[0] == '1' || listctrl[0] == '2')
+		archive = 0;
+
+	if(listdir)
 		listaddr = getlistaddr(listdir);
-	else
-		archive = 0;
 	
 	/* initialize file with mail to send */