]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - report.c
Change a message string.
[thirdparty/sarg.git] / report.c
index df609f46a3088011a67c36310635f254750c8436..78327720aa03429095e1df561d7ef888099ea581 100644 (file)
--- a/report.c
+++ b/report.c
 
 #include "include/conf.h"
 #include "include/defs.h"
+#include "include/filelist.h"
 
 //! The global statistics of the whole log read.
 struct globalstatstruct globstat;
 //! \c True to enable the smart filter.
 bool smartfilter=false;
 
+extern FileListObject UserAgentLog;
+
 //! The file to store the HTML page where the time of access is reported for one site and one user.
 static FILE *fp_tt=NULL;
 //! The name of the file containing the access time of the site/user.
@@ -46,7 +49,7 @@ static void grava_SmartFilter(const char *dirname, const char *user, const char
 
 void gerarel(void)
 {
-       FILE *fp_in;
+       FileObject *fp_in;
        FILE *fp_gen;
        FILE *fp_tmp=NULL;
 
@@ -100,7 +103,7 @@ void gerarel(void)
                debugaz(__FILE__,__LINE__,_("outdirname=%s\n"),outdirname);
        }
 
-       if(UserAgentLog[0] != '\0' && email[0] == '\0') useragent();
+       if (!FileList_IsEmpty(UserAgentLog) && email[0] == '\0') useragent();
 
        snprintf(wdirname,sizeof(wdirname),"%s/sarg-general",outdirname);
        if((fp_gen=MY_FOPEN(wdirname,"w"))==NULL){
@@ -128,8 +131,8 @@ void gerarel(void)
                        debuga_more("%s/%s.user_log\n",tmp,uinfo->filename);
                        exit(EXIT_FAILURE);
                }
-               if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){
-                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
+               if((fp_in=FileObject_Open(tmp3))==NULL){
+                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,FileObject_GetLastOpenError());
                        exit(EXIT_FAILURE);
                }
                user=uinfo->filename;
@@ -330,8 +333,8 @@ void gerarel(void)
                        strcpy(oldaccdia,accdia);
                        strcpy(oldacchora,acchora);
                }
-               if (fclose(fp_in)==EOF) {
-                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
+               if (FileObject_Close(fp_in)) {
+                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,FileObject_GetLastCloseError());
                        exit(EXIT_FAILURE);
                }
                longline_destroy(&line);