exit(EXIT_FAILURE);
}
- snprintf(top3,sizeof(top3),"%s/report",dirname);
- if((fp_top3=fopen(top3,"w"))==NULL) {
- debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
- exit(EXIT_FAILURE);
+ if(strcmp(email,"stdout") == 0) {
+ fp_top3=stdout;
+ } else {
+ snprintf(top3,sizeof(top3),"%s/report",dirname);
+ if((fp_top3=fopen(top3,"w"))==NULL) {
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
}
safe_strcpy(strip1,_("Squid User Access Report"),sizeof(strip1));
local = localtime(&t);
fprintf(fp_top3, "\n%s\n", asctime(local));
- if (fclose(fp_top3)==EOF) {
- debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),top3,strerror(errno));
- exit(EXIT_FAILURE);
- }
-
- if(strcmp(email,"stdout") == 0) {
- if((fp_top3=fopen(top3,"r"))==NULL) {
- debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
- exit(EXIT_FAILURE);
- }
-
- while(fgets(warea,sizeof(warea),fp_top3)!=NULL)
- fputs(warea,stdout);
+ if(strcmp(email,"stdout") != 0) {
if (fclose(fp_top3)==EOF) {
- debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),top3,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),top3,strerror(errno));
exit(EXIT_FAILURE);
}
- } else {
+
/* TRANSLATORS: The string is formatted using strftime. You can use
any string formatting marker allowed by strftime. */
strftime(Subject,sizeof(Subject),_("SARG report, %c"),local);