]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Fix indentation of the code
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Sun, 26 Dec 2010 11:13:16 +0000 (11:13 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Sun, 26 Dec 2010 11:13:16 +0000 (11:13 +0000)
The replacement of spaces by tabs to indent the code increased the
missalignement of the code where the indentation was already wrong.

28 files changed:
auth.c
authfail.c
btree_cache.c
dansguardian_log.c
dansguardian_report.c
datafile.c
denied.c
download.c
email.c
exclude.c
grepday.c
html.c
index.c
ip2name.c
lastlog.c
log.c
repday.c
report.c
siteuser.c
smartfilter.c
sort.c
squidguard_log.c
squidguard_report.c
topsites.c
totday.c
useragent.c
usertab.c
util.c

diff --git a/auth.c b/auth.c
index 42cbe454757f5088306e1366ea5dcc605e3cd73e..fab5d655cb6e1245ce7092f5ab12c020931d053e 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -59,7 +59,7 @@ void htaccess(const struct userinfostruct *uinfo)
                                i++;
                        } else {
                                fputc(line[i],fp_auth);
-               }
+                       }
        }
        fclose(fp_auth);
        fclose(fp_in);
index 875053c7bf2f45057b35ae8fce7c5faf28007f3e..434bb47f4bbcfc80f19ff298ffbe0a72009d39b7 100644 (file)
@@ -85,8 +85,8 @@ void authfail_report(void)
        unlink(tmp4);
 
        if((fp_ou=MY_FOPEN(report,"w"))==NULL) {
-       debuga(_("(authfail) Cannot open file %s\n"),report);
-       exit(EXIT_FAILURE);
+               debuga(_("(authfail) Cannot open file %s\n"),report);
+               exit(EXIT_FAILURE);
        }
 
        write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Authentication Failures"),HTML_JS_NONE);
@@ -153,8 +153,8 @@ void authfail_report(void)
                        }
                }
 
-       if(AuthfailReportLimit>0) {
-               if(strcmp(ouser2,uinfo->label) == 0) {
+               if(AuthfailReportLimit>0) {
+                       if(strcmp(ouser2,uinfo->label) == 0) {
                                count++;
                        } else {
                                count=1;
index 5cd15c692e6b8865f094353e874e9cb8bc31b258..3b4aa349c2a331be5ae8353e46332d50a4f92011 100644 (file)
@@ -258,7 +258,7 @@ void balance_node(struct bt *node)
                        rotate_left(node);
                        break;
                default:
-   exit(EXIT_FAILURE);
+                       exit(EXIT_FAILURE);
                        break;
 
        }
index 5fa1cca5d62d74ce252e7ad0685f7f456776e87a..a90367efb6c8a7a6d5ed2c277af1665f5a78fef0 100644 (file)
@@ -94,9 +94,9 @@ void dansguardian_log(void)
                        continue;
                getword_start(&gwarea,buf);
                if (getword(year,sizeof(year),&gwarea,'.')<0 || getword(mon,sizeof(mon),&gwarea,'.')<0 ||
-                       getword(day,sizeof(day),&gwarea,' ')<0 || getword(hour,sizeof(hour),&gwarea,' ')<0 ||
-                       getword(user,sizeof(user),&gwarea,' ')<0 || getword(ip,sizeof(ip),&gwarea,' ')<0 ||
-                       getword_skip(MAXLEN,&gwarea,'/')<0 || getword_skip(MAXLEN,&gwarea,'/')<0) {
+                   getword(day,sizeof(day),&gwarea,' ')<0 || getword(hour,sizeof(hour),&gwarea,' ')<0 ||
+                   getword(user,sizeof(user),&gwarea,' ')<0 || getword(ip,sizeof(ip),&gwarea,' ')<0 ||
+                   getword_skip(MAXLEN,&gwarea,'/')<0 || getword_skip(MAXLEN,&gwarea,'/')<0) {
                        debuga(_("Maybe you have a broken record or garbage in your %s file\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
@@ -105,7 +105,7 @@ void dansguardian_log(void)
                        exit(EXIT_FAILURE);
                }
                if (getword_skip(255,&gwarea,' ')<0 ||
-                       getword(code1,sizeof(code1),&gwarea,' ')<0 || getword(code2,sizeof(code2),&gwarea,' ')<0) {
+                   getword(code1,sizeof(code1),&gwarea,' ')<0 || getword(code2,sizeof(code2),&gwarea,' ')<0) {
                        debuga(_("Maybe you have a broken record or garbage in your %s file\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
index 122769edaa589ed56014e6d6a4c357046102505b..0ff685fd5e808c8a6858d46ec813e0a904a1faea 100644 (file)
@@ -59,13 +59,13 @@ void dansguardian_report(void)
        sprintf(report,"%s/dansguardian.html",outdirname);
 
        if((fp_in=MY_FOPEN(dansguardian_in,"r"))==NULL) {
-       debuga(_("(dansguardian_report) Cannot open log file %s\n"),dansguardian_in);
-       exit(EXIT_FAILURE);
+               debuga(_("(dansguardian_report) Cannot open log file %s\n"),dansguardian_in);
+               exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_FOPEN(report,"w"))==NULL) {
-       debuga(_("(dansguardian_report) Cannot open log file %s\n"),report);
-       exit(EXIT_FAILURE);
+               debuga(_("(dansguardian_report) Cannot open log file %s\n"),report);
+               exit(EXIT_FAILURE);
        }
 
        write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("DansGuardian"),HTML_JS_NONE);
@@ -81,7 +81,7 @@ void dansguardian_report(void)
        while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(user,sizeof(user),&gwarea,'\t')<0 || getword(date2,sizeof(date2),&gwarea,'\t')<0 ||
-                       getword(hour,sizeof(hour),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
+                   getword(hour,sizeof(hour),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
                        debuga(_("Maybe you have a broken record or garbage in your %s file\n"),dansguardian_in);
                        exit(EXIT_FAILURE);
                }
@@ -132,7 +132,7 @@ void dansguardian_report(void)
 
                user_find(name, sizeof(name), user);
 
-       if(DansGuardianReportLimit) {
+               if(DansGuardianReportLimit) {
                        if(strcmp(ouser2,name) == 0) {
                                count++;
                        } else {
index 485f2030d9865643797a082ea4ed6d6b7b8be427..36af6ae35f2d5cb0680a0821fe297c82c683ecd5 100644 (file)
@@ -123,9 +123,9 @@ void data_file(char *tmp)
                while((buf=longline_read(fp_in,line))!=NULL) {
                        getword_start(&gwarea,buf);
                        if (getword(accdia,sizeof(accdia),&gwarea,'\t')<0 || getword(acchora,sizeof(acchora),&gwarea,'\t')<0 ||
-                               getword(accip,sizeof(accip),&gwarea,'\t')<0 ||
-                               getword_ptr(buf,&accurl,&gwarea,'\t')<0 || getword_atoll(&accbytes,&gwarea,'\t')<0 ||
-                               getword(acccode,sizeof(acccode),&gwarea,'\t')<0 || getword_atoll(&accelap,&gwarea,'\t')<0) {
+                           getword(accip,sizeof(accip),&gwarea,'\t')<0 ||
+                           getword_ptr(buf,&accurl,&gwarea,'\t')<0 || getword_atoll(&accbytes,&gwarea,'\t')<0 ||
+                           getword(acccode,sizeof(acccode),&gwarea,'\t')<0 || getword_atoll(&accelap,&gwarea,'\t')<0) {
                                debuga(_("There is a broken record or garbage in file %s\n"),tmp3);
                                exit(EXIT_FAILURE);
                        }
index 5d2288e983c7e8d23490b74e60c94e2478a81e03..bf6bf561d18a3839094ca0010eadb75fc862c66b 100644 (file)
--- a/denied.c
+++ b/denied.c
@@ -71,13 +71,13 @@ void gen_denied_report(void)
        sprintf(report,"%s/denied.html",outdirname);
 
        if((fp_in=MY_FOPEN(denied_in,"r"))==NULL) {
-       debuga(_("(denied) Cannot open log file %s\n"),denied_in);
-       exit(EXIT_FAILURE);
+               debuga(_("(denied) Cannot open log file %s\n"),denied_in);
+               exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_FOPEN(report,"w"))==NULL) {
-       debuga(_("(denied) Cannot open log file %s\n"),report);
-       exit(EXIT_FAILURE);
+               debuga(_("(denied) Cannot open log file %s\n"),report);
+               exit(EXIT_FAILURE);
        }
 
        write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Denied"),HTML_JS_NONE);
@@ -98,7 +98,7 @@ void gen_denied_report(void)
        while((buf=longline_read(fp_in,line))!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(data,sizeof(data),&gwarea,'\t')<0 || getword(hora,sizeof(hora),&gwarea,'\t')<0 ||
-                       getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
+                   getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
                        debuga(_("There is a broken record or garbage in file %s\n"),denied_in);
                        exit(EXIT_FAILURE);
                }
index 0695da14d77f4156e64d4649f80451e931f21ec3..a490952768af8248a167ca05f14bccab854f01b5 100644 (file)
@@ -93,7 +93,7 @@ void download_report(void)
        while((buf=longline_read(fp_in,line))!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(data,sizeof(data),&gwarea,'\t')<0 || getword(hora,sizeof(hora),&gwarea,'\t')<0 ||
-                       getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
+                   getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
                        debuga(_("There is a broken record or garbage in file %s\n"),report_in);
                        exit(EXIT_FAILURE);
                }
diff --git a/email.c b/email.c
index 3188b7927217b7df79ed1098212cb7bd0968b1d4..704d4e163f58a52e7bc84e0971c6eacfb8d93373 100644 (file)
--- a/email.c
+++ b/email.c
@@ -80,8 +80,7 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
        while((buf=longline_read(fp_in,line))!=NULL) {
                ger_read(buf,&item,wger);
                if(item.total) continue;
-               if(strcmp(olduser,item.user) != 0)
-               {
+               if(strcmp(olduser,item.user) != 0) {
                        totuser++;
 
                        if (olduser[0] != '\0') {
@@ -170,8 +169,7 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
 
        fprintf(fp_top3,"%-7s %-20s %-8s %-15s %%%-6s %-10s %-10s %%%-7s\n------- -------------------- -------- --------------- ------- ---------- ---------- -------\n",strip1,strip2,strip3,strip4,strip4,strip5,strip6,strip7);
 
-       while(fgets(warea,sizeof(warea),fp_top1))
-       {
+       while(fgets(warea,sizeof(warea),fp_top1)) {
                fixendofline(warea);
                getword_start(&gwarea,warea);
                if (getword(user,sizeof(user),&gwarea,'\t')<0) {
index 0ccfb0702e1966a5bb70157f638fcdce400b9d24..c60c0a1d030cae7b3d4e28e364c8260c0dbdc806 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -347,11 +347,11 @@ void getuexclude(const char *uexfile, int debug)
        bzero(excludeuser,nreg);
 
        while(fgets(buf,sizeof(buf),fp_ex)!=NULL){
-       if(strchr(buf,'#') != NULL)
-               continue;
-       fixendofline(buf);
-       strcat(excludeuser,buf);
-       strcat(excludeuser," ");
+               if(strchr(buf,'#') != NULL)
+                       continue;
+               fixendofline(buf);
+               strcat(excludeuser,buf);
+               strcat(excludeuser," ");
        }
 
        strcat(excludeuser,"*END* ");
index 87829a08c470de8efda93571b4f420e1c8e9e7ca..3be390bf11f582fc3d9fd2f9a1ee20f846d880b6 100644 (file)
--- a/grepday.c
+++ b/grepday.c
@@ -122,7 +122,7 @@ iconv_t localtoutf=(iconv_t)-1;
 #endif
 
 static void Sarg_gdImageStringFT (struct GraphDataStruct *gdata, int fg, char *fontlist,
-                                                               double ptsize, double angle, int x, int y, const char *string,enum TextRefPos RefPos)
+         double ptsize, double angle, int x, int y, const char *string,enum TextRefPos RefPos)
 {
        char *sstring;
        char *retval;
@@ -720,8 +720,8 @@ void greport_day(const struct userinfostruct *uinfo)
                exit(EXIT_FAILURE);
        }
        if ((fp_ou=fopen(wdirname,"wt"))==NULL) {
-       debuga(_("(grepday) Cannot open output file %s\n"),wdirname);
-       exit(EXIT_FAILURE);
+               debuga(_("(grepday) Cannot open output file %s\n"),wdirname);
+               exit(EXIT_FAILURE);
        }
        write_html_head(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 4 : 2,_("Graph report"),HTML_JS_NONE);
 
diff --git a/html.c b/html.c
index a6beae5611f80414b0d60d61537575e797ec6d0d..5e8839e11aa17d151fa16c4807f9b1358b1e9377 100644 (file)
--- a/html.c
+++ b/html.c
@@ -591,11 +591,6 @@ void htmlrel(void)
                        }
                }
 
-//      if(indexonly) {
-//     unlink(arqou);
-//     continue;
-//      }
-
                if ((ReportType & REPORT_TYPE_TOPUSERS) != 0 && (UserReportFields & USERREPORTFIELDS_AVERAGE) != 0) {
                        totbytes2=totbytes/ntotuser;
                        totelap2=totelap/ntotuser;
diff --git a/index.c b/index.c
index a685f8ead40144597a0fdcb8a0adca6213d2bdd1..1f8779285c677c89b2ca598ab4aa0833e7d57496 100644 (file)
--- a/index.c
+++ b/index.c
@@ -109,7 +109,7 @@ static void make_date_index(void)
        }
        while ((direntp = readdir( dirp )) != NULL) {
                if(strlen(direntp->d_name) > 4 || !isdigit(direntp->d_name[0]) || !isdigit(direntp->d_name[1]) ||
-                       !isdigit(direntp->d_name[2]) || !isdigit(direntp->d_name[3])) continue;
+                  !isdigit(direntp->d_name[2]) || !isdigit(direntp->d_name[3])) continue;
                year=atoi(direntp->d_name);
                if (nyears>=sizeof(yearsort)/sizeof(yearsort[0])) {
                        /*
index 4ae79bb0e76293e59296f584d2e70bee15161a0f..066c596ff733edee3c004b34e9f3f3c901319c8e 100644 (file)
--- a/ip2name.c
+++ b/ip2name.c
@@ -105,7 +105,7 @@ void name2ip(char *name)
        ia.s_addr=ntohl(ia.s_addr);
        getword_start(&gwarea,inet_ntoa(ia));
        if (getword(n4,sizeof(n4),&gwarea,'.')<0 || getword(n3,sizeof(n3),&gwarea,'.')<0 ||
-                       getword(n2,sizeof(n2),&gwarea,'.')<0 || getword(n1,sizeof(n1),&gwarea,0)<0) {
+           getword(n2,sizeof(n2),&gwarea,'.')<0 || getword(n1,sizeof(n1),&gwarea,0)<0) {
                printf("SARG: Maybe you have a broken record or garbage in your %s ip address.\n",gwarea.beginning);
                exit(EXIT_FAILURE);
        }
index 2252bafa6cef4a9078a0fb0742e385ad3ef65396..8b71d0504e72349dae4e0ff2bf2f4269fef26b76 100644 (file)
--- a/lastlog.c
+++ b/lastlog.c
@@ -48,8 +48,8 @@ void mklastlog(const char *outdir)
 
        snprintf(temp,sizeof(temp),"%slastlog1",outdir);
        if((fp_ou=fopen(temp,"w"))==NULL) {
-       debuga(_("(lastlog) Cannot open temporary file %s\n"),temp);
-       exit(EXIT_FAILURE);
+               debuga(_("(lastlog) Cannot open temporary file %s\n"),temp);
+               exit(EXIT_FAILURE);
        }
 
        if ((dirp = opendir(outdir)) == NULL) {
@@ -96,8 +96,8 @@ void mklastlog(const char *outdir)
 
        snprintf(temp,sizeof(temp),"%slastlog",outdir);
        if((fp_in=fopen(temp,"r"))==NULL) {
-       debuga(_("(lastlog) Cannot open temporary file %s\n"),temp);
-       exit(EXIT_FAILURE);
+               debuga(_("(lastlog) Cannot open temporary file %s\n"),temp);
+               exit(EXIT_FAILURE);
        }
 
        while(ftot>0 && fgets(buf,sizeof(buf),fp_in)!=NULL) {
diff --git a/log.c b/log.c
index f25a850a6f6a0390177506a7d4b64469feba20eb..2f115f24ef09223d21d3542f6b0018550b1d305d 100644 (file)
--- a/log.c
+++ b/log.c
@@ -44,8 +44,7 @@ struct userfilestruct
 /*@null@*/static char *userfile=NULL;
 
 numlist weekdays = { { 0, 1, 2, 3, 4, 5, 6 }, 7 };
-numlist hours = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
-                               13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, 24 };
+numlist hours = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, 24 };
 
 static void getusers(const char *pwdfile, int debug);
 
@@ -248,15 +247,15 @@ int main(int argc,char *argv[])
        strcpy(PrivacyStringColor,"blue");
        SuccessfulMsg=true;
        TopUserFields=TOPUSERFIELDS_NUM | TOPUSERFIELDS_DATE_TIME | TOPUSERFIELDS_USERID | TOPUSERFIELDS_CONNECT |
-                                       TOPUSERFIELDS_BYTES | TOPUSERFIELDS_SETYB | TOPUSERFIELDS_IN_CACHE_OUT |
-                                       TOPUSERFIELDS_USED_TIME | TOPUSERFIELDS_MILISEC | TOPUSERFIELDS_PTIME |
-                                       TOPUSERFIELDS_TOTAL | TOPUSERFIELDS_AVERAGE;
+             TOPUSERFIELDS_BYTES | TOPUSERFIELDS_SETYB | TOPUSERFIELDS_IN_CACHE_OUT |
+             TOPUSERFIELDS_USED_TIME | TOPUSERFIELDS_MILISEC | TOPUSERFIELDS_PTIME |
+             TOPUSERFIELDS_TOTAL | TOPUSERFIELDS_AVERAGE;
        UserReportFields=USERREPORTFIELDS_CONNECT | USERREPORTFIELDS_BYTES | USERREPORTFIELDS_SETYB |
-                                               USERREPORTFIELDS_IN_CACHE_OUT | USERREPORTFIELDS_USED_TIME | USERREPORTFIELDS_MILISEC |
-                                               USERREPORTFIELDS_PTIME | USERREPORTFIELDS_TOTAL | USERREPORTFIELDS_AVERAGE;
+             USERREPORTFIELDS_IN_CACHE_OUT | USERREPORTFIELDS_USED_TIME | USERREPORTFIELDS_MILISEC |
+             USERREPORTFIELDS_PTIME | USERREPORTFIELDS_TOTAL | USERREPORTFIELDS_AVERAGE;
        strcpy(DataFileDelimiter,";");
        DataFileFields=DATA_FIELD_USER | DATA_FIELD_DATE | DATA_FIELD_TIME | DATA_FIELD_URL | DATA_FIELD_CONNECT |
-                                               DATA_FIELD_BYTES | DATA_FIELD_IN_CACHE | DATA_FIELD_OUT_CACHE | DATA_FIELD_ELAPSED;
+             DATA_FIELD_BYTES | DATA_FIELD_IN_CACHE | DATA_FIELD_OUT_CACHE | DATA_FIELD_ELAPSED;
        ShowReadStatistics=true;
        strcpy(IndexSortOrder,"D");
        ShowSargInfo=true;
@@ -489,10 +488,9 @@ int main(int argc,char *argv[])
                        case 'z':
                                debugz++;
                                break;
-                       /*case ':':
-                               debuga(_("Option -%c require an argument\n"),optopt);
-                               errflg++;
-                               break;*/
+                       case ':':
+                               debuga(_("Option -%c requires an argument\n"),optopt);
+                               exit(EXIT_FAILURE);
                        case '?':
                                usage(argv[0]);
                                exit(EXIT_FAILURE);
@@ -589,8 +587,8 @@ int main(int argc,char *argv[])
 
        if(ReportType == 0) {
                ReportType=REPORT_TYPE_TOPUSERS | REPORT_TYPE_TOPSITES | REPORT_TYPE_USERS_SITES |
-                                       REPORT_TYPE_SITES_USERS | REPORT_TYPE_DATE_TIME | REPORT_TYPE_DENIED |
-                                       REPORT_TYPE_AUTH_FAILURES | REPORT_TYPE_SITE_USER_TIME_DATE | REPORT_TYPE_DOWNLOADS;
+                          REPORT_TYPE_SITES_USERS | REPORT_TYPE_DATE_TIME | REPORT_TYPE_DENIED |
+                          REPORT_TYPE_AUTH_FAILURES | REPORT_TYPE_SITE_USER_TIME_DATE | REPORT_TYPE_DOWNLOADS;
        }
 
        if(access(ExcludeUsers, R_OK) == 0) {
@@ -750,7 +748,7 @@ int main(int argc,char *argv[])
 #warning "No rlimit resource for the number of open files"
 #endif
                if(rc == -1) {
-                               debuga(_("setrlimit error - %s\n"),strerror(errno));
+                       debuga(_("setrlimit error - %s\n"),strerror(errno));
                }
 
                if(debug)
@@ -883,11 +881,11 @@ int main(int argc,char *argv[])
 
                        recs2++;
                        if( ShowReadStatistics && !from_stdin && !from_pipe && --OutputNonZero<=0) {
-                       double perc = recs2 * 100. / recs1 ;
-                       printf(_("SARG: Records in file: %lu, reading: %3.2lf%%"),recs2,perc);
-                       putchar('\r');
-                       fflush (stdout);
-                       OutputNonZero = REPORT_EVERY_X_LINES ;
+                               double perc = recs2 * 100. / recs1 ;
+                               printf(_("SARG: Records in file: %lu, reading: %3.2lf%%"),recs2,perc);
+                               putchar('\r');
+                               fflush (stdout);
+                               OutputNonZero = REPORT_EVERY_X_LINES ;
                        }
                        if(blen < 58) continue;
                        if(strstr(linebuf,"HTTP/0.0") != 0) continue;
@@ -909,7 +907,7 @@ int main(int argc,char *argv[])
                                        }
                                }
                                if(!exstring && (str=(char *) strstr(linebuf,gwarea.current)) != (char *) NULL )
-                                               exstring=true;
+                                       exstring=true;
                                if(exstring) continue;
                        }
 
@@ -939,7 +937,7 @@ int main(int argc,char *argv[])
                                                }
                                        }
                                        if (getword(data,sizeof(data),&gwarea,']')<0 || getword_skip(MAXLEN,&gwarea,'"')<0 ||
-                                                       getword(fun,sizeof(fun),&gwarea,' ')<0) {
+                                           getword(fun,sizeof(fun),&gwarea,' ')<0) {
                                                debuga(_("Maybe you have a broken record or garbage in your %s file\n"),arq);
                                                exit(EXIT_FAILURE);
                                        }
@@ -1242,12 +1240,10 @@ int main(int argc,char *argv[])
 
                        // Record only hours usage which is required
                        if (t) {
-                               if( bsearch( &( t -> tm_wday ), weekdays.list, weekdays.len,
-                                                                                                                       sizeof( int ), compar ) == NULL )
+                               if( bsearch( &( t -> tm_wday ), weekdays.list, weekdays.len, sizeof( int ), compar ) == NULL )
                                        continue;
 
-                               if( bsearch( &( t -> tm_hour ), hours.list, hours.len,
-                                                                                                                       sizeof( int ), compar ) == NULL )
+                               if( bsearch( &( t -> tm_hour ), hours.list, hours.len, sizeof( int ), compar ) == NULL )
                                        continue;
                        }
 
@@ -1551,7 +1547,7 @@ int main(int argc,char *argv[])
 
        longline_destroy(&line);
        if ( fp_Download_Unsort )
-       fclose (fp_Download_Unsort);
+               fclose (fp_Download_Unsort);
 
        for (ufile=first_user_file ; ufile ; ufile=ufile1) {
                ufile1=ufile->next;
@@ -1616,7 +1612,6 @@ int main(int argc,char *argv[])
        if(debug)
                debuga(_("Period: %s\n"),period.text);
 
-//   fclose(fp_ou);
        if(fp_denied)
                fclose(fp_denied);
        if(fp_authfail)
index c22e79e37994cf1374a2997aa66ac148a94c3380..0f7d40015328e104fb9a8345afc5d8b989c37e04 100644 (file)
--- a/repday.c
+++ b/repday.c
@@ -66,8 +66,8 @@ void report_day(const struct userinfostruct *uinfo)
        }
 
        if((fp_in=fopen(wdirname,"r"))==NULL) {
-       debuga(_("(repday) Cannot open log file %s\n"),wdirname);
-       exit(EXIT_FAILURE);
+               debuga(_("(repday) Cannot open log file %s\n"),wdirname);
+               exit(EXIT_FAILURE);
        }
 
        memset(tbytes,0,sizeof(tbytes));
@@ -119,8 +119,8 @@ void report_day(const struct userinfostruct *uinfo)
        fclose(fp_in);
 
        if((fp_ou=fopen(arqout,"w"))==NULL) {
-       debuga(_("(repday) Cannot open log file %s\n"),arqout);
-       exit(EXIT_FAILURE);
+               debuga(_("(repday) Cannot open log file %s\n"),arqout);
+               exit(EXIT_FAILURE);
        }
 
        write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 4 : 2,_("Day report"),HTML_JS_NONE);
index 499c75c2dbfa648b91f0624d6c76e8443c0d511f..4e8e57b22ee9373c01dd5e7d2f938e0fb8c8a5d6 100644 (file)
--- a/report.c
+++ b/report.c
@@ -112,9 +112,9 @@ void gerarel(void)
                dlen=strlen(direntp->d_name)-(sizeof(logext)-1);
                if (dlen<0) continue;
                if((strcmp(direntp->d_name+dlen,logext) != 0) ||
-                       (strncmp(direntp->d_name,"download.log",12) == 0) ||
-                       (strncmp(direntp->d_name,"denied.log",10) == 0) ||
-                       (strncmp(direntp->d_name,"authfail.log.unsort",19) == 0))
+                  (strncmp(direntp->d_name,"download.log",12) == 0) ||
+                  (strncmp(direntp->d_name,"denied.log",10) == 0) ||
+                  (strncmp(direntp->d_name,"authfail.log.unsort",19) == 0))
                        continue;
                if (snprintf(tmp3,sizeof(tmp3),"%s/%s",tmp,direntp->d_name)>=sizeof(tmp3)) {
                        debuga(_("(report) directory entry too long: %s/%s\n"),tmp,direntp->d_name);
@@ -165,9 +165,9 @@ void gerarel(void)
                while((buf=longline_read(fp_in,line))!=NULL) {
                        getword_start(&gwarea,buf);
                        if (getword(accdia,sizeof(accdia),&gwarea,'\t')<0 || getword(acchora,sizeof(acchora),&gwarea,'\t')<0 ||
-                               getword(accip,sizeof(accip),&gwarea,'\t')<0 ||
-                               getword_ptr(buf,&accurl,&gwarea,'\t')<0 || getword_atoll(&accbytes,&gwarea,'\t')<0 ||
-                               getword(acccode,sizeof(acccode),&gwarea,'\t')<0) {
+                           getword(accip,sizeof(accip),&gwarea,'\t')<0 ||
+                           getword_ptr(buf,&accurl,&gwarea,'\t')<0 || getword_atoll(&accbytes,&gwarea,'\t')<0 ||
+                           getword(acccode,sizeof(acccode),&gwarea,'\t')<0) {
                                debuga(_("There is a broken record or garbage in file %s\n"),tmp3);
                                exit(EXIT_FAILURE);
                        }
@@ -255,7 +255,7 @@ void gerarel(void)
                        nelap+=accelap;
 
                        if ((ReportType & REPORT_TYPE_SITE_USER_TIME_DATE) != 0 &&
-                               (!oldurltt || strcmp(oldurltt,accurl) || strcmp(oldaccdiatt,accdia) || strcmp(oldacchoratt,acchora))) {
+                           (!oldurltt || strcmp(oldurltt,accurl) || strcmp(oldaccdiatt,accdia) || strcmp(oldacchoratt,acchora))) {
 
                                if(!ttopen) {
                                        snprintf(arqtt,sizeof(arqtt),"%s/%s",outdirname,uinfo->filename);
@@ -271,8 +271,7 @@ void gerarel(void)
 
                                        /*
                                        if(Privacy)
-                                               sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s",   \
-                                                                               FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
+                                               sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s",FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
                                        else
                                                sprintf(httplink,"<font size=%s><a href=\"http://%s\">%s</a>",FontSize,accurl,accurl);
                                        */
index d38f4c915f4bcb7b8ae6f4d34509855adc1dea68..a22f14ff33d2615b29d5ce69b914f232468e8c20 100644 (file)
@@ -68,14 +68,14 @@ void siteuser(void)
        }
 
        if((fp_in=fopen(general2,"r"))==NULL) {
-       debuga(_("(siteuser) Cannot open log file %s\n"),general2);
-       debuga(_("sort command: %s\n"),csort);
-       exit(EXIT_FAILURE);
+               debuga(_("(siteuser) Cannot open log file %s\n"),general2);
+               debuga(_("sort command: %s\n"),csort);
+               exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(report,"w"))==NULL) {
-       debuga(_("(siteuser) Cannot open log file %s\n"),report);
-       exit(EXIT_FAILURE);
+               debuga(_("(siteuser) Cannot open log file %s\n"),report);
+               exit(EXIT_FAILURE);
        }
 
        write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Sites & Users"),HTML_JS_SORTTABLE);
index aa6d5a2993a281e3d2c1b251b26cdf8aebfae58e..a34b79731485477f4ad09f8d074f10656ccbb3cc 100644 (file)
@@ -80,8 +80,8 @@ void smartfilter_report(void)
        unlink(smart_in);
 
        if((fp_ou=fopen(report,"w"))==NULL) {
-       debuga(_("(smartfilter) Cannot open log file %s\n"),report);
-       exit(EXIT_FAILURE);
+               debuga(_("(smartfilter) Cannot open log file %s\n"),report);
+               exit(EXIT_FAILURE);
        }
 
        fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
@@ -107,8 +107,8 @@ void smartfilter_report(void)
        while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(user,sizeof(user),&gwarea,'\t')<0 || getword(data,sizeof(data),&gwarea,'\t')<0 ||
-                       getword(hora,sizeof(hora),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0 ||
-                       getword(url,sizeof(url),&gwarea,'\t')<0 || getword(smartcat,sizeof(smartcat),&gwarea,'\n')<0) {
+                   getword(hora,sizeof(hora),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0 ||
+                   getword(url,sizeof(url),&gwarea,'\t')<0 || getword(smartcat,sizeof(smartcat),&gwarea,'\n')<0) {
                        debuga(_("There is a broken record or garbage in file %s\n"),smart_ou);
                        exit(EXIT_FAILURE);
                }
diff --git a/sort.c b/sort.c
index 083c450c0eef65e7b36c09feb0b755351c7b6c3c..3fad666a5a76006a2ac2ad32adcc2679457cf9cd 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -145,10 +145,10 @@ void sort_users_log(const char *tmp, int debug)
 
                if(strcmp(direntp->d_name,"download.unsort") == 0)
                        clen=snprintf(csort,sizeof(csort),"sort -T \"%s\" -k 3,3 -k 1,1 -k 2,2 -k 5,5 -o \"%s/%s.log\" \"%s/%s.unsort\"",
-                               tmp, tmp, user, tmp, user);
+                           tmp, tmp, user, tmp, user);
                else
                        clen=snprintf(csort,sizeof(csort),"sort -T \"%s\" -k 4,4 -k 1,1 -k 2,2 -o \"%s/%s.log\" \"%s/%s.unsort\"",
-                               tmp, tmp, user, tmp, user);
+                           tmp, tmp, user, tmp, user);
                if (clen>=sizeof(csort)) {
                        debuga(_("user name too long to sort %s\n"),csort);
                        exit(EXIT_FAILURE);
index 0c758790b434f00104ccff1cf9f392bd5323b453..8d88512eb292817b61088cfbf242aeeaec9d8428 100644 (file)
@@ -174,7 +174,7 @@ static void read_log(const char *wentp, FILE *fp_ou,int dfrom,int duntil)
                        }
                } else {
                        if (getword_atoll(&lyear,&gwarea,'-')<0 || getword_atoll(&lmon,&gwarea,'-')<0 ||
-                               getword_atoll(&lday,&gwarea,' ')<0) {
+                           getword_atoll(&lday,&gwarea,' ')<0) {
                                debuga(_("Invalid date found in file %s\n"),wentp);
                                exit(EXIT_FAILURE);
                        }
@@ -288,7 +288,7 @@ void squidguard_log(void)
        str2 = user;
 
        if(SquidGuardConf[0] == '\0' && NRedirectorLogs == 0)
-       return;
+               return;
 
        sprintf(guard_in,"%s/redirector.unsort",tmp);
        sprintf(guard_ou,"%s/redirector.log",tmp);
index c00d3d480c4aef12675834b339cb8c7e14d75aff..8f3dc7eb6a5188a915776b14471d0d60097b1ae1 100644 (file)
@@ -65,13 +65,13 @@ void squidguard_report(void)
        snprintf(report,sizeof(report),"%s/redirector.html",outdirname);
 
        if((fp_in=fopen(squidguard_in,"r"))==NULL) {
-       debuga(_("(squidguard) Cannot open log file %s\n"),squidguard_in);
-       exit(EXIT_FAILURE);
+               debuga(_("(squidguard) Cannot open log file %s\n"),squidguard_in);
+               exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(report,"w"))==NULL) {
-       debuga(_("(squidguard) Cannot open log file %s\n"),report);
-       exit(EXIT_FAILURE);
+               debuga(_("(squidguard) Cannot open log file %s\n"),report);
+               exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
index eca6745e2a6f933578c813147278ee09f72d5238..744cbd7630112d4a12ffe7269672eae1926165ba 100644 (file)
@@ -79,14 +79,14 @@ void topsites(void)
        }
 
        if((fp_in=fopen(general2,"r"))==NULL) {
-       debuga(_("(topsites) Cannot open log file %s\n"),general2);
-       debuga(_("sort command: %s\n"),csort);
-       exit(EXIT_FAILURE);
+               debuga(_("(topsites) Cannot open log file %s\n"),general2);
+               debuga(_("sort command: %s\n"),csort);
+               exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(general3,"w"))==NULL) {
-       debuga(_("(topsites) Cannot open log file %s\n"),general3);
-       exit(EXIT_FAILURE);
+               debuga(_("(topsites) Cannot open log file %s\n"),general3);
+               exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
@@ -184,8 +184,8 @@ void topsites(void)
        unlink(general3);
 
        if((fp_ou=fopen(report,"w"))==NULL) {
-       debuga(_("(topsites) Cannot open log file %s\n"),report);
-       exit(EXIT_FAILURE);
+               debuga(_("(topsites) Cannot open log file %s\n"),report);
+               exit(EXIT_FAILURE);
        }
 
        write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Top sites"),HTML_JS_SORTTABLE);
index bf6ddf52a814b16b9dff35f842272bf9d2834775..b095b4bba1d29081c556f9703500a4009e689c26 100644 (file)
--- a/totday.c
+++ b/totday.c
@@ -110,8 +110,8 @@ void day_totalize(const char *tmp, const struct userinfostruct *uinfo, int index
        fclose(fp_in);
 
        if((fp_ou=fopen(arqout,"w"))==NULL) {
-       debuga(_("(totday) Cannot open log file %s\n"),arqout);
-       exit(EXIT_FAILURE);
+               debuga(_("(totday) Cannot open log file %s\n"),arqout);
+               exit(EXIT_FAILURE);
        }
 
        for (i=0 ; i<sizeof(tbytes)/sizeof(*tbytes) ; i++) {
index 7dad9712f08984af1e376b421bb2177824f085d4..144d2367e4a9f54fc594b9465c210e36768e003d 100644 (file)
@@ -79,13 +79,13 @@ void useragent(void)
                totregsl++;
                getword_start(&gwarea,buf);
                if (getword(ip,sizeof(ip),&gwarea,' ')<0 || getword_skip(MAXLEN,&gwarea,'[')<0 ||
-                       getword(data,sizeof(data),&gwarea,' ')<0) {
+                   getword(data,sizeof(data),&gwarea,' ')<0) {
                        debuga(_("Maybe you have a broken record or garbage in your %s file\n"),UserAgentLog);
                        exit(EXIT_FAILURE);
                }
                getword_start(&gwarea1,data);
                if (getword(day,sizeof(day),&gwarea1,'/')<0 || getword(month,sizeof(month),&gwarea1,'/')<0 ||
-                       getword(year,sizeof(year),&gwarea1,':')<0) {
+                   getword(year,sizeof(year),&gwarea1,':')<0) {
                        debuga(_("Maybe you have a broken date in your %s file\n"),UserAgentLog);
                        exit(EXIT_FAILURE);
                }
index 2fbbe30ef31d39d3d2bd9a99f5334e3eda8e66a0..23a90cdd778d5fbbd7114460c87c031161547024 100644 (file)
--- a/usertab.c
+++ b/usertab.c
@@ -211,7 +211,7 @@ static void get_ldap_name(const char *userlogin,char *mappedname,int namelen)
                                }
                                ldap_memfree(attr);
                        }
-                       ldap_msgfree(result);
+               ldap_msgfree(result);
        } else {
                strncpy(mappedname, searched_in_cache,namelen-1);
                mappedname[namelen-1]='\0';
diff --git a/util.c b/util.c
index 35f08180c55d0b9a83e12bc8a38655ae6cc8b1f9..bb7ef92930fedb6273458054fb46e4c4ac03d9f3 100644 (file)
--- a/util.c
+++ b/util.c
@@ -41,28 +41,6 @@ static char mtab1[12][4]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep",
 //! The list of the HTTP codes to exclude from the report.
 static char *excludecode=NULL;
 
-/*void fgetword(char *word, char *line, int stop)
-{
-       //VARIANT N1
-       int x;
-
-       for (x=0; line[x] && (line[x] != stop); x++) word[x] = line[x];
-       word[x] = '\0';
-
-       //VARIANT N2
-       char *tchar;
-       int difflen;
-
-       tchar = strchr(line, stop);
-       if (tchar == NULL) strcpy(word, line);
-       else
-       {
-       difflen = tchar - line;
-       strncpy(word, line, difflen);
-       word[difflen] = '\0';
-       }
-}*/
-
 #if USE_GETWORD_BACKTRACE
 static void getword_backtrace(void)
 {
@@ -112,7 +90,7 @@ int getword(char *word, int limit, struct getwordstruct *gwarea, char stop)
                        //printf("SARG: Maybe you have a broken record or garbage in your access.log file.\n");
                        word[(limit>0) ? limit-1 : 0]='\0';
 #if USE_GETWORD_BACKTRACE
-                               getword_backtrace();
+                       getword_backtrace();
 #endif
                        return(-1);
                }
@@ -841,8 +819,8 @@ int getperiod_buildtext(struct periodstruct *period)
        if (i == 0) return(-1);
 
        range=(period->start.tm_year!=period->end.tm_year ||
-               period->start.tm_mon!=period->end.tm_mon ||
-               period->start.tm_mday!=period->end.tm_mday);
+              period->start.tm_mon!=period->end.tm_mon ||
+              period->start.tm_mday!=period->end.tm_mday);
        if (range) {
                if(df[0]=='u') {
                        i=strftime(text2, sizeof(text2)-i, "%Y %b %d", &period->end);
@@ -963,10 +941,10 @@ int vrfydir(const struct periodstruct *per1, const char *addr, const char *site,
        } else {
                if(df[0] == 'u') {
                        wlen=snprintf(wdir+wlen,sizeof(wdir)-wlen,"%04d%s%02d-%04d%s%02d",y1,
-                                                       conv_month_name(m1),d1,y2,conv_month_name(m2),d2);
+                               conv_month_name(m1),d1,y2,conv_month_name(m2),d2);
                } else if(df[0] == 'e') {
                        wlen=snprintf(wdir+wlen,sizeof(wdir)-wlen,"%02d%s%04d-%02d%s%04d",d1,
-                                                       conv_month_name(m1),y1,d2,conv_month_name(m2),y2);
+                               conv_month_name(m1),y1,d2,conv_month_name(m2),y2);
                } else if(df[0] == 'w') {
                        wlen2=strftime(wdir+wlen, sizeof(wdir)-wlen, "%Y.%U", &per1->start);
                        if (wlen2==0) return(-1);
@@ -1752,7 +1730,7 @@ void unlinkdir(const char *dir,int contentonly)
        if (!dirp) return;
        while ((direntp = readdir(dirp)) != NULL) {
                if (direntp->d_name[0] == '.' && (direntp->d_name[1] == '\0' ||
-                       (direntp->d_name[1] == '.' && direntp->d_name[2] == '\0')))
+                   (direntp->d_name[1] == '.' && direntp->d_name[2] == '\0')))
                        continue;
                if (snprintf(dname,sizeof(dname),"%s/%s",dir,direntp->d_name)>=sizeof(dname)) {
                        debuga(_("directory name to delete too long: %s/%s\n"),dir,direntp->d_name);