From 8df03d07fce100313aff58be5f4c9ecbeeaf7f34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Marchal?= Date: Mon, 29 Nov 2010 14:36:05 +0000 Subject: [PATCH] Remove duplicate function --- CMakeLists.txt | 2 +- include/defs.h | 1 - include/info.h | 2 +- report.c | 45 ++++----------------------------------------- 4 files changed, 6 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 314ac88..5218ea2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(sarg C) SET(sarg_VERSION 2) SET(sarg_REVISION "3.2-pre1") SET(sarg_BUILD "") -SET(sarg_BUILDDATE "Nov-28-2010") +SET(sarg_BUILDDATE "Nov-29-2010") INCLUDE(AddFileDependencies) INCLUDE(CheckIncludeFile) diff --git a/include/defs.h b/include/defs.h index ef18bb7..86b8370 100755 --- a/include/defs.h +++ b/include/defs.h @@ -134,7 +134,6 @@ void realtime(void); void report_day(const struct userinfostruct *user); // report.c -void gravatmp(const struct userinfostruct *uinfo, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache); void gerarel(void); int ger_read(char *buffer,struct generalitemstruct *item,const char *filename); diff --git a/include/info.h b/include/info.h index a397708..d8f9144 100755 --- a/include/info.h +++ b/include/info.h @@ -1,3 +1,3 @@ -#define VERSION PACKAGE_VERSION" Nov-28-2010" +#define VERSION PACKAGE_VERSION" Nov-29-2010" #define PGM PACKAGE_NAME #define URL "http://sarg.sourceforge.net" diff --git a/report.c b/report.c index 6f49e6d..aa53a3b 100644 --- a/report.c +++ b/report.c @@ -32,7 +32,7 @@ static FILE *fp_tt=NULL; static void maketmp(const char *user, const char *dirname, int debug, int indexonly); static void maketmp_hour(const char *user, const char *dirname, int indexonly); static void gravatmp_hora(const char *dirname, const struct userinfostruct *uinfo, const char *data, const char *hora, long long int elap, long long int accbytes, int indexonly); -static void gravatmpf(const struct userinfostruct *uinfo, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache); +static void gravatmp(const struct userinfostruct *uinfo, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache); static void gravaporuser(const struct userinfostruct *uinfo, const char *dirname, const char *url, const char *ip, const char *data, const char *hora, long long int tam, long long int elap, int indexonly); static void gravager(FILE *fp_gen, const struct userinfostruct *uinfo, long long int nacc, const char *url, long long int nbytes, const char *ip, const char *hora, const char *dia, long long int nelap, long long int incache, long long int oucache); static void grava_SmartFilter(const char *dirname, const char *user, const char *ip, const char *data, const char *hora, const char *url, const char *smart); @@ -354,7 +354,7 @@ void gerarel(void) strcpy(oldmsg,"DENIED"); else strcpy(oldmsg,"OK"); - gravatmpf(puinfo,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache); + gravatmp(puinfo,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache); gravager(fp_gen,puinfo,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache); free(oldurl); } @@ -461,7 +461,7 @@ static void maketmp_hour(const char *user, const char *dirname, int indexonly) } -void gravatmp(const struct userinfostruct *uinfo, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache) +static void gravatmp(const struct userinfostruct *uinfo, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache) { FILE *fp_ou; char wdirname[MAXLEN]; @@ -485,42 +485,6 @@ void gravatmp(const struct userinfostruct *uinfo, const char *oldurl, long long */ fprintf(fp_ou,"%"PRIu64"\t%"PRIu64"\t%s\t%s\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\n",(uint64_t)nacc,(uint64_t)nbytes,oldurl,oldmsg,(uint64_t)nelap,(uint64_t)incache,(uint64_t)oucache); - fclose(fp_ou); - ttopen=0; - - if(fp_tt) { - fputs("\n\n",fp_tt); - fputs("\n\n",fp_tt); - fclose(fp_tt); - fp_tt=NULL; - } - - return; -} - -static void gravatmpf(const struct userinfostruct *uinfo,const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache) -{ - FILE *fp_ou; - char wdirname[MAXLEN]; - - if(indexonly || (ReportType & REPORT_TYPE_USERS_SITES) == 0) return; - - if (snprintf(wdirname,sizeof(wdirname),"%s/%s.utmp",tmp,uinfo->filename)>=sizeof(wdirname)) { - debuga(_("Path too long %s/%s.utmp\n"),tmp,uinfo->filename); - exit(EXIT_FAILURE); - } - - if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){ - debuga(_("(report) Cannot open file %s\n"),wdirname); - exit(EXIT_FAILURE); - } - - /* - This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable - to print a long long int unless it is exactly 64-bits long. - */ - fprintf(fp_ou,"%"PRIu64"\t%"PRIu64"\t%s\t%s\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\n",(uint64_t)nacc,(uint64_t)nbytes,oldurl,oldmsg,(uint64_t)nelap,(uint64_t)incache,(uint64_t)oucache); - if (fclose(fp_ou)==EOF) { debuga(_("Failed to close file %s - %s\n"),wdirname,strerror(errno)); exit(EXIT_FAILURE); @@ -528,7 +492,7 @@ static void gravatmpf(const struct userinfostruct *uinfo,const char *oldurl, lon ttopen=0; if(fp_tt) { - fputs("\n",fp_tt); + fputs("\n\n",fp_tt); fputs("\n\n",fp_tt); fclose(fp_tt); fp_tt=NULL; @@ -537,7 +501,6 @@ static void gravatmpf(const struct userinfostruct *uinfo,const char *oldurl, lon return; } - static void gravatmp_hora(const char *dirname, const struct userinfostruct *uinfo, const char *data, const char *hora, long long int elap, long long int bytes, int indexonly) { -- 2.47.2