]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Take the date_format into account when converting a file
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Fri, 25 Feb 2011 08:05:14 +0000 (08:05 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Fri, 25 Feb 2011 08:05:14 +0000 (08:05 +0000)
The date_format parameter read from sarg.conf was taken into account too late
in the program flow and was ignored during the convertion or the splitting of a
file. Only command line option -g was effective.

log.c

diff --git a/log.c b/log.c
index 6298e8e1c6844ea863bc12e14b98a83fa05bcdf0..28115b133916cac2869d858ec697a0fa9fde712a 100644 (file)
--- a/log.c
+++ b/log.c
@@ -560,6 +560,16 @@ int main(int argc,char *argv[])
        if(DataFile[0] != '\0')
                dataonly++;
 
+       if(df[0] == '\0') strcpy(df,DateFormat);
+       else strcpy(DateFormat,df);
+
+       if(df[0] == '\0') {
+               strcpy(df,"u");
+               strcpy(DateFormat,"u");
+       }
+       if (df[0]=='w')
+               IndexTree=INDEX_TREE_FILE;
+
        if(NAccessLog == 0) {
                strcpy(AccessLog[0],"/var/log/squid/access.log");
                NAccessLog++;
@@ -630,16 +640,6 @@ int main(int argc,char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       if(df[0] == '\0') strcpy(df,DateFormat);
-       else strcpy(DateFormat,df);
-
-       if(df[0] == '\0') {
-               strcpy(df,"u");
-               strcpy(DateFormat,"u");
-       }
-       if (df[0]=='w')
-               IndexTree=INDEX_TREE_FILE;
-
        if(email[0] == '\0' && OutputEmail[0] != '\0') strcpy(email,OutputEmail);
 
        if(email[0] != '\0') {