]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Use the nice new mydirname and fix a bug with the archive variable.
authormmj <none@none>
Sat, 29 May 2004 13:46:10 +0000 (23:46 +1000)
committermmj <none@none>
Sat, 29 May 2004 13:46:10 +0000 (23:46 +1000)
src/mlmmj-send.c

index 784595c14d95af122fa86d298373f6fd0bad9e84..569946167b11be883d2b082187723db5d3ae1c09 100644 (file)
@@ -384,7 +384,7 @@ int main(int argc, char **argv)
        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 @@ int main(int argc, char **argv)
        
        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 @@ int main(int argc, char **argv)
                exit(EXIT_FAILURE);
        }
 
-       if(!listctrl && listdir && listdir[0] == '1')
-               listctrl = strdup("1");
-
        if(!listctrl)
                listctrl = strdup("0");
 
@@ -458,10 +456,11 @@ int main(int argc, char **argv)
                exit(EXIT_FAILURE);
        }
 
-       if(listctrl[0] != '1' && listctrl[0] != '2')
-               listaddr = getlistaddr(listdir);
-       else
+       if(listctrl[0] == '1' || listctrl[0] == '2')
                archive = 0;
+
+       if(listdir)
+               listaddr = getlistaddr(listdir);
        
        /* initialize file with mail to send */