/*
* SARG Squid Analysis Report Generator http://sarg.sourceforge.net
- * 1998, 2012
+ * 1998, 2015
*
* SARG donations:
* please look at http://sarg.sourceforge.net/donations.php
#include "include/conf.h"
#include "include/defs.h"
+#include "include/readlog.h"
/*!
Maximum number of columns accepted in an extended log format.
col=0;
while (*columns) {
if (col>=MAX_EXT_COLUMNS) {
- debuga(_("Too many columns found in an extended log format. The maximum allowed is %d but it can be changed if a bigger value is legitimate\n"),MAX_EXT_COLUMNS);
+ debuga(__FILE__,__LINE__,_("Too many columns found in an extended log format. The maximum allowed is %d but it can be changed if a bigger value is legitimate\n"),MAX_EXT_COLUMNS);
exit(EXIT_FAILURE);
}
prefix=-1;
}
}
}
+ (void)prefix;//compiler pacifier
if (i<0) len=0;
for ( ; (unsigned char)columns[len]>' ' ; len++) {//skip a word and accept any separator (tab or space)
if (header_start>=0 && columns[len]==')') header_end=len;
}
+ (void)header_end;//compiler pacifier
col_sep=columns[len];
ExtColSep[col]=col_sep;
columns+=len;
while (*columns && (unsigned char)*columns<=' ') {
if (*columns!=col_sep) {
- debuga(_("Multiple column separators found between two columns in the \"fields\" directive of an extended log format\n"));
+ debuga(__FILE__,__LINE__,_("Multiple column separators found between two columns in the \"fields\" directive of an extended log format\n"));
exit(EXIT_FAILURE);
}
columns++;
++Line;
}
Date->tm_year=year-1900;
- Date->tm_mon=month;
+ Date->tm_mon=month-1;
Date->tm_mday=day;
return(Line);
}
{
int col;
enum ext_col_id col_id;
+ char *Ip=NULL;
char *IpEnd;
+ char *User=NULL;
char *UserEnd;
char *UrlEnd;
char *HttpCodeEnd;
col=0;
while (*Line) {
if (col>=ExtColNumber) {
- debuga(_("Too many columns in an extended log file format: %d columns found when %d have been announced\n"),col,ExtColNumber);
+ debuga(__FILE__,__LINE__,_("Too many columns in an extended log file format: %d columns found when %d have been announced\n"),col,ExtColNumber);
return(RLRC_Unknown);
}
col_id=ExtLog_WhichColumn(col);
switch (col_id)
{
case EXTCOL_Ip:
- Entry->Ip=Line;
+ Entry->Ip=Ip=Line;
Line=ExtLog_GetString(Line,col,&IpEnd);
if (!Line) return(RLRC_Unknown);
break;
case EXTCOL_UserName:
- Entry->User=Line;
+ Entry->User=User=Line;
Line=ExtLog_GetString(Line,col,&UserEnd);
if (!Line) return(RLRC_Unknown);
break;
col++;
}
if (col!=ExtColNumber) {
- debuga(_("Only %d columns in an extended log file format when %d have been announced\n"),col,ExtColNumber);
+ debuga(__FILE__,__LINE__,_("Only %d columns in an extended log file format when %d have been announced\n"),col,ExtColNumber);
return(RLRC_Unknown);
}
// check the entry time
if (mktime(&Entry->EntryTime)==-1) {
- debuga(_("Invalid date or time found in the extended log file\n"));
+ debuga(__FILE__,__LINE__,_("Invalid date or time found in the extended log file\n"));
return(RLRC_InternalError);
}
- ExtLog_FixString(Entry->Ip,IpEnd);
- ExtLog_FixString(Entry->User,UserEnd);
+ ExtLog_FixString(Ip,IpEnd);
+ ExtLog_FixString(User,UserEnd);
ExtLog_FixString(Entry->Url,UrlEnd);
ExtLog_FixString(Entry->HttpCode,HttpCodeEnd);