sarg  2.4.0
About: SARG ia a Squid Analysis Report Generator.
  Fossies Dox: sarg-2.4.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

useragent.c
Go to the documentation of this file.
1 /*
2  * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
3  * 1998, 2015
4  *
5  * SARG donations:
6  * please look at http://sarg.sourceforge.net/donations.php
7  * Support:
8  * http://sourceforge.net/projects/sarg/forums/forum/363374
9  * ---------------------------------------------------------------------
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
24  *
25  */
26 
27 #include "include/conf.h"
28 #include "include/defs.h"
29 #include "include/filelist.h"
30 
32 
34 static char UserAgentTempLog[MAXLEN]="";
35 
36 static struct tm UserAgentStartDate;
37 static struct tm UserAgentEndDate;
38 
46 FILE *UserAgent_Open(void)
47 {
48  FILE *fp_ou=NULL;
49 
50  if (UserAgentTempLog[0]) {
51  debuga(__FILE__,__LINE__,_("Useragent log already opened\n"));
52  exit(EXIT_FAILURE);
53  }
54  if ((ReportType & REPORT_TYPE_USERAGENT)!=0) {
55  format_path(__FILE__, __LINE__, UserAgentTempLog, sizeof(UserAgentTempLog), "%s/squagent.int_unsort", tmp);
56  if ((fp_ou=fopen(UserAgentTempLog,"w"))==NULL) {
57  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),UserAgentTempLog,strerror(errno));
58  exit(EXIT_FAILURE);
59  }
60  memset(&UserAgentStartDate,0,sizeof(UserAgentStartDate));
61  memset(&UserAgentEndDate,0,sizeof(UserAgentEndDate));
62  }
63  return(fp_ou);
64 }
65 
74 void UserAgent_Write(FILE *fp,const struct tm *Time,const char *Ip,const char *User,const char *Agent)
75 {
76  if (fp) {
78  memcpy(&UserAgentStartDate,Time,sizeof(UserAgentStartDate));
80  memcpy(&UserAgentEndDate,Time,sizeof(UserAgentEndDate));
81  fprintf(fp,"%s\t%s\t%s\n",Ip,Agent,User);
83  }
84 }
85 
91 {
93  FILE *fp_ou = NULL;
94  char *ptr;
95  char ip[80], data[50], agent[MAXLEN], user[MAXLEN];
96  int day,month,year;
97  char monthname[5];
98  int hour,min;
99  const char *FileName;
100  unsigned long totregsl=0;
101  int ndate;
102  struct getwordstruct gwarea, gwarea1;
103  longline line;
104  FileListIterator FIter;
105  struct tm logtime;
106  int dfrom;
107  int duntil;
108 
109  fp_ou=UserAgent_Open();
110 
111  if ((line=longline_create())==NULL) {
112  debuga(__FILE__,__LINE__,_("Not enough memory to read useragent log\n"));
113  exit(EXIT_FAILURE);
114  }
115  memset(&logtime,0,sizeof(logtime));
116  getperiod_torange(&period,&dfrom,&duntil);
117 
119  while ((FileName=FileListIter_Next(FIter))!=NULL)
120  {
121  longline_reset(line);
122  if ((fp_log=decomp(FileName))==NULL) {
123  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),FileName,FileObject_GetLastOpenError());
124  exit(EXIT_FAILURE);
125  }
126 
127  if (debug) {
128  debuga(__FILE__,__LINE__,_("Reading useragent log \"%s\"\n"),FileName);
129  }
130 
131  while ((ptr=longline_read(fp_log,line))!=NULL) {
132  totregsl++;
133  getword_start(&gwarea,ptr);
134  if (getword(ip,sizeof(ip),&gwarea,' ')<0 || getword_skip(10,&gwarea,'[')<0 ||
135  getword(data,sizeof(data),&gwarea,' ')<0) {
136  debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),FileName);
137  exit(EXIT_FAILURE);
138  }
139  getword_start(&gwarea1,data);
140  if (getword_atoi(&day,&gwarea1,'/')<0 || getword(monthname,sizeof(monthname),&gwarea1,'/')<0 ||
141  getword_atoi(&year,&gwarea1,':')<0) {
142  debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),FileName);
143  exit(EXIT_FAILURE);
144  }
145  month=month2num(monthname)+1;
146  if (month>12) {
147  debuga(__FILE__,__LINE__,_("Invalid month name \"%s\" found in user agent file \"%s\""),monthname,FileName);
148  exit(EXIT_FAILURE);
149  }
150  if (dfrom!=0 || duntil!=0){
151  ndate=year*10000+month*100+day;
152  if (ndate<dfrom) continue;
153  if (ndate>duntil) break;
154  }
155  if (getword_atoi(&hour,&gwarea1,':')<0 || getword_atoi(&min,&gwarea1,':')<0) {
156  debuga(__FILE__,__LINE__,_("Invalid time in file \"%s\"\n"),FileName);
157  exit(EXIT_FAILURE);
158  }
159  if (ReadFilter->StartTime>=0 || ReadFilter->EndTime>=0)
160  {
161  int hmr=hour*100+min;
162  if (hmr<ReadFilter->StartTime || hmr>=ReadFilter->EndTime)
163  continue;
164  }
165  logtime.tm_year=year-1900;
166  logtime.tm_mon=month-1;
167  logtime.tm_mday=day;
168  if (getword_skip(MAXLEN,&gwarea,'"')<0 || getword(agent,sizeof(agent),&gwarea,'"')<0) {
169  debuga(__FILE__,__LINE__,_("Invalid useragent in file \"%s\"\n"),FileName);
170  exit(EXIT_FAILURE);
171  }
172 
173  if (gwarea.current[0]!='\0') {
174  if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword(user,sizeof(user),&gwarea,'\n')<0) {
175  debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),FileName);
176  exit(EXIT_FAILURE);
177  }
178  if (user[0] == '-')
179  strcpy(user,ip);
180  if (user[0] == '\0')
181  strcpy(user,ip);
182  } else {
183  strcpy(user,ip);
184  }
185 
186  UserAgent_Write(fp_ou,&logtime,ip,user,agent);
187  }
188 
189  if (FileObject_Close(fp_log)==EOF) {
190  debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),FileName,FileObject_GetLastCloseError());
191  exit(EXIT_FAILURE);
192  }
193  }
194  FileListIter_Close(FIter);
195  longline_destroy(&line);
196 
197  if (debug) {
198  debuga(__FILE__,__LINE__,_(" Records read: %ld\n"),totregsl);
199  }
200 
201  if (fclose(fp_ou)==EOF) {
202  debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),UserAgentTempLog,strerror(errno));
203  exit(EXIT_FAILURE);
204  }
205 }
206 
207 void UserAgent(void)
208 {
209  FILE *fp_in = NULL, *fp_ou = NULL, *fp_ht = NULL;
210  char buf[MAXLEN];
211  char ip[80], agent[MAXLEN], user[MAXLEN];
212  char ipbefore[MAXLEN]="";
213  char namebefore[MAXLEN]="";
214  char tagent[MAXLEN];
215  char user_old[MAXLEN]="";
216  char agent_old[MAXLEN]="";
217  char hfile[MAXLEN];
218  char idate[100], fdate[100];
219  char tmp2[MAXLEN];
220  char tmp3[MAXLEN];
221  char csort[MAXLEN];
222  int agentot=0, agentot2=0, agentdif=0, cont=0, nagent;
223  int cstatus;
224  double perc;
225  struct getwordstruct gwarea;
226 
227  if (!UserAgentTempLog[0] || useragent_count==0) return;
228 
229  format_path(__FILE__, __LINE__, tmp2, sizeof(tmp2), "%s/squagent.int_log", tmp);
230  if (debug) {
231  debuga(__FILE__,__LINE__,_("Sorting file \"%s\"\n"),tmp2);
232  }
233 
234  if (snprintf(csort,sizeof(csort),"sort -n -t \"\t\" -k 3,3 -k 2,2 -k 1,1 -o \"%s\" \"%s\"",tmp2,UserAgentTempLog)>=sizeof(csort)) {
235  debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,UserAgentTempLog);
236  exit(EXIT_FAILURE);
237  }
238  cstatus=system(csort);
239  if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
240  debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEXITSTATUS(cstatus));
241  debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
242  exit(EXIT_FAILURE);
243  }
244  if ((fp_in=fopen(tmp2,"r"))==NULL) {
245  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp2,strerror(errno));
246  debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
247  exit(EXIT_FAILURE);
248  }
249 
250  if (!KeepTempLog && unlink(UserAgentTempLog)) {
251  debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),UserAgentTempLog,strerror(errno));
252  exit(EXIT_FAILURE);
253  }
254 
255  format_path(__FILE__, __LINE__, hfile, sizeof(hfile), "%s/useragent.html", outdirname);
256  if ((fp_ht=fopen(hfile,"w"))==NULL) {
257  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),hfile,strerror(errno));
258  exit(EXIT_FAILURE);
259  }
260 
261  if (debug)
262  debuga(__FILE__,__LINE__,_("Making Useragent report\n"));
263 
264  write_html_header(fp_ht,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Squid Useragent's Report"),HTML_JS_NONE);
265  fprintf(fp_ht,"<tr><th class=\"header_c\">%s</th></tr>\n",_("Squid Useragent's Report"));
266  strftime(idate,sizeof(idate),"%x",&UserAgentStartDate);
267  strftime(fdate,sizeof(fdate),"%x",&UserAgentEndDate);
268  fprintf(fp_ht,"<tr><td class=\"header_c\">%s: %s - %s</td></tr>\n",_("Period"),idate,fdate);
269  close_html_header(fp_ht);
270 
271  fputs("<br><br>\n",fp_ht);
272 
273  fputs("<div class=\"report\"><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ht);
274  fputs("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>",fp_ht);
275 
276  fprintf(fp_ht,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",_("USERID"),_("AGENT"));
277 
278  while (fgets(buf,sizeof(buf),fp_in)!=NULL) {
279  getword_start(&gwarea,buf);
280  if (getword(ip,sizeof(ip),&gwarea,'\t')<0) {
281  debuga(__FILE__,__LINE__,_("Invalid IP address in file \"%s\"\n"),tmp2);
282  exit(EXIT_FAILURE);
283  }
284 
285  if (Ip2Name) {
286  if (strcmp(ip,ipbefore) != 0) {
287  strcpy(ipbefore,ip);
288  ip2name(ip,sizeof(ip));
289  strcpy(namebefore,ip);
290  } else strcpy(ip,namebefore);
291  }
292 
293  if (getword(agent,sizeof(agent),&gwarea,'\t')<0) {
294  debuga(__FILE__,__LINE__,_("Invalid useragent in file \"%s\"\n"),tmp2);
295  exit(EXIT_FAILURE);
296  }
297  if (getword(user,sizeof(user),&gwarea,'\t')<0) {
298  debuga(__FILE__,__LINE__,_("Invalid user ID in file \"%s\"\n"),tmp2);
299  exit(EXIT_FAILURE);
300  }
301 
302  if (strcmp(user,user_old) != 0) {
303  fprintf(fp_ht,"<tr><td class=\"data2\">%s</td><td class=\"data2\">",user);
304  output_html_string(fp_ht,agent,250);
305  fputs("</td></tr>\n",fp_ht);
306  strcpy(user_old,user);
307  strcpy(agent_old,agent);
308  } else if (strcmp(agent,agent_old) != 0) {
309  fputs("<tr><td></td><td class=\"data2\">",fp_ht);
310  output_html_string(fp_ht,agent,250);
311  fputs("</td></tr>\n",fp_ht);
312  strcpy(agent_old,agent);
313  }
314  }
315 
316  fputs("</table>\n",fp_ht);
317  if (fclose(fp_in)==EOF) {
318  debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp2,strerror(errno));
319  exit(EXIT_FAILURE);
320  }
321 
322  format_path(__FILE__, __LINE__, tmp3, sizeof(tmp3), "%s/squagent2.int_log", tmp);
323  if (snprintf(csort,sizeof(csort),"sort -t \"\t\" -k 2,2 -o \"%s\" \"%s\"",tmp3,tmp2)>=sizeof(csort)) {
324  debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
325  exit(EXIT_FAILURE);
326  }
327  cstatus=system(csort);
328  if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
329  debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEXITSTATUS(cstatus));
330  debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
331  exit(EXIT_FAILURE);
332  }
333  if ((fp_in=fopen(tmp3,"r"))==NULL) {
334  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
335  debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
336  exit(EXIT_FAILURE);
337  }
338 
339  if (!KeepTempLog && unlink(tmp2)) {
340  debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp2,strerror(errno));
341  exit(EXIT_FAILURE);
342  }
343 
344  if ((fp_ou=fopen(tmp2,"w"))==NULL) {
345  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp2,strerror(errno));
346  exit(EXIT_FAILURE);
347  }
348 
349  agent_old[0]='\0';
350  cont=0;
351 
352  while (fgets(buf,sizeof(buf),fp_in)!=NULL) {
353  getword_start(&gwarea,buf);
354  if (getword(ip,sizeof(ip),&gwarea,'\t')<0) {
355  debuga(__FILE__,__LINE__,_("Invalid IP address in file \"%s\"\n"),tmp3);
356  exit(EXIT_FAILURE);
357  }
358  if (getword(agent,sizeof(agent),&gwarea,'\t')<0) {
359  debuga(__FILE__,__LINE__,_("Invalid useragent in file \"%s\"\n"),tmp3);
360  exit(EXIT_FAILURE);
361  }
362 
363  if (!cont) {
364  cont++;
365  strcpy(agent_old,agent);
366  }
367 
368  if (strcmp(agent,agent_old) != 0) {
369  agentdif++;
370  fprintf(fp_ou,"%06d %s\n",agentot,agent_old);
371  strcpy(agent_old,agent);
372  agentot2+=agentot;
373  agentot=0;
374  }
375  agentot++;
376  }
377  agentdif++;
378  fprintf(fp_ou,"%06d %s\n",agentot,agent);
379  agentot2+=agentot;
380 
381  if (fclose(fp_ou)==EOF) {
382  debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),tmp2,strerror(errno));
383  exit(EXIT_FAILURE);
384  }
385  if (fclose(fp_in)==EOF) {
386  debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
387  exit(EXIT_FAILURE);
388  }
389 
390  if (!KeepTempLog && unlink(tmp3)) {
391  debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
392  exit(EXIT_FAILURE);
393  }
394 
395  if (snprintf(csort,sizeof(csort),"sort -n -r -k 1,1 -o \"%s\" \"%s\"",tmp3,tmp2)>=sizeof(csort)) {
396  debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
397  exit(EXIT_FAILURE);
398  }
399  cstatus=system(csort);
400  if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
401  debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEXITSTATUS(cstatus));
402  debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
403  exit(EXIT_FAILURE);
404  }
405  if ((fp_in=fopen(tmp3,"r"))==NULL) {
406  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
407  debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
408  exit(EXIT_FAILURE);
409  }
410 
411  if (!KeepTempLog && unlink(tmp2)) {
412  debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp2,strerror(errno));
413  exit(EXIT_FAILURE);
414  }
415 
416  fputs("<br><br>\n",fp_ht);
417 
418  fputs("<table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ht);
419  fprintf(fp_ht,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_c\">%%</th></tr>\n",_("AGENT"),_("TOTAL"));
420 
421  perc=0.;
422  while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
423  fixendofline(buf);
424  getword_start(&gwarea,buf);
425  if (getword(tagent,sizeof(tagent),&gwarea,' ')<0) {
426  debuga(__FILE__,__LINE__,_("Invalid useragent in file \"%s\"\n"),tmp3);
427  exit(EXIT_FAILURE);
428  }
429  nagent=atoi(tagent);
430  perc=(agentot2>0) ? nagent * 100. / agentot2 : 0.;
431 
432  fputs("<tr><td class=\"data2\">",fp_ht);
433  output_html_string(fp_ht,gwarea.current,250);
434  fprintf(fp_ht,"</td><td class=\"data\">%d</td><td class=\"data\">%3.2lf</td></tr>\n",nagent,perc);
435  }
436  if (fclose(fp_in)==EOF) {
437  debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
438  exit(EXIT_FAILURE);
439  }
440 
441  fputs("</table></div>\n",fp_ht);
442  write_html_trailer(fp_ht);
443  if (fclose(fp_ht)==EOF) {
444  debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),hfile,strerror(errno));
445  exit(EXIT_FAILURE);
446  }
447 
448  if (!KeepTempLog && unlink(tmp3)) {
449  debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
450  exit(EXIT_FAILURE);
451  }
452 
453  return;
454 }
idate
int idate
Definition: conf.h:477
ReadFilter
struct ReadLogDataStruct ReadFilter
The log file filtering.
Definition: log.c:37
getword_start
void getword_start(struct getwordstruct *gwarea, const char *line)
Definition: util.c:74
write_html_header
void write_html_header(FILE *fp_ou, int depth, const char *title, int javascript)
Definition: util.c:2144
debuga
void debuga(const char *File, int Line, const char *msg,...)
Definition: util.c:601
getperiod_torange
void getperiod_torange(const struct periodstruct *period, int *dfrom, int *duntil)
Definition: util.c:1111
longline_read
char * longline_read(FileObject *fp_in, longline line)
Definition: longline.c:97
format_path
int format_path(const char *file, int line, char *output_buffer, int buffer_size, const char *format,...)
Definition: util.c:2665
FileObject_GetLastCloseError
const char * FileObject_GetLastCloseError(void)
Definition: fileobject.c:263
UserAgent_Readlog
void UserAgent_Readlog(const struct ReadLogDataStruct *ReadFilter)
Definition: useragent.c:90
FileListIter_Next
const char * FileListIter_Next(struct _FileListIterator *FIter)
Definition: filelist.c:427
longlinestruct
Definition: longline.c:56
decomp
FileObject * decomp(const char *arq)
Definition: decomp.c:481
KeepTempLog
bool KeepTempLog
True to keep the temporary files for inspection.
Definition: conf.h:505
FileObject_GetLastOpenError
const char * FileObject_GetLastOpenError(void)
Definition: fileobject.c:236
_
#define _(String)
Definition: conf.h:155
ip2name
void ip2name(char *ip, int ip_len)
Definition: ip2name.c:216
MAXLEN
#define MAXLEN
Definition: conf.h:176
getword_skip
int getword_skip(int limit, struct getwordstruct *gwarea, char stop)
Definition: util.c:160
FileListIter_Close
void FileListIter_Close(struct _FileListIterator *FIter)
Definition: filelist.c:530
UserAgentEndDate
static struct tm UserAgentEndDate
Definition: useragent.c:37
INDEX_TREE_DATE
#define INDEX_TREE_DATE
Definition: conf.h:240
_FileListIterator
Iterator of the file list.
Definition: filelist.c:75
HTML_JS_NONE
#define HTML_JS_NONE
Value to exclude all the javascripts from the html page.
Definition: conf.h:285
FileListStruct
List of files.
Definition: filelist.c:52
UserAgentLog
FileListObject UserAgentLog
Definition: useragent.c:31
ReportType
unsigned long int ReportType
Definition: conf.h:332
close_html_header
void close_html_header(FILE *fp_ou)
Definition: util.c:2152
UserAgentTempLog
static char UserAgentTempLog[20000]
Log file where the user agent data are written.
Definition: useragent.c:34
IndexTree
unsigned long int IndexTree
How to display the index of the reports.
Definition: conf.h:416
totregsl
static long int totregsl
The number of records read from the input logs.
Definition: readlog.c:118
compare_date
int compare_date(const struct tm *date1, const struct tm *date2)
Definition: util.c:549
ReadLogDataStruct::StartTime
int StartTime
The start time to include in the report(H*100+M). Set to -1 to disable.
Definition: defs.h:148
getword
int getword(char *word, int limit, struct getwordstruct *gwarea, char stop)
Definition: util.c:90
conf.h
Include headers and define global variables. */.
filelist.h
UserAgentStartDate
static struct tm UserAgentStartDate
Definition: useragent.c:36
ReadLogDataStruct
Log filtering criterion.
Definition: defs.h:131
longline_create
longline longline_create(void)
Definition: longline.c:70
REPORT_TYPE_USERAGENT
#define REPORT_TYPE_USERAGENT
Definition: conf.h:200
FileListIter_Open
FileListIterator FileListIter_Open(FileListObject FObj)
Definition: filelist.c:349
month2num
int month2num(const char *month)
Definition: util.c:526
getwordstruct
Definition: defs.h:26
longline_reset
void longline_reset(longline line)
Definition: longline.c:88
longline_destroy
void longline_destroy(longline *line_ptr)
Definition: longline.c:168
getwordstruct::current
const char * current
Definition: defs.h:28
UserAgent_Write
void UserAgent_Write(FILE *fp, const struct tm *Time, const char *Ip, const char *User, const char *Agent)
Definition: useragent.c:74
fp_log
static FILE * fp_log
Handle to the sarg log file. NULL if not created.
Definition: readlog.c:116
ReadLogDataStruct::EndTime
int EndTime
The end time to include in the report(H*100+M). Set to -1 to disable.
Definition: defs.h:150
UserAgent
void UserAgent(void)
Definition: useragent.c:207
write_html_trailer
void write_html_trailer(FILE *fp_ou)
Definition: util.c:2157
tmp
char tmp[20000]
Definition: conf.h:315
useragent_count
int useragent_count
Definition: conf.h:480
defs.h
Declaration of the structures and functions.
outdirname
char outdirname[20000]
Definition: conf.h:311
UserAgent_Open
FILE * UserAgent_Open(void)
Definition: useragent.c:46
output_html_string
void output_html_string(FILE *fp_ou, const char *str, int maxlen)
Definition: util.c:2163
period
struct periodstruct period
Definition: conf.h:312
FileObject_Close
int FileObject_Close(FileObject *File)
Definition: fileobject.c:206
fixendofline
void fixendofline(char *str)
Definition: util.c:1911
debug
int debug
Definition: conf.h:489
FileObjectStruct
Definition: fileobject.h:4
getword_atoi
int getword_atoi(int *number, struct getwordstruct *gwarea, char stop)
Definition: util.c:227
Ip2Name
bool Ip2Name
Definition: conf.h:337