openbsd-ports/www/sarg/patches/patch-convlog_c
aanriot 87ee110593 - use log files paths accordingly to www/squid.
- fix SYSCONFDIR and other substitutions.

from maintainer Douglas Santos with a few changes;
inputs and ok alek@
2006-01-28 21:22:07 +00:00

32 lines
1.0 KiB
Plaintext

--- convlog.c.orig Tue Nov 29 17:39:45 2005
+++ convlog.c Thu Jan 26 21:31:44 2006
@@ -39,7 +39,7 @@ void convlog(char *arq, char *df, int df
struct tm *t;
if(arq[0] == '\0')
- strcpy(arq,"/usr/local/squid/logs/access.log");
+ strcpy(arq,"/var/squid/logs/access.log");
if((fp_in=fopen(arq,"r"))==NULL) {
fprintf(stderr, "SARG: (convlog) %s: %s\n",text[8],arq);
@@ -52,16 +52,16 @@ void convlog(char *arq, char *df, int df
t=localtime(&tt);
if(dfrom) {
- strftime(wdata, 127, "%Y%m%d", t);
+ strftime(wdata, sizeof(wdata), "%Y%m%d", t);
idata=atoi(wdata);
if(idata < dfrom || idata > duntil)
continue;
}
if(strncmp(df,"e",1) == 0)
- strftime(dia, 127, "%d/%m/%Y", t);
+ strftime(dia, sizeof(dia), "%d/%m/%Y", t);
else
- strftime(dia, 127, "%m/%d/%Y", t);
+ strftime(dia, sizeof(dia), "%m/%d/%Y", t);
sprintf(hora,"%02d:%02d:%02d",t->tm_hour,t->tm_min,t->tm_sec);
printf("%s %s %s",dia,hora,buf);