]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - dansguardian_log.c
Append \n at the end of every debuga
[thirdparty/sarg.git] / dansguardian_log.c
index b9ffc28f61a6b561e546b5e002a75a8110c174ab..23b4f9a18fa7cf480ca7798a4b3421f9527595b5 100644 (file)
@@ -81,17 +81,17 @@ void dansguardian_log(void)
    sprintf(guard_ou,"%s/dansguardian.log",tmp);
 
    if(access(DansGuardianConf, R_OK) != 0) {
-      debuga("Cannot open DansGuardian config file: %s",DansGuardianConf);
+      debuga(_("Cannot open DansGuardian config file: %s\n"),DansGuardianConf);
       exit(1);
    }
 
    if((fp_guard=fopen(DansGuardianConf,"r"))==NULL) {
-      fprintf(stderr, "SARG: (dansguardian) %s: %s\n",_("Cannot open log file"),DansGuardianConf);
+      debuga(_("(dansguardian) Cannot open log file: %s\n"),DansGuardianConf);
       exit(1);
    }
 
    if((fp_ou=MY_FOPEN(guard_in,"a"))==NULL) {
-      fprintf(stderr, "SARG: (dansguardian) %s: %s\n",_("Cannot open log file"),guard_in);
+      debuga(_("(dansguardian) Cannot open log file: %s\n"),guard_in);
       exit(1);
    }
 
@@ -102,25 +102,18 @@ void dansguardian_log(void)
       if(strstr(buf,"loglocation ") != 0) {
          getword_start(&gwarea,buf);
          if (getword_skip(MAXLEN,&gwarea,'\'')<0 || getword(loglocation,sizeof(loglocation),&gwarea,'\'')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",DansGuardianConf);
+            debuga(_("Maybe you have a broken record or garbage in your %s file.\n"),DansGuardianConf);
             exit(1);
          }
          break;
       }
    }
 
-   if(debug) {
-      char short_url[1024];
-      getword_start(&gwarea,_("Reading access log file"));
-      if (getword_limit(short_url,sizeof(short_url),&gwarea,' ')<0 || getword_skip(MAXLEN,&gwarea,' ')<0) {
-         printf("SARG: Maybe you have a broken record or garbage in your %s entry.\n",_("Reading access log file"));
-         exit(1);
-      }
-      debuga("%s DansGuardian %s: %s",short_url,gwarea.current,loglocation);
-   }
+   if(debug)
+      debuga(_("Reading DansGuardian log file: %s\n"),loglocation);
 
    if((fp_in=MY_FOPEN(loglocation,"r"))==NULL) {
-      fprintf(stderr, "SARG: (dansguardian) %s: %s\n",_("Cannot open log file"),loglocation);
+      debuga(_("(dansguardian) Cannot open log file: %s\n"),loglocation);
       exit(1);
    }
 
@@ -132,16 +125,16 @@ void dansguardian_log(void)
           getword(day,sizeof(day),&gwarea,' ')<0 || getword(hour,sizeof(hour),&gwarea,' ')<0 ||
           getword(user,sizeof(user),&gwarea,' ')<0 || getword(ip,sizeof(ip),&gwarea,' ')<0 ||
           getword_skip(MAXLEN,&gwarea,'/')<0 || getword_skip(MAXLEN,&gwarea,'/')<0) {
-         debuga(_("Maybe you have a broken record or garbage in your %s file"),loglocation);
+         debuga(_("Maybe you have a broken record or garbage in your %s file\n"),loglocation);
          exit(1);
       }
       if (getword_ptr(buf,&url,&gwarea,' ')<0) {
-         debuga(_("Maybe you have a broken url in your %s file"),loglocation);
+         debuga(_("Maybe you have a broken url in your %s file\n"),loglocation);
          exit(1);
       }
       if (getword_skip(255,&gwarea,' ')<0 ||
           getword(code1,sizeof(code1),&gwarea,' ')<0 || getword(code2,sizeof(code2),&gwarea,' ')<0) {
-         debuga(_("Maybe you have a broken record or garbage in your %s file"),loglocation);
+         debuga(_("Maybe you have a broken record or garbage in your %s file\n"),loglocation);
          exit(1);
       }
       sprintf(wdata,"%s%02d%s",year,atoi(mon),day);
@@ -165,13 +158,13 @@ void dansguardian_log(void)
    if(fp_ou) fclose(fp_ou);
 
    if(debug)
-      debuga("%s: %s",_("Sorting file"),guard_ou);
+      debuga(_("Sorting file: %s\n"),guard_ou);
 
    sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 \"%s\" -o \"%s\"",guard_in, guard_ou);
    cstatus=system(tmp6);
    if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
-      fprintf(stderr, "SARG: sort command return status %d\n",WEXITSTATUS(cstatus));
-      fprintf(stderr, "SARG: sort command: %s\n",tmp6);
+      debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus));
+      debuga(_("sort command: %s\n"),tmp6);
       exit(1);
    }
    unlink(guard_in);