summaryrefslogtreecommitdiff
path: root/www/sarg
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2007-10-16 19:16:33 +0000
committerRenato Botelho <garga@FreeBSD.org>2007-10-16 19:16:33 +0000
commit7c40ce57561532a3cecd847e6e44c3952d2b3009 (patch)
treeb299f23b6fea66da09e9ef4d3c8bf90ff0d497a1 /www/sarg
parentUpdate to 1.003001. (diff)
- Add a patch that fix a lot of compile warnings and some segmentation faults
on amd64 [1] - Add --enable-mandir to CONFIGURE_ARGS since --mandir is not enough and it was not respecting PREFIX to install man - Bump PORTREVISION Discussed with: Author in private email [1] Obtained from: https://sourceforge.net/tracker/index.php?func=detail&aid=1771501&group_id=68910&atid=522793 [1]
Notes
Notes: svn path=/head/; revision=201574
Diffstat (limited to 'www/sarg')
-rw-r--r--www/sarg/Makefile5
-rw-r--r--www/sarg/files/patch-fix-segfault-amd64932
-rw-r--r--www/sarg/files/patch-log.c11
3 files changed, 935 insertions, 13 deletions
diff --git a/www/sarg/Makefile b/www/sarg/Makefile
index 55f1b96323ae..857f0420341e 100644
--- a/www/sarg/Makefile
+++ b/www/sarg/Makefile
@@ -7,7 +7,7 @@
PORTNAME= sarg
PORTVERSION= 2.2.3.1
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= www
MASTER_SITES= SF
@@ -24,7 +24,8 @@ LDFLAGS+= -L${LOCALBASE}/lib
CONFIGURE_ENV= CC=gcc CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
CONFIGURE_ARGS= --enable-bindir="${PREFIX}/bin" \
--enable-sysconfdir="${PREFIX}/etc/${PORTNAME}" \
- --enable-htmldir="${PREFIX}/www/${PORTNAME}"
+ --enable-htmldir="${PREFIX}/www/${PORTNAME}" \
+ --enable-mandir="${MAN1PREFIX}/man/man1"
CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
MAN1= sarg.1
diff --git a/www/sarg/files/patch-fix-segfault-amd64 b/www/sarg/files/patch-fix-segfault-amd64
new file mode 100644
index 000000000000..d8358f2b8916
--- /dev/null
+++ b/www/sarg/files/patch-fix-segfault-amd64
@@ -0,0 +1,932 @@
+diff -Naur sarg-2.2.3.1.orig/auth.c sarg-2.2.3.1/auth.c
+--- sarg-2.2.3.1.orig/auth.c 2007-01-02 22:11:26.000000000 +0300
++++ auth.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,7 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
+
+ void htaccess(char *name)
+ {
+diff -Naur sarg-2.2.3.1.orig/authfail.c sarg-2.2.3.1/authfail.c
+--- sarg-2.2.3.1.orig/authfail.c 2007-01-02 22:11:26.000000000 +0300
++++ authfail.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,13 @@
+ */
+
+ #include "include/conf.h"
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++void getword(char *word, char *line, int stop);
++void fixip(char *ip);
++void ip2name(char *ip);
++char *subs(char *str, char *from, char *to);
++void show_info(FILE *fp_ou);
+
+ void authfail_report()
+ {
+diff -Naur sarg-2.2.3.1.orig/convlog.c sarg-2.2.3.1/convlog.c
+--- sarg-2.2.3.1.orig/convlog.c 2007-01-02 22:11:26.000000000 +0300
++++ convlog.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,7 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
+
+ void convlog(char *arq, char *df, int dfrom, int duntil)
+ {
+diff -Naur sarg-2.2.3.1.orig/css.c sarg-2.2.3.1/css.c
+--- sarg-2.2.3.1.orig/css.c 2007-01-02 22:11:26.000000000 +0300
++++ css.c 2007-08-10 16:18:40.000000000 +0400
+@@ -59,7 +59,7 @@
+ fprintf(fp_css,".data2 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
+ fprintf(fp_css,".data3 {font-family:%s;color:%s;font-size:%s;text-align:center;background-color:%s;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", FontFace, TxColor, FontSize, TxBgColor);
+ fprintf(fp_css,".data3 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;text-align:center;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
+- fprintf(fp_css,".text {font-family:%s;color:%s;font-size:%s;text-align:right;}\n", FontFace, TxColor, FontSize, TxBgColor);
++ fprintf(fp_css,".text {font-family:%s;color:%s;font-size:%s;text-align:right;background-color:%s;}\n", FontFace, TxColor, FontSize, TxBgColor);
+ fprintf(fp_css,".link {font-family:%s;font-size:%s;color:#0000FF;}\n", FontFace, FontSize);
+ fprintf(fp_css,".link a:link,a:visited {font-family:%s;font-size:%s;color:#0000FF;text-decoration:none;}\n</style>\n", FontFace, FontSize);
+ }
+diff -Naur sarg-2.2.3.1.orig/dansguardian_log.c sarg-2.2.3.1/dansguardian_log.c
+--- sarg-2.2.3.1.orig/dansguardian_log.c 2007-01-02 22:11:26.000000000 +0300
++++ dansguardian_log.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,8 +24,11 @@
+ */
+
+ #include "include/conf.h"
++void conv_month(char *month);
++void debuga(char *msg);
++void getword(char *word, char *line, int stop);
+
+-int dansguardian_log()
++void dansguardian_log()
+ {
+
+ FILE *fp_in = NULL, *fp_ou = NULL, *fp_guard = NULL;
+@@ -38,7 +41,6 @@
+ char ip[30];
+ char wdata[127];
+ int idata=0;
+- int x, y;
+
+ bzero(day, 3);
+ bzero(mon, 4);
+@@ -160,5 +162,4 @@
+ sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 '%s' -o '%s'",guard_in, guard_ou);
+ system(tmp6);
+ unlink(guard_in);
+- return;
+ }
+diff -Naur sarg-2.2.3.1.orig/dansguardian_report.c sarg-2.2.3.1/dansguardian_report.c
+--- sarg-2.2.3.1.orig/dansguardian_report.c 2007-01-02 22:11:26.000000000 +0300
++++ dansguardian_report.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,13 @@
+ */
+
+ #include "include/conf.h"
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++void getword(char *word, char *line, int stop);
++void fixip(char *ip);
++void ip2name(char *ip);
++char *subs(char *str, char *from, char *to);
++void show_info(FILE *fp_ou);
+
+ void dansguardian_report()
+ {
+@@ -31,10 +38,8 @@
+ FILE *fp_in = NULL, *fp_ou = NULL;
+
+ char url[MAXLEN];
+- char html[MAXLEN];
+ char html2[MAXLEN];
+ char dansguardian_in[MAXLEN];
+- char dansguardian_ou[MAXLEN];
+ char per[MAXLEN];
+ char report[MAXLEN];
+ char period[100];
+@@ -46,7 +51,6 @@
+ char date[15];
+ char date2[15];
+ char hour[15];
+- char ftime[128];
+ char *str;
+ int z=0;
+ int count=0;
+diff -Naur sarg-2.2.3.1.orig/datafile.c sarg-2.2.3.1/datafile.c
+--- sarg-2.2.3.1.orig/datafile.c 2007-01-02 22:11:26.000000000 +0300
++++ datafile.c 2007-08-10 16:18:40.000000000 +0400
+@@ -27,6 +27,12 @@
+
+ void saverecs(char *dirname, char *user, long long int nacc, char *url, long long int nbytes, char *ip, char *hora, char *dia, long long int nelap, long long int incache, long long int oucache);
+ void grava_SmartFilter(char *dirname, char *user, char *ip, char *data, char *hora, char *url, char *smart);
++void getword(char *word, char *line, int stop);
++void ip2name(char *ip);
++void gravatmp(char *oldaccuser, char *dirname, char *oldurl, long long int nacc, long long int nbytes, char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache);
++void debuga(char *msg);
++void my_lltoa(unsigned long long int n, char s[], int len);
++void name2ip(char *name);
+
+ void data_file(char *tmp)
+ {
+@@ -70,7 +76,6 @@
+ exit(1);
+ }
+ strcpy(wdname,direntp->d_name);
+- strip_prefix:
+ getword(wname2,wdname,'.');
+ strcat(user,wname2);
+
+diff -Naur sarg-2.2.3.1.orig/decomp.c sarg-2.2.3.1/decomp.c
+--- sarg-2.2.3.1.orig/decomp.c 2007-01-02 22:11:26.000000000 +0300
++++ decomp.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,7 @@
+ */
+
+ #include "include/conf.h"
++void debuga(char *msg);
+
+ void decomp(char *arq, char *zip, char *tmp)
+ {
+diff -Naur sarg-2.2.3.1.orig/denied.c sarg-2.2.3.1/denied.c
+--- sarg-2.2.3.1.orig/denied.c 2007-01-02 22:11:26.000000000 +0300
++++ denied.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,13 @@
+ */
+
+ #include "include/conf.h"
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++void getword(char *word, char *line, int stop);
++void fixip(char *ip);
++void ip2name(char *ip);
++char *subs(char *str, char *from, char *to);
++void show_info(FILE *fp_ou);
+
+ void gen_denied_report()
+ {
+diff -Naur sarg-2.2.3.1.orig/download.c sarg-2.2.3.1/download.c
+--- sarg-2.2.3.1.orig/download.c 2007-01-02 22:11:26.000000000 +0300
++++ download.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,13 @@
+ */
+
+ #include "include/conf.h"
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++void getword(char *word, char *line, int stop);
++void fixip(char *ip);
++void ip2name(char *ip);
++char *subs(char *str, char *from, char *to);
++void show_info(FILE *fp_ou);
+
+ void download_report()
+ {
+diff -Naur sarg-2.2.3.1.orig/email.c sarg-2.2.3.1/email.c
+--- sarg-2.2.3.1.orig/email.c 2007-01-02 22:11:26.000000000 +0300
++++ email.c 2007-08-10 16:18:40.000000000 +0400
+@@ -25,6 +25,11 @@
+
+ #include "include/conf.h"
+
++char *fixnum(long long int value, int n);
++char *buildtime(long long int elap);
++void strip_latin(char *line);
++void fixip(char *ip);
++
+ int geramail(const char *dirname, int debug, const char *outdir, int userip, char *email, char *TempDir)
+ {
+
+diff -Naur sarg-2.2.3.1.orig/exclude.c sarg-2.2.3.1/exclude.c
+--- sarg-2.2.3.1.orig/exclude.c 2007-01-02 22:11:26.000000000 +0300
++++ exclude.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,7 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
+
+ int vhexclude(char *excludefile, char *url)
+ {
+@@ -34,12 +35,12 @@
+ int len = strlen(excludefile);
+
+ if((str=(char *) malloc(len+1))==NULL) {
+- fprintf(stderr, "SARG: %s (%ld):\n",text[59], len);
++ fprintf(stderr, "SARG: %s (%d):\n",text[59], len);
+ exit(1);
+ }
+ len = strlen(url);
+ if((wurl=(char *) malloc(len+1))==NULL) {
+- fprintf(stderr, "SARG: %s (%ld):\n",text[59], len);
++ fprintf(stderr, "SARG: %s (%d):\n",text[59], len);
+ exit(1);
+ }
+ whost[0]='\0';
+diff -Naur sarg-2.2.3.1.orig/getconf.c sarg-2.2.3.1/getconf.c
+--- sarg-2.2.3.1.orig/getconf.c 2007-01-02 22:11:26.000000000 +0300
++++ getconf.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,11 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
++void fixnone(char *str);
++void ccharset();
++void debuga(char *msg);
++void language_load(char *language);
+
+ extern numlist hours, weekdays;
+
+diff -Naur sarg-2.2.3.1.orig/grepday.c sarg-2.2.3.1/grepday.c
+--- sarg-2.2.3.1.orig/grepday.c 2007-01-02 22:11:26.000000000 +0300
++++ grepday.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,6 +24,11 @@
+ */
+
+ #include "include/conf.h"
++char *fixnum(long long int value, int n);
++char *subs(char *str, char *from, char *to);
++void fixip(char *ip);
++void ip2name(char *ip);
++void getword(char *word, char *line, int stop);
+
+ int blue;
+ int white;
+diff -Naur sarg-2.2.3.1.orig/html.c sarg-2.2.3.1/html.c
+--- sarg-2.2.3.1.orig/html.c 2007-01-02 22:11:26.000000000 +0300
++++ html.c 2007-08-10 16:18:40.000000000 +0400
+@@ -24,30 +24,45 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
++void report_day(char *user, int *iprel, int *ipuser);
++void greport_day(char *user, int *iprel, int *ipuser);
++void fixip(char *ip);
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++void ip2name(char *ip);
++char *subs(char *str, char *from, char *to);
++void debuga(char *msg);
++char *fixnum(long long int value, int n);
++char *fixnum2(long long int value, int n);
++void url_module(char *url, char *w2);
++char *buildtime(long long int elap);
++void my_lltoa(unsigned long long int n, char s[], int len);
++void show_info(FILE *fp_ou);
++void htaccess(char *name);
+
+ void htmlrel()
+ {
+ DIR *dirp;
+- FILE *fp_in, *fp_ou, *fp_ip, *fp_ip2, *fp_usr, *fp_tt;
++ FILE *fp_in, *fp_ou, *fp_ip, *fp_ip2, *fp_usr;
+
+ struct dirent *direntp;
+ long long int nnbytes=0, unbytes=0, tnbytes=0, totbytes=0, totbytes2=0;
+ long long int totelap=0, totelap2=0, nnelap=0, unelap=0, tnelap=0;
+ long long int incache=0, oucache=0, tnincache=0, tnoucache=0, twork=0, twork2=0;
+ char arqin[MAXLEN], arqou[MAXLEN], arqper[MAXLEN], arqip[MAXLEN];
+- char nacc[20], nbytes[20], url[1024], purl[1024], tmsg[50], tmsg2[50], nelap[20], csort[MAXLEN];
++ char nacc[20], nbytes[20], url[1024], tmsg[50], nelap[20], csort[MAXLEN];
+ char period[MAXLEN], usuario[MAXLEN], wusuario[MAXLEN], u2[MAXLEN], duser[MAXLEN];
+ char userbytes[20], userelap[20], userurl[1024], userhora[9], userdia[9];
+ char user_ip[MAXLEN], olduserip[MAXLEN], tmp2[MAXLEN], tmp3[MAXLEN], incac[20], oucac[20];
+ char denied_report[255], name2[MAXLEN];
+- char ttd1[3], ttd2[3], ttd3[5], ttt1[3], ttt2[3], ttt3[3];
+ char *str;
+- char ftime[128], warea[MAXLEN];
++ char warea[MAXLEN];
+ char wtemp[MAXLEN], totuser[8];
+ long long int tnacc=0, ttnacc=0, unacc=0;
+ float perc=0, perc2=0, ouperc=0, inperc=0;
+ char *s;
+- int x, count;
++ int count;
+
+ if(strstr(ReportType,"users_sites") == 0) return;
+
+diff -Naur sarg-2.2.3.1.orig/include/conf.h sarg-2.2.3.1/include/conf.h
+--- sarg-2.2.3.1.orig/include/conf.h 2007-01-02 22:11:26.000000000 +0300
++++ include/conf.h 2007-08-10 16:18:44.000000000 +0400
+@@ -118,7 +118,7 @@
+ char df[20];
+ char day[3], month[4], year[5];
+ char nmonth[30];
+-char y1[5], y2[5];
++char Y1[5], Y2[5];
+ char d1[3], d2[3];
+ char m1[4], m2[4];
+ char ltext110[50];
+diff -Naur sarg-2.2.3.1.orig/index.c sarg-2.2.3.1/index.c
+--- sarg-2.2.3.1.orig/index.c 2007-01-02 22:11:26.000000000 +0300
++++ index.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,21 @@
+ */
+
+ #include "include/conf.h"
++void mklastlog();
++void debuga(char *msg);
++void conv_month(char *month);
++void getword(char *word, char *line, int stop);
++void conv_month_name(char *month);
++char* get_size(char *path, char *file);
++void obtdate(char *dirname, char *name, char *data);
++void obtuser(char *dirname, char *name, char *tuser);
++void obttotal(char *dirname, char *name, char *tbytes, char *tuser, char *media);
++void buildymd(char *dia, char *mes, char *ano, char *wdata);
++void write_html_header(FILE *fp_ou, char * ind);
++void name_month(char *month);
++void write_html_trailer(FILE *fp_ou);
++void zdate(char *ftime, char *DateFormat);
++void show_info(FILE *fp_ou);
+
+ void make_index()
+ {
+@@ -69,31 +84,31 @@
+ if(strcmp(IndexTree,"date") == 0) {
+ if(!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1])) continue;
+ if(strlen(direntp->d_name) > 4) {
+- bzero(y1,5);
+- bzero(y2,5);
++ bzero(Y1,5);
++ bzero(Y2,5);
+ bzero(m1,4);
+ bzero(m2,4);
+ bzero(d1,3);
+ bzero(d2,3);
+ if(strcmp(df,"u") == 0) {
+- strncpy(y1,direntp->d_name,4);
++ strncpy(Y1,direntp->d_name,4);
+ strncpy(m1,direntp->d_name+4,3);
+ strncpy(d1,direntp->d_name+7,2);
+- strncpy(y2,direntp->d_name+10,4);
++ strncpy(Y2,direntp->d_name+10,4);
+ strncpy(m2,direntp->d_name+14,3);
+ strncpy(d2,direntp->d_name+17,2);
+ } else if(strcmp(df,"e") == 0) {
+- strncpy(y1,direntp->d_name+5,4);
++ strncpy(Y1,direntp->d_name+5,4);
+ strncpy(m1,direntp->d_name+2,3);
+ strncpy(d1,direntp->d_name,2);
+- strncpy(y2,direntp->d_name+15,4);
++ strncpy(Y2,direntp->d_name+15,4);
+ strncpy(m2,direntp->d_name+12,3);
+ strncpy(d2,direntp->d_name+10,2);
+ }
+ conv_month(m1);
+ conv_month(m2);
+ }
+- sprintf(val1,"%s%s",outdir,y1);
++ sprintf(val1,"%s%s",outdir,Y1);
+ if(access(val1, R_OK) != 0) mkdir(val1,0755);
+ if(strcmp(m1,m2) != 0) sprintf(val2,"%s/%s-%s",val1,m1,m2);
+ else sprintf(val2,"%s/%s",val1,m1);
+@@ -110,7 +125,7 @@
+ } else {
+ if(!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1])) continue;
+ if(strlen(direntp->d_name) == 4) {
+- strcpy(y1,direntp->d_name);
++ strcpy(Y1,direntp->d_name);
+ sprintf(val1,"%s%s",outdir,direntp->d_name);
+ dirp2 = opendir(val1);
+ while ((direntp2 = readdir( dirp2 )) != NULL) {
+@@ -139,9 +154,9 @@
+ strcpy(d1,warea);
+ strcpy(d2,warea);
+ }
+- if(strcmp(df,"u") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,y1,m1,d1,y1,m2,d2);
+- else if(strcmp(df,"e") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,d1,m1,y1,d2,m2,y1);
+- sprintf(val5,"%s%s/%s/%s",outdir,y1,direntp2->d_name,direntp3->d_name);
++ if(strcmp(df,"u") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,Y1,m1,d1,Y1,m2,d2);
++ else if(strcmp(df,"e") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,d1,m1,Y1,d2,m2,Y1);
++ sprintf(val5,"%s%s/%s/%s",outdir,Y1,direntp2->d_name,direntp3->d_name);
+ if(rename(val5,val4)) {
+ fprintf(stderr, "SARG: (index) rename error - %s\n",strerror(errno));
+ exit(1);
+diff -Naur sarg-2.2.3.1.orig/ip2name.c sarg-2.2.3.1/ip2name.c
+--- sarg-2.2.3.1.orig/ip2name.c 2007-01-02 22:11:26.000000000 +0300
++++ ip2name.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,7 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
+
+ void ip2name(char *ip)
+ {
+diff -Naur sarg-2.2.3.1.orig/language.c sarg-2.2.3.1/language.c
+--- sarg-2.2.3.1.orig/language.c 2007-01-02 22:11:26.000000000 +0300
++++ language.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,7 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
+
+ void language_load(char *language)
+ {
+diff -Naur sarg-2.2.3.1.orig/lastlog.c sarg-2.2.3.1/lastlog.c
+--- sarg-2.2.3.1.orig/lastlog.c 2007-01-02 22:11:26.000000000 +0300
++++ lastlog.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,8 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
++void debuga(char *msg);
+
+ void mklastlog()
+ {
+diff -Naur sarg-2.2.3.1.orig/log.c sarg-2.2.3.1/log.c
+--- sarg-2.2.3.1.orig/log.c 2007-01-02 22:11:26.000000000 +0300
++++ log.c 2007-08-10 16:18:44.000000000 +0400
+@@ -49,6 +49,36 @@
+
+ #define _FILE_OFFSET_BITS 64
+
++void language_load(char *language);
++void getword(char *word, char *line, int stop);
++void date_from(char *date, char *dfrom, char *duntil);
++void usage(char *prog);
++void version();
++void debuga(char *msg);
++void getconf();
++void realtime(void);
++char *subs(char *str, char *from, char *to);
++void convlog(char *arq, char *df, int dfrom, int duntil);
++void splitlog(char *arq, char *df, int dfrom, int duntil, char *convert);
++void load_excludecodes();
++void my_mkdir(char *name);
++void decomp(char *arq, char *zip, char *tmp);
++void getword3(char *word, char *line, int stop);
++void conv_month_name(char *month);
++int vercode(char *code);
++int testvaliduserchar(char *user);
++char *strlow(char *string);
++void builddia(char *dia, char *mes, char *ano, char *df, char *wdata);
++int vhexclude(char *excludefile, char *url);
++int vuexclude(char *excludeuser, char *user);
++void fixip(char *ip);
++void fixper(char *tbuf, char *period, char *duntil);
++void debugaz(char *head, char *msg);
++void sort_users_log(char *tmp, int debug);
++void data_file(char *tmp);
++void gerarel();
++void recomp(char *arq, char *zip);
++
+ int main(argc,argv)
+ int argc;
+ char *argv[];
+@@ -145,7 +175,7 @@
+ SquidGuardLogAlternate[0]='\0';
+ arq[0]='\0';
+
+- strcpy(AccessLog,"/usr/local/squid/var/logs/access.log");
++ strcpy(AccessLog,"/var/log/squid/access.log");
+ sprintf(ExcludeCodes,"%s/exclude_codes",SYSCONFDIR);
+ strcpy(GraphDaysBytesBarColor,"orange");
+ strcpy(BgColor,"#ffffff");
+@@ -160,7 +190,7 @@
+ strcpy(LogoTextColor,"#006699");
+ strcpy(FontSize,"9px");
+ strcpy(TempDir,"/tmp");
+- strcpy(OutputDir,"/var/www/html/squid-reports");
++ strcpy(OutputDir,"/var/www/localhost/htdocs/squid-reports");
+ strcpy(Ip2Name,"no");
+ strcpy(DateFormat,"u");
+ strcpy(OverwriteReport,"no");
+@@ -645,7 +675,7 @@
+ if (strlen(Ulimit) > 0) {
+ #if defined(RLIMIT_NOFILE)
+ getrlimit (RLIMIT_NOFILE, &rl);
+-#else #if defined(RLIMIT_OFILE)
++#elif defined(RLIMIT_OFILE)
+ getrlimit (RLIMIT_OFILE, &rl);
+ #endif
+ l1 = rl.rlim_cur;
+@@ -656,7 +686,7 @@
+ rl.rlim_max = atol(Ulimit);
+ #if defined(RLIMIT_NOFILE)
+ if(setrlimit (RLIMIT_NOFILE, &rl) == -1) {
+- #else #if defined(RLIMIT_OFILE)
++ #elif defined(RLIMIT_OFILE)
+ if(setrlimit (RLIMIT_OFILE, &rl) == -1) {
+ #endif
+ sprintf(msg,"setrlimit error - %s\n",strerror(errno));
+@@ -1216,7 +1246,7 @@
+
+ if(download_flag && strstr(code,"DENIED") == 0) {
+ ndownload = 1;
+- sprintf(bufz, "%s %s %s %s %s %s\n",dia,hora,user,ip,download_url);
++ sprintf(bufz, "%s %s %s %s %s\n",dia,hora,user,ip,download_url);
+
+ #ifdef LEGACY_WRITE_DOWNLOAD
+ sprintf(tmp3,"%s/sarg/download.unsort",tmp);
+@@ -1395,7 +1425,6 @@
+
+ sort_users_log(tmp, debug);
+
+- report_gen:
+ if(strlen(DataFile) > 0)
+ data_file(tmp);
+ else
+diff -Naur sarg-2.2.3.1.orig/realtime.c sarg-2.2.3.1/realtime.c
+--- sarg-2.2.3.1.orig/realtime.c 2007-01-02 22:11:26.000000000 +0300
++++ realtime.c 2007-08-10 16:18:44.000000000 +0400
+@@ -29,6 +29,12 @@
+ void datashow(char *);
+ void getlog();
+ void header();
++void getword(char *word, char *line, int stop);
++void debuga(char *msg);
++void getword3(char *word, char *line, int stop);
++void ip2name(char *ip);
++char *subs(char *str, char *from, char *to);
++void css(FILE *fp_css);
+
+ char dat[128];
+ char tim[128];
+@@ -37,7 +43,7 @@
+ char ourl[MAXLEN]="";
+
+ void
+-realtime(int argc, char *argv[])
++realtime(void)
+ {
+
+ getlog();
+diff -Naur sarg-2.2.3.1.orig/repday.c sarg-2.2.3.1/repday.c
+--- sarg-2.2.3.1.orig/repday.c 2007-01-02 22:11:26.000000000 +0300
++++ repday.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,14 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++void fixip(char *ip);
++void ip2name(char *ip);
++char *subs(char *str, char *from, char *to);
++char *fixtime(long int elap);
++void show_info(FILE *fp_ou);
+
+ extern numlist hours;
+
+diff -Naur sarg-2.2.3.1.orig/report.c sarg-2.2.3.1/report.c
+--- sarg-2.2.3.1.orig/report.c 2007-01-02 22:11:26.000000000 +0300
++++ report.c 2007-08-10 16:18:44.000000000 +0400
+@@ -25,6 +25,37 @@
+
+ #include "include/conf.h"
+ #include "include/defs.h"
++void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form);
++void debugaz(char *head, char *msg);
++void gperiod();
++void useragent();
++void getword(char *word, char *line, int stop);
++void ip2name(char *ip);
++void my_mkdir(char *name);
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++char *subs(char *str, char *from, char *to);
++void day_totalize(const char *tmp, char *user, int indexonly);
++void tmpsort();
++int totalger(const char *dirname, int debug, const char *outdir);
++void download_report();
++void dansguardian_log();
++void squidguard_log();
++void topuser();
++void topsites();
++void siteuser();
++void gen_denied_report();
++void authfail_report();
++void smartfilter_report();
++void dansguardian_report();
++void squidguard_report();
++void htmlrel();
++void make_index();
++int geramail(const char *dirname, int debug, const char *outdir, int userip, char *email, char *TempDir);
++void index_only();
++void removetmp(char *outdir);
++void debuga(char *msg);
++void my_lltoa(unsigned long long int n, char s[], int len);
+
+ void gerarel()
+ {
+diff -Naur sarg-2.2.3.1.orig/siteuser.c sarg-2.2.3.1/siteuser.c
+--- sarg-2.2.3.1.orig/siteuser.c 2007-01-02 22:11:26.000000000 +0300
++++ siteuser.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,15 @@
+ */
+
+ #include "include/conf.h"
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++char *strlow(char *string);
++void getword(char *word, char *line, int stop);
++void fixip(char *ip);
++char *subs(char *str, char *from, char *to);
++void ip2name(char *ip);
++char *fixnum(long long int value, int n);
++void show_info(FILE *fp_ou);
+
+ void siteuser()
+ {
+diff -Naur sarg-2.2.3.1.orig/smartfilter.c sarg-2.2.3.1/smartfilter.c
+--- sarg-2.2.3.1.orig/smartfilter.c 2007-01-02 22:11:26.000000000 +0300
++++ smartfilter.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,10 @@
+ */
+
+ #include "include/conf.h"
++char *strup(char *string);
++void getword(char *word, char *line, int stop);
++void fixip(char *ip);
++void zdate(char *ftime, char *DateFormat);
+
+ void smartfilter_report()
+ {
+diff -Naur sarg-2.2.3.1.orig/sort.c sarg-2.2.3.1/sort.c
+--- sarg-2.2.3.1.orig/sort.c 2007-01-02 22:11:26.000000000 +0300
++++ sort.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,10 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
++void debuga(char *msg);
++char *strup(char *string);
++char *strlow(char *string);
+
+ void tmpsort()
+ {
+diff -Naur sarg-2.2.3.1.orig/splitlog.c sarg-2.2.3.1/splitlog.c
+--- sarg-2.2.3.1.orig/splitlog.c 2007-01-02 22:11:26.000000000 +0300
++++ splitlog.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,7 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
+
+ void splitlog(char *arq, char *df, int dfrom, int duntil, char *convert)
+ {
+diff -Naur sarg-2.2.3.1.orig/squidguard_log.c sarg-2.2.3.1/squidguard_log.c
+--- sarg-2.2.3.1.orig/squidguard_log.c 2007-01-02 22:11:26.000000000 +0300
++++ squidguard_log.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,9 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
++void debuga(char *msg);
++void conv_month(char *month);
+
+ static char **files_done = NULL;
+ static int nfiles_done = 0;
+@@ -159,7 +162,7 @@
+ }
+
+
+-int squidguard_log()
++void squidguard_log()
+ {
+
+ FILE *fp_ou = NULL, *fp_guard = NULL;
+@@ -168,7 +171,6 @@
+ char logdir[MAXLEN];
+ char year[10], day[10], mon[10];
+ char user[MAXLEN];
+- char ip[30];
+ int x, y;
+
+ str2 = user;
+diff -Naur sarg-2.2.3.1.orig/squidguard_report.c sarg-2.2.3.1/squidguard_report.c
+--- sarg-2.2.3.1.orig/squidguard_report.c 2007-01-02 22:11:26.000000000 +0300
++++ squidguard_report.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,13 @@
+ */
+
+ #include "include/conf.h"
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++void getword(char *word, char *line, int stop);
++void fixip(char *ip);
++void ip2name(char *ip);
++char *subs(char *str, char *from, char *to);
++void show_info(FILE *fp_ou);
+
+ void squidguard_report()
+ {
+@@ -31,10 +38,8 @@
+ FILE *fp_in = NULL, *fp_ou = NULL;
+
+ char url[MAXLEN];
+- char html[MAXLEN];
+ char html2[MAXLEN];
+ char squidguard_in[MAXLEN];
+- char squidguard_ou[MAXLEN];
+ char per[MAXLEN];
+ char report[MAXLEN];
+ char period[100];
+@@ -46,7 +51,6 @@
+ char data[15];
+ char data2[15];
+ char hora[15];
+- char ftime[128];
+ char *str;
+ int z=0;
+ int count=0;
+diff -Naur sarg-2.2.3.1.orig/topsites.c sarg-2.2.3.1/topsites.c
+--- sarg-2.2.3.1.orig/topsites.c 2007-01-02 22:11:26.000000000 +0300
++++ topsites.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,14 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
++void my_lltoa(unsigned long long int n, char s[], int len);
++char *strlow(char *string);
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++char *fixnum(long long int value, int n);
++char *fixtime(long int elap);
++void show_info(FILE *fp_ou);
+
+ void topsites()
+ {
+@@ -216,7 +224,7 @@
+
+ sprintf(wwork1,"%s",fixnum(twork1,1));
+ sprintf(wwork2,"%s",fixnum(twork2,1));
+- sprintf(wwork3,"%s",fixtime(twork3,1));
++ sprintf(wwork3,"%s",fixtime(twork3));
+
+ if(strlen(BlockIt) > 0)
+ sprintf(BlockImage,"<a href=\"%s%s?url=%s\"><img src=\"../images/sarg-squidguard-block.png\" border=\"0\"></a>&nbsp;",wwwDocumentRoot,BlockIt,url);
+diff -Naur sarg-2.2.3.1.orig/topuser.c sarg-2.2.3.1/topuser.c
+--- sarg-2.2.3.1.orig/topuser.c 2007-01-02 22:11:26.000000000 +0300
++++ topuser.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,8 +24,20 @@
+ */
+
+ #include "include/conf.h"
++void my_lltoa(unsigned long long int n, char s[], int len);
++char *strup(char *string);
++char *strlow(char *string);
++void css(FILE *fp_css);
++void show_sarg(FILE *fp_ou, char *ind);
++void fixip(char *ip);
++void ip2name(char *ip);
++char *fixnum(long long int value, int n);
++char *fixnum2(long long int value, int n);
++char *buildtime(long long int elap);
++char *subs(char *str, char *from, char *to);
++void show_info(FILE *fp_ou);
+
+-int topuser()
++void topuser()
+ {
+
+ FILE *fp_in = NULL, *fp_ou = NULL, *fp_top1 = NULL, *fp_top2 = NULL, *fp_top3 = NULL;
+diff -Naur sarg-2.2.3.1.orig/totday.c sarg-2.2.3.1/totday.c
+--- sarg-2.2.3.1.orig/totday.c 2007-01-02 22:11:26.000000000 +0300
++++ totday.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,8 @@
+ */
+
+ #include "include/conf.h"
++void getword(char *word, char *line, int stop);
++void my_lltoa(unsigned long long int n, char s[], int len);
+
+ void day_totalize(const char *tmp, char *user, int indexonly)
+ {
+diff -Naur sarg-2.2.3.1.orig/totger.c sarg-2.2.3.1/totger.c
+--- sarg-2.2.3.1.orig/totger.c 2007-01-02 22:11:26.000000000 +0300
++++ totger.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,7 @@
+ */
+
+ #include "include/conf.h"
++void my_lltoa(unsigned long long int n, char s[], int len);
+
+ int totalger(const char *dirname, int debug, const char *outdir)
+
+diff -Naur sarg-2.2.3.1.orig/useragent.c sarg-2.2.3.1/useragent.c
+--- sarg-2.2.3.1.orig/useragent.c 2007-01-02 22:11:26.000000000 +0300
++++ useragent.c 2007-08-10 16:18:44.000000000 +0400
+@@ -24,6 +24,11 @@
+ */
+
+ #include "include/conf.h"
++void debuga(char *msg);
++void getword(char *word, char *line, int stop);
++void show_sarg(FILE *fp_ou, char *ind);
++void ip2name(char *ip);
++void zdate(char *ftime, char *DateFormat);
+
+ void useragent()
+ {
+diff -Naur sarg-2.2.3.1.orig/util.c sarg-2.2.3.1/util.c
+--- sarg-2.2.3.1.orig/util.c 2007-08-10 16:19:32.000000000 +0400
++++ util.c 2007-08-10 16:18:44.000000000 +0400
+@@ -31,6 +31,8 @@
+ static char mtab1[12][4]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
+ static char mtab2[12][3]={"01","02","03","04","05","06","07","08","09","10","11","12"};
+
++void css(FILE *fp_css);
++
+ /*void fgetword(char *word, char *line, int stop)
+ {
+ //VARIANT N1
+@@ -57,7 +59,7 @@
+ {
+ int x = 0, y = 0;
+ int limit=10000;
+- char wline[MAXLEN];
++ //char wline[MAXLEN];
+
+ //strcpy(wline,line);
+
+@@ -510,7 +512,6 @@
+ static char ret[MAXIMO * 2];
+ char *pret;
+ register int i, j, k;
+- static char abbrev[30];
+
+ my_lltoa(value, num, 0);
+ bzero(buf, MAXIMO*2);
+@@ -719,15 +720,15 @@
+ struct dirent *direntp;
+
+ if(strcmp(IndexTree,"date") == 0) {
+- bzero(y1,5);
+- bzero(y2,5);
++ bzero(Y1,5);
++ bzero(Y2,5);
+ bzero(d1,3);
+ bzero(d2,3);
+ bzero(m1,4);
+ bzero(m2,4);
+ if(strncmp(df,"u",1) == 0) {
+- strncpy(y1,period,4);
+- strncpy(y2,period+10,4);
++ strncpy(Y1,period,4);
++ strncpy(Y2,period+10,4);
+ strncpy(m1,period+4,3);
+ strncpy(m2,period+14,3);
+ strncpy(d1,period+7,2);
+@@ -737,16 +738,16 @@
+ strncpy(d2,period+10,2);
+ strncpy(m1,period+2,3);
+ strncpy(m2,period+12,3);
+- strncpy(y1,period+5,4);
+- strncpy(y2,period+15,4);
++ strncpy(Y1,period+5,4);
++ strncpy(Y2,period+15,4);
+ }
+ conv_month(m1);
+ conv_month(m2);
+
+- sprintf(wdir,"%s%s",outdir,y1);
+- if(strcmp(y1,y2) != 0) {
++ sprintf(wdir,"%s%s",outdir,Y1);
++ if(strcmp(Y1,Y2) != 0) {
+ strncat(wdir,"-",1);
+- strncat(wdir,y2,strlen(y2));
++ strncat(wdir,Y2,strlen(Y2));
+ }
+ if(access(wdir, R_OK) != 0)
+ my_mkdir(wdir);
+@@ -1234,7 +1235,7 @@
+ if(strcmp(ShowSargLogo,"yes") == 0) fprintf(fp_ou,"<center><table cellpadding=0 cellspacing=0>\n<tr><th class=\"logo\"><a href=\"http://sarg.sourceforge.net\"><img src=\"%s/images/sarg.png\" border=\"0\" align=\"absmiddle\" title=\"SARG, Squid Analysis Report Generator. Logo by Osamu Matsuzaki\"></a>&nbsp;<font class=\"logo\">Squid Analysis Report Generator</font></th></tr>\n<tr><th class=\"title\">&nbsp</th></tr>\n<table>\n",ind);
+ }
+
+-get_size(char *path, char *file)
++char* get_size(char *path, char *file)
+ {
+ FILE *fp;
+ char response[255];
+@@ -1260,7 +1261,7 @@
+ }
+
+
+-char url_module(char *url, char *w2)
++void url_module(char *url, char *w2)
+ {
+ int x, y;
+ char w[255];
+@@ -1279,8 +1280,6 @@
+ w2[y]=w[x];
+ y++;
+ }
+-
+- return;
+ }
+
+
diff --git a/www/sarg/files/patch-log.c b/www/sarg/files/patch-log.c
deleted file mode 100644
index 4f2b853d3c20..000000000000
--- a/www/sarg/files/patch-log.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- log.c 2007-01-02 17:11:26.000000000 -0200
-+++ new/log.c 2007-01-29 17:19:17.000000000 -0200
-@@ -1216,7 +1216,7 @@
-
- if(download_flag && strstr(code,"DENIED") == 0) {
- ndownload = 1;
-- sprintf(bufz, "%s %s %s %s %s %s\n",dia,hora,user,ip,download_url);
-+ sprintf(bufz, "%s %s %s %s %s\n",dia,hora,user,ip,download_url);
-
- #ifdef LEGACY_WRITE_DOWNLOAD
- sprintf(tmp3,"%s/sarg/download.unsort",tmp);