From: Frédéric Marchal Date: Thu, 28 Jan 2010 20:28:48 +0000 (+0000) Subject: Don't show empty colums when columns are not requested in sarg.conf X-Git-Tag: v2.3-pre2~107 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=594c9da438bbeef183f42a59225c7c7b57df9796;p=thirdparty%2Fsarg.git Don't show empty colums when columns are not requested in sarg.conf --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d5724e8..163a0b9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED (VERSION 2.6) PROJECT(sarg C) SET(sarg_VERSION 2) -SET(sarg_REVISION 3) +SET(sarg_REVISION "3rc1") SET(sarg_BUILD "") SET(sarg_BUILDDATE "Jan-28-2010") @@ -17,7 +17,7 @@ DEFINE_PROPERTY(GLOBAL PROPERTY enable-htmldir BRIEF_DOCS "--enable-htmldir=html FULL_DOCS "Select htmldir as the root of your WWW documents") SET(PACKAGE_NAME "sarg") -SET(PACKAGE_VERSION "${sarg_VERSION}.${sarg_REVISION}.${sarg_BUILD}") +SET(PACKAGE_VERSION "${sarg_VERSION}.${sarg_REVISION}${sarg_BUILD}") MACRO(SET_ABS_SOURCE VAR DOC) IF(${VAR} AND NOT ${VAR}_SOURCE) diff --git a/html.c b/html.c index b74a52b..4e1f188 100644 --- a/html.c +++ b/html.c @@ -55,7 +55,6 @@ void htmlrel(void) int cstatus; const char txtext[]=".txt"; int dlen; - char href2[MAXLEN]; char urly[MAXLEN]; char siteind[MAXLEN]; struct getwordstruct gwarea; @@ -254,35 +253,24 @@ void htmlrel(void) fprintf(fp_ou,"%s %s\n",denied_report,text[116],text[55]); } - strcpy(val3,text[92]); - strcpy(val4,text[93]); - sprintf(val11,"%%%s",text[93]); - sprintf(val5,"%s-%s-%s",text[113],text[114],text[112]); - strcpy(val6,text[94]); - strcpy(val7,text[95]); - sprintf(val8,"%%%s",text[99]); - strcpy(val9,"colspan=\"2\""); - bzero(val10, 255); - - if((UserReportFields & USERREPORTFIELDS_CONNECT) == 0) - bzero(val3, 255); - if((UserReportFields & USERREPORTFIELDS_BYTES) == 0) - bzero(val4, 255); - if((UserReportFields & USERREPORTFIELDS_SETYB) == 0) - bzero(val11, 255); - if((UserReportFields & USERREPORTFIELDS_IN_CACHE_OUT) == 0) { - bzero(val5, 255); - bzero(val9, 255); - strcpy(val10,""); - } - if((UserReportFields & USERREPORTFIELDS_USED_TIME) == 0) - bzero(val6, 255); - if((UserReportFields & USERREPORTFIELDS_MILISEC) == 0) - bzero(val7, 255); - if((UserReportFields & USERREPORTFIELDS_PTIME) == 0) - bzero(val8, 255); - - fprintf(fp_ou,"%s%s%s%s%s%s%s%s\n",text[91],val3,val4,val11,val9,val5,val6,val7,val8); + fprintf(fp_ou,"%s",text[91]); + + if((UserReportFields & USERREPORTFIELDS_CONNECT) != 0) + fprintf(fp_ou,"%s",text[92]); + if((UserReportFields & USERREPORTFIELDS_BYTES) != 0) + fprintf(fp_ou,"%s",text[93]); + if((UserReportFields & USERREPORTFIELDS_SETYB) != 0) + fprintf(fp_ou,"%%%s",text[93]); + if((UserReportFields & USERREPORTFIELDS_IN_CACHE_OUT) != 0) + fprintf(fp_ou,"%s-%s-%s",text[113],text[114],text[112]); + if((UserReportFields & USERREPORTFIELDS_USED_TIME) != 0) + fprintf(fp_ou,"%s",text[94]); + if((UserReportFields & USERREPORTFIELDS_MILISEC) != 0) + fprintf(fp_ou,"%s",text[95]); + if((UserReportFields & USERREPORTFIELDS_PTIME) != 0) + fprintf(fp_ou,"%%%s",text[99]); + + fputs("\n",fp_ou); if(debug) { if(userip) { @@ -324,10 +312,6 @@ void htmlrel(void) exit(1); } - if(strncmp(tmsg,"OK",2) != 0) - sprintf(tmsg,"%s",text[46]); - else bzero(tmsg, 50); - if(nnbytes) { perc=nnbytes * 100; perc=perc / tnbytes; @@ -351,98 +335,73 @@ void htmlrel(void) ouperc=ouperc / nnbytes; } else ouperc=0; - strcpy(wwork1,fixnum(twork,1)); - strcpy(wwork2,fixnum(nnbytes,1)); - strcpy(wwork3,fixnum2(nnelap,1)); - - if(!LongUrl) { - char *endofhost=strchr(url,'/'); - if (endofhost) *endofhost='\0'; - strcpy(urly,url); - } else { - strcpy(urly,url); - url_module(url, module); - str=strchr(url,'/'); - if (str){ - *str='\0'; - strcat(url,"..."); - strcat(url,module); - } - } + if(UserReportLimit<=0 || count<=UserReportLimit) { + fputs("",fp_ou); - if(Privacy) - sprintf(httplink,"%s",PrivacyStringColor,PrivacyString); - else { if(IndexTree == INDEX_TREE_DATE) sprintf(tmp6,"../%s",ImageFile); else strcpy(tmp6,"../../images"); - if(BlockIt[0]!='\0') - snprintf(httplink,sizeof(httplink)," %s",wwwDocumentRoot,BlockIt,urly,tmp6,urly,urly); - else - snprintf(httplink,sizeof(httplink),"%s",urly,urly,url); - } - if((ReportType & REPORT_TYPE_SITE_USER_TIME_DATE) != 0) { - strcpy(ltext110,text[110]); - for(s=ltext110; *s; ++s) - *s=tolower(*s); - strcpy(siteind,urly); - str=siteind; - for(z1=0; str[z1]; z1++) { - if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\' || str[z1]=='*' || - str[z1]=='\'' || str[z1]=='\"' || str[z1]=='$' || str[z1]=='@') - str[z1]='_'; + if((ReportType & REPORT_TYPE_SITE_USER_TIME_DATE) != 0) { + strcpy(ltext110,text[110]); + for(s=ltext110; *s; ++s) + *s=tolower(*s); + strcpy(siteind,urly); + str=siteind; + for(z1=0; str[z1]; z1++) { + if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\' || str[z1]=='*' || + str[z1]=='\'' || str[z1]=='\"' || str[z1]=='$') + str[z1]='_'; + } + fprintf(fp_ou,"\"T\"",usuario,siteind,tmp6,ltext110,text[55]); + } else { + fprintf(fp_ou,""); } - sprintf(href2,"\"T\"",usuario,siteind,tmp6,ltext110,text[55]); - } else { - bzero(href2, MAXLEN); - bzero(ltext110, 50); - } - - sprintf(val2,"%s",href2); - sprintf(val3,"%3.2f%%",perc); - sprintf(val4,"%3.2f%%",inperc); - sprintf(val5,"%3.2f%%",ouperc); - sprintf(val6,"%s",buildtime(nnelap)); - sprintf(val7,"%3.2f%%",perc2); - if((UserReportFields & USERREPORTFIELDS_CONNECT) == 0) { - bzero(wwork1, 255); - bzero(hbc1, 30); - } - if((UserReportFields & USERREPORTFIELDS_BYTES) == 0) { - bzero(wwork2, 255); - bzero(hbc2, 30); - } - if((UserReportFields & USERREPORTFIELDS_MILISEC) == 0) { - bzero(wwork3, 255); - bzero(hbc3, 30); - } - if((UserReportFields & USERREPORTFIELDS_SETYB) == 0) { - bzero(val3, 255); - bzero(hbc4, 30); - } - if((UserReportFields & USERREPORTFIELDS_IN_CACHE_OUT) == 0) { - bzero(val4, 255); - bzero(val5, 255); - bzero(hbc5, 30); - bzero(hbc6, 30); - } - if((UserReportFields & USERREPORTFIELDS_USED_TIME) == 0) { - bzero(val6, 255); - bzero(hbc7, 30); - } - if((UserReportFields & USERREPORTFIELDS_PTIME) == 0) { - bzero(val7, 255); - bzero(hbc8, 30); - } - if(strncmp(tmsg," ",1) == 0) - bzero(hbc9, 30); + if(!LongUrl) { + char *endofhost=strchr(url,'/'); + if (endofhost) *endofhost='\0'; + strcpy(urly,url); + } else { + strcpy(urly,url); + url_module(url, module); + str=strchr(url,'/'); + if (str){ + *str='\0'; + strcat(url,"..."); + strcat(url,module); + } + } + if(Privacy) + fprintf(fp_ou,"%s",PrivacyStringColor,PrivacyString); + else { + if(BlockIt[0]!='\0') { + fprintf(fp_ou," %s",wwwDocumentRoot,BlockIt,urly,tmp6,urly,urly); + } else + fprintf(fp_ou,"%s",urly,urly,url); + } - if(UserReportLimit<=0 || count<=UserReportLimit) { - fprintf(fp_ou,"%s%s%s%s%s%s%s%s%s%s%s\n",val2,httplink,wwork1,wwork2,val3,val4,val5,val6,wwork3,val7,tmsg); + if((UserReportFields & USERREPORTFIELDS_CONNECT) != 0) + fprintf(fp_ou,"%s",fixnum(twork,1)); + if((UserReportFields & USERREPORTFIELDS_BYTES) != 0) + fprintf(fp_ou,"%s",fixnum(nnbytes,1)); + if((UserReportFields & USERREPORTFIELDS_SETYB) != 0) + fprintf(fp_ou,"%3.2f%%",perc); + if((UserReportFields & USERREPORTFIELDS_IN_CACHE_OUT) != 0) + fprintf(fp_ou,"%3.2f%%%3.2f%%s",inperc,ouperc); + if((UserReportFields & USERREPORTFIELDS_USED_TIME) != 0) + fprintf(fp_ou,"%s",buildtime(nnelap)); + if((UserReportFields & USERREPORTFIELDS_MILISEC) != 0) + fprintf(fp_ou,"%s",fixnum2(nnelap,1)); + if((UserReportFields & USERREPORTFIELDS_PTIME) != 0) + fprintf(fp_ou,"%3.2f%%",perc2); + + if(strncmp(tmsg,"OK",2) != 0) + fprintf(fp_ou,"%s",text[46]); + + fputs("\n",fp_ou); count++; } @@ -566,60 +525,23 @@ void htmlrel(void) inperc=inperc / tnbytes; } else inperc=0; - sprintf(wwork1,"%s",fixnum(tnacc,1)); - sprintf(wwork2,"%s",fixnum(tnbytes,1)); - sprintf(wwork3,"%s",fixnum2(tnelap,1)); - - sprintf(val2,"%s%s",href2,ltext110); - sprintf(val3,"%3.2f%%",perc); - sprintf(val4,"%3.2f%%",inperc); - sprintf(val5,"%3.2f%%",ouperc); - sprintf(val6,"%s",buildtime(tnelap)); - sprintf(val7,"%3.2f%%",perc2); - - strcpy(hbc1,"class=\"header2\""); - strcpy(hbc2,"class=\"header2\""); - strcpy(hbc3,"class=\"header2\""); - strcpy(hbc4,"class=\"header2\""); - strcpy(hbc5,"class=\"header2\""); - strcpy(hbc6,"class=\"header2\""); - strcpy(hbc7,"class=\"header2\""); - strcpy(hbc8,"class=\"header2\""); - strcpy(hbc9,"class=\"header\""); - - if((UserReportFields & USERREPORTFIELDS_CONNECT) == 0) { - bzero(wwork1, 255); - bzero(hbc1, 30); - } - if((UserReportFields & USERREPORTFIELDS_BYTES) == 0) { - bzero(wwork2, 255); - bzero(hbc2, 30); - } - if((UserReportFields & USERREPORTFIELDS_MILISEC) == 0) { - bzero(wwork3, 255); - bzero(hbc3, 30); - } - if((UserReportFields & USERREPORTFIELDS_SETYB) == 0) { - bzero(val3, 255); - bzero(hbc4, 30); - } - if((UserReportFields & USERREPORTFIELDS_IN_CACHE_OUT) == 0) { - bzero(val4, 255); - bzero(hbc5, 30); - bzero(val5, 255); - bzero(hbc6, 30); - } - if((UserReportFields & USERREPORTFIELDS_USED_TIME) == 0) { - bzero(val6, 255); - bzero(hbc7, 30); - } - if((UserReportFields & USERREPORTFIELDS_PTIME) == 0) { - bzero(val7, 255); - bzero(hbc8, 30); - } - if((UserReportFields & USERREPORTFIELDS_TOTAL) != 0) { - fprintf(fp_ou,"%s%s%s%s%s%s%s%s%s\n",hbc9,text[107],hbc1,wwork1,hbc2,wwork2,hbc4,val3,hbc5,val4,hbc6,val5,hbc7,val6,hbc3,wwork3,hbc8,val7); + fprintf(fp_ou,"%s",text[107]); + if((UserReportFields & USERREPORTFIELDS_CONNECT) != 0) + fprintf(fp_ou,"%s",fixnum(tnacc,1)); + if((UserReportFields & USERREPORTFIELDS_BYTES) != 0) + fprintf(fp_ou,"%s",fixnum(tnbytes,1)); + if((UserReportFields & USERREPORTFIELDS_SETYB) != 0) + fprintf(fp_ou,"%3.2f%%",perc); + if((UserReportFields & USERREPORTFIELDS_IN_CACHE_OUT) != 0) + fprintf(fp_ou,"%3.2f%%%3.2f%%",inperc,ouperc); + if((UserReportFields & USERREPORTFIELDS_USED_TIME) != 0) + fprintf(fp_ou,"%s",buildtime(tnelap)); + if((UserReportFields & USERREPORTFIELDS_MILISEC) != 0) + fprintf(fp_ou,"%s",fixnum2(tnelap,1)); + if((UserReportFields & USERREPORTFIELDS_PTIME) != 0) + fprintf(fp_ou,"%3.2f%%",perc2); + fputs("\n",fp_ou); } fclose(fp_in); @@ -695,43 +617,20 @@ void htmlrel(void) twork2=ntotuser; twork=ttnacc/twork2; - strcpy(wwork1,fixnum(twork,1)); - strcpy(wwork2,fixnum(totbytes2,1)); - strcpy(wwork3,fixnum2(totelap2,1)); - - sprintf(val6,"%s",buildtime(totelap2)); - sprintf(val7,"%3.2f%%",perc2); - - strcpy(hbc1,"class=\"header2\""); - strcpy(hbc2,"class=\"header2\""); - strcpy(hbc3,"class=\"header2\""); - strcpy(hbc4,"class=\"header2\""); - strcpy(hbc5,"class=\"header2\""); - strcpy(hbc6,"class=\"header\""); - - if((UserReportFields & USERREPORTFIELDS_CONNECT) == 0) { - bzero(wwork1, 255); - bzero(hbc1, 30); - } - if((UserReportFields & USERREPORTFIELDS_BYTES) == 0) { - bzero(wwork2, 255); - bzero(hbc2, 30); - } - if((UserReportFields & USERREPORTFIELDS_MILISEC) == 0) { - bzero(wwork3, 255); - bzero(hbc3, 30); - } - if((UserReportFields & USERREPORTFIELDS_USED_TIME) == 0) { - bzero(val6, 255); - bzero(hbc4, 30); - } - if((UserReportFields & USERREPORTFIELDS_PTIME) == 0) { - bzero(val7, 255); - bzero(hbc5, 30); - } - if((UserReportFields & USERREPORTFIELDS_AVERAGE) != 0) { - fprintf(fp_ou,"%s%s%s%s%s%s\n",hbc6,text[96],hbc1,wwork1,hbc2,wwork2,hbc4,val6,hbc3,wwork3,hbc5,val7); + fprintf(fp_ou,"%s",text[96]); + if((UserReportFields & USERREPORTFIELDS_CONNECT) != 0) + fprintf(fp_ou,"%s",fixnum(twork,1)); + if((UserReportFields & USERREPORTFIELDS_BYTES) != 0) + fprintf(fp_ou,"%s",fixnum(totbytes2,1)); + fprintf(fp_ou,""); + if((UserReportFields & USERREPORTFIELDS_USED_TIME) != 0) + fprintf(fp_ou,"%s",buildtime(totelap2)); + if((UserReportFields & USERREPORTFIELDS_MILISEC) != 0) + fprintf(fp_ou,"%s",fixnum2(totelap2,1)); + if((UserReportFields & USERREPORTFIELDS_PTIME) != 0) + fprintf(fp_ou,"%3.2f%%",perc2); + fputs("\n",fp_ou); } } /* added */ tnacc=0; @@ -752,7 +651,6 @@ void htmlrel(void) } - (void)rewinddir(dirp); (void)closedir(dirp); greport_cleanup(); diff --git a/include/conf.h b/include/conf.h index 9fac0f8..9e52f8a 100755 --- a/include/conf.h +++ b/include/conf.h @@ -349,7 +349,6 @@ char wwork1[MAXLEN]; char wwork2[MAXLEN]; char wwork3[MAXLEN]; char mask[MAXLEN]; -char httplink[MAXLEN]; char html_old[MAXLEN]; char site[MAXLEN]; char us[50];