]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - report.c
Make b-tree cache functions static.
[thirdparty/sarg.git] / report.c
index e1df5ba1e8b6630d2eef553255f144fbbc138e9d..a1ea40d43aba4b8f0dae5e7f3a768ca2726930ce 100644 (file)
--- a/report.c
+++ b/report.c
@@ -94,16 +94,29 @@ void gerarel(void)
        smartfilter=false;
        memset(&globstat,0,sizeof(globstat));
 
-       if (vrfydir(&period, addr, site, us)<0) {
-               debuga(__FILE__,__LINE__,_("Cannot create the output directory name containing the period as part of the name\n"));
-               exit(EXIT_FAILURE);
+       if (email[0]=='\0') {
+               if (vrfydir(&period, addr, site, us)<0) {
+                       debuga(__FILE__,__LINE__,_("Cannot create the output directory name containing the period as part of the name\n"));
+                       exit(EXIT_FAILURE);
+               }
+       } else {
+               if (snprintf(outdirname,sizeof(outdirname),"%s/emailrep",tmp)>=sizeof(outdirname)) {
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
+                       debuga_more("%s/emailrep\n",tmp);
+                       exit(EXIT_FAILURE);
+               }
+               my_mkdir(outdirname);
        }
 
        if(debugz>=LogLevel_Process){
                debugaz(__FILE__,__LINE__,_("outdirname=%s\n"),outdirname);
        }
 
-       if (!FileList_IsEmpty(UserAgentLog) && email[0] == '\0') useragent();
+       if (email[0] == '\0' && !FileList_IsEmpty(UserAgentLog))
+               UserAgent_Readlog();
+
+       init_usertab(UserTabFile);
+       UserAgent();
 
        snprintf(wdirname,sizeof(wdirname),"%s/sarg-general",outdirname);
        if((fp_gen=MY_FOPEN(wdirname,"w"))==NULL){
@@ -429,7 +442,7 @@ void gerarel(void)
 
                if(SuccessfulMsg) debuga(__FILE__,__LINE__,_("Successful report generated on %s\n"),outdirname);
        } else {
-               geramail(outdirname, debug, email, tmp);
+               topuser();
 
                if((strcmp(email,"stdout") != 0) && SuccessfulMsg)
                        debuga(__FILE__,__LINE__,_("Successful report generated and sent to %s\n"),email);