~ubuntu-branches/ubuntu/natty/sarg/natty

« back to all changes in this revision

Viewing changes to convlog.c

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2010-01-11 15:07:10 UTC
  • mfrom: (1.1.8 upstream) (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100111150710-mgvjhyjs13mrg0tb
Tags: 2.2.6-1
* New upstream release
  - Fixes issues in getword loop detection (Closes: #522284)
  - Removed patches integrated upstream
  - Fixes usertab parsing for IPv6 address (Closes: #504749)
  - Fixes typo in dansguardian_log.c (Closes: #540438)
  - Fixes error parsing squidGuard logs (Closes: #486895)

* debian/sarg-reports.conf
  - Fixed typo (Closes: #517356)

* debian/control
  - Added Build-Dep options on libgd2-xpm-dev (Closes: #540121)
  - Added Dependency on ${misc:Depends}
  - Added dependency on dpatch
  - Bumped Standard-Version to 3.8.3

* debian/compat
  - Upgraded debhelper compatibility to level 6

* debian/rules
  - Removed unnecessary upgrade of autoconf files
  - Added dpatch rules
  - Fixed configuration options and paths

* debian/patches/01_makefile-install-path
  - Fixed build-time installation paths

* debian/patches/02_config-file-references
  - Fixed references to configuration files

* debian/squid.conf
  - Sinced with upstream changes

* debian/{postrm,preinst,sarg.conf,sarg-reports,rules,dirs,sarg-reports.conf}
  - Moved configuration files to /etc/sarg and data directory to /var/lib/sarg
    (Closes: #553554, #502273)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
3
 
 *                                                            1998, 2008
 
3
 *                                                            1998, 2009
4
4
 * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
5
5
 *
6
6
 * SARG donations:
24
24
 */
25
25
 
26
26
#include "include/conf.h"
 
27
#include "include/defs.h"
27
28
 
28
 
void convlog(char *arq, char *df, int dfrom, int duntil)
 
29
void convlog(const char *arq, char *df, int dfrom, int duntil)
29
30
{
30
31
 
31
32
   FILE *fp_in;
39
40
   struct tm *t;
40
41
 
41
42
   if(arq[0] == '\0')
42
 
      strcpy(arq,"/usr/local/squid/logs/access.log");
 
43
      arq="/var/log/squid/access.log";
43
44
 
44
 
   if((fp_in=fopen(arq,"r"))==NULL) {
 
45
   if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
45
46
      fprintf(stderr, "SARG: (convlog) %s: %s\n",text[8],arq);
46
47
      exit(1);
47
48
   }
48
49
 
49
50
   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
50
 
      getword(data,sizeof(data),buf,' ');
 
51
      if (getword(data,sizeof(data),buf,' ')<0) {
 
52
         printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arq);
 
53
         exit(1);
 
54
      }
51
55
      tt=atoi(data);
52
56
      t=localtime(&tt);
53
57