smartfilter.c (sarg-2.3.11) | : | smartfilter.c (sarg-2.4.0) | ||
---|---|---|---|---|
/* | /* | |||
* SARG Squid Analysis Report Generator http://sarg.sourceforge.net | * SARG Squid Analysis Report Generator http://sarg.sourceforge.net | |||
* 1998, 2013 | * 1998, 2015 | |||
* | * | |||
* SARG donations: | * SARG donations: | |||
* please look at http://sarg.sourceforge.net/donations.php | * please look at http://sarg.sourceforge.net/donations.php | |||
* Support: | * Support: | |||
* http://sourceforge.net/projects/sarg/forums/forum/363374 | * http://sourceforge.net/projects/sarg/forums/forum/363374 | |||
* --------------------------------------------------------------------- | * --------------------------------------------------------------------- | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
skipping to change at line 36 | skipping to change at line 36 | |||
#include "include/conf.h" | #include "include/conf.h" | |||
#include "include/defs.h" | #include "include/defs.h" | |||
void smartfilter_report(void) | void smartfilter_report(void) | |||
{ | { | |||
FILE *fp_in = NULL, *fp_ou = NULL, *fp_user = NULL; | FILE *fp_in = NULL, *fp_ou = NULL, *fp_user = NULL; | |||
char buf[MAXLEN]; | char buf[MAXLEN]; | |||
char url[MAXLEN]; | char url[MAXLEN]; | |||
char pgmurl[250]; | ||||
char csort[255]; | char csort[255]; | |||
char smart_in[MAXLEN]; | char smart_in[MAXLEN]; | |||
char smart_ou[MAXLEN]; | char smart_ou[MAXLEN]; | |||
char sites[MAXLEN]; | char sites[MAXLEN]; | |||
char report[MAXLEN]; | char report[MAXLEN]; | |||
char ip[MAXLEN]; | char ip[MAXLEN]; | |||
char user[MAXLEN]; | char user[MAXLEN]; | |||
char ouser[MAXLEN]; | char ouser[MAXLEN]; | |||
char data[15]; | char data[15]; | |||
char hora[15]; | char hora[15]; | |||
char smartcat[256]; | char smartcat[256]; | |||
char ftime[128]; | char ftime[128]; | |||
char smartuser[MAXLEN]; | char smartuser[MAXLEN]; | |||
int fuser=0; | ||||
int cstatus; | int cstatus; | |||
struct getwordstruct gwarea; | struct getwordstruct gwarea; | |||
const struct userinfostruct *uinfo; | const struct userinfostruct *uinfo; | |||
ouser[0]='\0'; | ouser[0]='\0'; | |||
if (snprintf(smart_in,sizeof(smart_in),"%s/smartfilter.int_unsort",tmp)>= sizeof(smart_in)) { | if (snprintf(smart_in,sizeof(smart_in),"%s/smartfilter.int_unsort",tmp)>= sizeof(smart_in)) { | |||
debuga(_("Path too long: ")); | debuga(__FILE__,__LINE__,_("Path too long: ")); | |||
debuga_more("%s/smartfilter.int_unsort\n",tmp); | debuga_more("%s/smartfilter.int_unsort\n",tmp); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (snprintf(sites,sizeof(sites),"%s/sarg-sites",outdirname)>=sizeof(site s)) { | if (snprintf(sites,sizeof(sites),"%s/sarg-sites",outdirname)>=sizeof(site s)) { | |||
debuga(_("Path too long: ")); | debuga(__FILE__,__LINE__,_("Path too long: ")); | |||
debuga_more("%s/sarg-sites\n",outdirname); | debuga_more("%s/sarg-sites\n",outdirname); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (snprintf(smart_ou,sizeof(smart_ou),"%s/smartfilter.int_log",tmp)>=siz eof(smart_ou)) { | if (snprintf(smart_ou,sizeof(smart_ou),"%s/smartfilter.int_log",tmp)>=siz eof(smart_ou)) { | |||
debuga(_("Path too long: ")); | debuga(__FILE__,__LINE__,_("Path too long: ")); | |||
debuga_more("%s/smartfilter.int_log\n",tmp); | debuga_more("%s/smartfilter.int_log\n",tmp); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (snprintf(report,sizeof(report),"%s/smartfilter.html",outdirname)>=siz eof(report)) { | if (snprintf(report,sizeof(report),"%s/smartfilter.html",outdirname)>=siz eof(report)) { | |||
debuga(_("Path too long: ")); | debuga(__FILE__,__LINE__,_("Path too long: ")); | |||
debuga_more("%s/smartfilter.html\n",outdirname); | debuga_more("%s/smartfilter.html\n",outdirname); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (snprintf(csort,sizeof(csort),"sort -n -t \"\t\" -k 1,1 -k 2,2 -k 3,3 -o \"%s\" \"%s\"",smart_ou,smart_in)>=sizeof(csort)) { | if (snprintf(csort,sizeof(csort),"sort -n -t \"\t\" -k 1,1 -k 2,2 -k 3,3 -o \"%s\" \"%s\"",smart_ou,smart_in)>=sizeof(csort)) { | |||
debuga(_("cannot build the sort command to sort file %s\n"),smart _in); | debuga(__FILE__,__LINE__,_("Cannot build the sort command to sort file \"%s\"\n"),smart_in); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
cstatus=system(csort); | cstatus=system(csort); | |||
if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) { | if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) { | |||
debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus)) | debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEX | |||
; | ITSTATUS(cstatus)); | |||
debuga(_("sort command: %s\n"),csort); | debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if((fp_in=fopen(smart_ou,"r"))==NULL) { | if ((fp_in=fopen(smart_ou,"r"))==NULL) { | |||
debugapos("smartfilter",_("Cannot open file \"%s\": %s\n"),smart_ | debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),smart | |||
ou,strerror(errno)); | _ou,strerror(errno)); | |||
debuga(_("sort command: %s\n"),csort); | debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if (!KeepTempLog && unlink(smart_in)) { | if (!KeepTempLog && unlink(smart_in)) { | |||
debuga(_("Cannot delete \"%s\": %s\n"),smart_in,strerror(errno)); | debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),smart_in ,strerror(errno)); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if((fp_ou=fopen(report,"w"))==NULL) { | if ((fp_ou=fopen(report,"w"))==NULL) { | |||
debugapos("smartfilter",_("Cannot open file \"%s\": %s\n"),report | debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),repor | |||
,strerror(errno)); | t,strerror(errno)); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitiona l//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n <meta http- equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet); | fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitiona l//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n <meta http- equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet); | |||
fputs("</head>\n",fp_ou); | fputs("</head>\n",fp_ou); | |||
if(strlen(FontFace) > 0) fprintf(fp_ou,"<font face=%s>\n",FontFace); | if (strlen(FontFace) > 0) fprintf(fp_ou,"<font face=%s>\n",FontFace); | |||
fprintf(fp_ou,"<body bgcolor=\"%s\" text=\"%s\" background=\"%s\">\n",BgC olor,TxColor,BgImage); | fprintf(fp_ou,"<body bgcolor=\"%s\" text=\"%s\" background=\"%s\">\n",BgC olor,TxColor,BgImage); | |||
fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\ n",fp_ou); | fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\ n",fp_ou); | |||
write_logo_image(fp_ou); | write_logo_image(fp_ou); | |||
fprintf(fp_ou,"<tr><th align=\"center\"><b><font color=\"%s\" size=\"+1\" >%s</font></b></th></tr>\n",TiColor,Title); | fprintf(fp_ou,"<tr><th align=\"center\"><b><font color=\"%s\" size=\"+1\" >%s</font></b></th></tr>\n",TiColor,Title); | |||
fprintf(fp_ou,"<tr><td align=\"center\" bgcolor=\"%s\"><font size=\"%s\"> ",HeaderBgColor,FontSize); | fprintf(fp_ou,"<tr><td align=\"center\" bgcolor=\"%s\"><font size=\"%s\"> ",HeaderBgColor,FontSize); | |||
fprintf(fp_ou,_("Period: %s"),period.html); | fprintf(fp_ou,_("Period: %s"),period.html); | |||
fputs("</font></td></tr>\n",fp_ou); | fputs("</font></td></tr>\n",fp_ou); | |||
fprintf(fp_ou,"<tr><th bgcolor=\"%s\" align=\"center\"><font size=\"%s\"> %s</font></th></tr>\n",HeaderBgColor,FontSize,_("SmartFilter")); | fprintf(fp_ou,"<tr><th bgcolor=\"%s\" align=\"center\"><font size=\"%s\"> %s</font></th></tr>\n",HeaderBgColor,FontSize,_("SmartFilter")); | |||
fputs("</table></div>\n",fp_ou); | fputs("</table></div>\n",fp_ou); | |||
fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"2\">\ n",fp_ou); | fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"2\">\ n",fp_ou); | |||
fputs("<tr><td></td></tr>\n",fp_ou); | fputs("<tr><td></td></tr>\n",fp_ou); | |||
fputs("<tr><td></td></tr>\n",fp_ou); | fputs("<tr><td></td></tr>\n",fp_ou); | |||
fputs("<tr><td></td></tr>\n",fp_ou); | fputs("<tr><td></td></tr>\n",fp_ou); | |||
fprintf(fp_ou,"<tr><th bgcolor=%s><font size=\"%s\">%s</font></th><th bgc olor=\"%s\"><font size=\"%s\">%s</font></th><th bgcolor=\"%s\"><font size=\"%s\" >%s</font></th><th bgcolor=\"%s\"><font size=\"%s\">%s</font></th><th bgcolor=\" %s\"><font size=\"%s\">%s</font></th></tr>\n",HeaderBgColor,FontSize,_("USERID") ,HeaderBgColor,FontSize,_("IP/NAME"),HeaderBgColor,FontSize,_("DATE/TIME"),Heade rBgColor,FontSize,_("ACCESSED SITE"),HeaderBgColor,FontSize,_("SMARTFILTER")); | fprintf(fp_ou,"<tr><th bgcolor=%s><font size=\"%s\">%s</font></th><th bgc olor=\"%s\"><font size=\"%s\">%s</font></th><th bgcolor=\"%s\"><font size=\"%s\" >%s</font></th><th bgcolor=\"%s\"><font size=\"%s\">%s</font></th><th bgcolor=\" %s\"><font size=\"%s\">%s</font></th></tr>\n",HeaderBgColor,FontSize,_("USERID") ,HeaderBgColor,FontSize,_("IP/NAME"),HeaderBgColor,FontSize,_("DATE/TIME"),Heade rBgColor,FontSize,_("ACCESSED SITE"),HeaderBgColor,FontSize,_("SMARTFILTER")); | |||
snprintf(pgmurl,sizeof(pgmurl),"<a href=\"%s\">%s-%s</a>",URL,PGM,VERSION ); | ||||
while(fgets(buf,sizeof(buf),fp_in)!=NULL) { | while(fgets(buf,sizeof(buf),fp_in)!=NULL) { | |||
getword_start(&gwarea,buf); | getword_start(&gwarea,buf); | |||
if (getword(user,sizeof(user),&gwarea,'\t')<0 || getword(data,siz eof(data),&gwarea,'\t')<0 || | if (getword(user,sizeof(user),&gwarea,'\t')<0 || getword(data,siz eof(data),&gwarea,'\t')<0 || | |||
getword(hora,sizeof(hora),&gwarea,'\t')<0 || getword(ip,sizeo f(ip),&gwarea,'\t')<0 || | getword(hora,sizeof(hora),&gwarea,'\t')<0 || getword(ip,sizeo f(ip),&gwarea,'\t')<0 || | |||
getword(url,sizeof(url),&gwarea,'\t')<0 || getword(smartcat,s izeof(smartcat),&gwarea,'\n')<0) { | getword(url,sizeof(url),&gwarea,'\t')<0 || getword(smartcat,s izeof(smartcat),&gwarea,'\n')<0) { | |||
debuga(_("Invalid record in file \"%s\"\n"),smart_ou); | debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\" \n"),smart_ou); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
uinfo=userinfo_find_from_id(user); | uinfo=userinfo_find_from_id(user); | |||
if (!uinfo) { | if (!uinfo) { | |||
debuga(_("Unknown user ID %s in file \"%s\"\n"),user,smar t_ou); | debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \" %s\"\n"),user,smart_ou); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
if(strcmp(ouser,user) != 0) { | if (strcmp(ouser,user) != 0) { | |||
strcpy(ouser,user); | strcpy(ouser,user); | |||
sprintf(smartuser,"%s/denied_%s.html",outdirname,uinfo->f | format_path(__FILE__, __LINE__, smartuser, sizeof(smartus | |||
ilename); | er), "%s/denied_%s.html", outdirname, uinfo->filename); | |||
if(fuser) { | if (fp_user) { | |||
fuser=0; | ||||
fputs("</table>\n",fp_user); | fputs("</table>\n",fp_user); | |||
if(ShowSargInfo) { | if (ShowSargInfo) { | |||
zdate(ftime, sizeof(ftime), DateFormat); | zdate(ftime, sizeof(ftime), df); | |||
fputs("<br><br><div align=\"center\"><fon t size=\"-2\">",fp_user); | fputs("<br><br><div align=\"center\"><fon t size=\"-2\">",fp_user); | |||
/* TRANSLATORS: The first %s is an html < | fprintf(fp_user,_("Generated by <a href=\ | |||
a> tag with a link to the sarg | "%s\">%s-%s</a> on %s"),URL,PGM,VERSION,ftime); | |||
* website. The second %s is the report g | ||||
eneration time. | ||||
*/ | ||||
fprintf(fp_user,_("Generated by %s on %s" | ||||
),pgmurl,ftime); | ||||
fputs("</font></div>\n",fp_user); | fputs("</font></div>\n",fp_user); | |||
} | } | |||
fputs("</body>\n</html>\n",fp_user); | fputs("</body>\n</html>\n",fp_user); | |||
fclose(fp_user); | if (fclose(fp_user)==EOF) { | |||
debuga(__FILE__,__LINE__,_("Write error i | ||||
n \"%s\": %s\n"),smartuser,strerror(errno)); | ||||
exit(EXIT_FAILURE); | ||||
} | ||||
fp_user=NULL; | ||||
} | } | |||
if ((fp_user = fopen(smartuser, "a")) == 0) { | if ((fp_user = fopen(smartuser, "a")) == 0) { | |||
debugapos("smartfilter",_("Cannot open file \"%s\ ": %s\n"),smartuser,strerror(errno)); | debuga(__FILE__,__LINE__,_("Cannot open file \"%s \": %s\n"),smartuser,strerror(errno)); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
fuser=1; | ||||
fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Tran sitional//EN\"",fp_ou); | fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Tran sitional//EN\"",fp_ou); | |||
fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_o u); | fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_o u); | |||
fputs("<html>\n",fp_user); | fputs("<html>\n",fp_user); | |||
fputs("<head>\n",fp_user); | fputs("<head>\n",fp_user); | |||
fprintf(fp_user," <meta http-equiv=\"Content-Type\" cont ent=\"text/html; charset=%s\">\n",CharSet); | fprintf(fp_user," <meta http-equiv=\"Content-Type\" cont ent=\"text/html; charset=%s\">\n",CharSet); | |||
fputs("</head>\n",fp_user); | fputs("</head>\n",fp_user); | |||
if(FontFace[0] != 0) { | if (FontFace[0] != 0) { | |||
/* | /* | |||
Before merging the sprintf and the fputs, the cod e looked like this: | Before merging the sprintf and the fputs, the cod e looked like this: | |||
sprintf(html2,"<font face=%s>\n",FontFace); | sprintf(html2,"<font face=%s>\n",FontFace); | |||
fputs(url,fp_user); | fputs(url,fp_user); | |||
The two lines don't use the same buffer so the st ring formated by sprintf is not the string | The two lines don't use the same buffer so the st ring formated by sprintf is not the string | |||
written to fp_user. I (fmarchal) assumed it was a typo and replaced it by a fprintf but | written to fp_user. I (fmarchal) assumed it was a typo and replaced it by a fprintf but | |||
that font tag is not valid outside of the body. S o, the generated html was likely | that font tag is not valid outside of the body. S o, the generated html was likely | |||
containing garbage not rendered by the browser. | containing garbage not rendered by the browser. | |||
*/ | */ | |||
fprintf(fp_user,"<font face=%s>\n",FontFace); | fprintf(fp_user,"<font face=%s>\n",FontFace); | |||
} | } | |||
fprintf(fp_user,"<body bgcolor=\"%s\" text=\"%s\" backgro und=\"%s\">\n",BgColor,TxColor,BgImage); | fprintf(fp_user,"<body bgcolor=\"%s\" text=\"%s\" backgro und=\"%s\">\n",BgColor,TxColor,BgImage); | |||
fputs("<div align=\"center\"><table cellpadding=\"0\" cel lspacing=\"0\">\n",fp_user); | fputs("<div align=\"center\"><table cellpadding=\"0\" cel lspacing=\"0\">\n",fp_user); | |||
if(LogoImage[0]!='\0') fprintf(fp_user,"<tr><th align=lef t><img src=\"%s\" border=\"0\" align=\"absmiddle\" width=\"%s\" height=\"%s\"><f ont color=\"%s\">%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText); | if (LogoImage[0]!='\0') fprintf(fp_user,"<tr><th align=le ft><img src=\"%s\" border=\"0\" align=\"absmiddle\" width=\"%s\" height=\"%s\">< font color=\"%s\">%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText); | |||
fprintf(fp_user,"<tr><th align=\"center\"><b><font color= \"%s\" size=\"+1\">%s</font></b></th></tr>\n",TiColor,Title); | fprintf(fp_user,"<tr><th align=\"center\"><b><font color= \"%s\" size=\"+1\">%s</font></b></th></tr>\n",TiColor,Title); | |||
fputs("<tr><td align=center bgcolor=\"%s\"><font size=\"% s\">",fp_user); | fputs("<tr><td align=center bgcolor=\"%s\"><font size=\"% s\">",fp_user); | |||
fprintf(fp_user,_("Period: %s"),period.html); | fprintf(fp_user,_("Period: %s"),period.html); | |||
fputs("</font></td></tr>\n",fp_user); | fputs("</font></td></tr>\n",fp_user); | |||
fprintf(fp_user,"<tr><td align=\"center\" bgcolor=\"%s\"> <font size=\"%s\">%s:</font><font size=\"%s\"> %s</font></td></tr>\n",HeaderBgCo lor,FontSize,_("User"),FontSize,uinfo->label); | fprintf(fp_user,"<tr><td align=\"center\" bgcolor=\"%s\"> <font size=\"%s\">%s:</font><font size=\"%s\"> %s</font></td></tr>\n",HeaderBgCo lor,FontSize,_("User"),FontSize,uinfo->label); | |||
fputs("</table></div>\n",fp_user); | fputs("</table></div>\n",fp_user); | |||
fputs("<div align=\"center\"><table cellpadding=0 cellspa cing=2>\n",fp_user); | fputs("<div align=\"center\"><table cellpadding=0 cellspa cing=2>\n",fp_user); | |||
fputs("<tr><td></td></tr>\n",fp_user); | fputs("<tr><td></td></tr>\n",fp_user); | |||
fputs("<tr><td></td></tr>\n",fp_user); | fputs("<tr><td></td></tr>\n",fp_user); | |||
fputs("<tr><td></td></tr>\n",fp_user); | fputs("<tr><td></td></tr>\n",fp_user); | |||
fprintf(fp_user,"<tr><th bgcolor=%s><font size=%s>%s</fon t></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>% s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font siz e=%s>%s</font></th></tr>\n",HeaderBgColor,FontSize,_("USERID"),HeaderBgColor,Fon tSize,_("IP/NAME"),HeaderBgColor,FontSize,_("DATE/TIME"),HeaderBgColor,FontSize, _("ACCESSED SITE"),HeaderBgColor,FontSize,_("SMARTFILTER")); | fprintf(fp_user,"<tr><th bgcolor=%s><font size=%s>%s</fon t></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>% s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font siz e=%s>%s</font></th></tr>\n",HeaderBgColor,FontSize,_("USERID"),HeaderBgColor,Fon tSize,_("IP/NAME"),HeaderBgColor,FontSize,_("DATE/TIME"),HeaderBgColor,FontSize, _("ACCESSED SITE"),HeaderBgColor,FontSize,_("SMARTFILTER")); | |||
} | } | |||
fprintf(fp_user,"<tr><td bgcolor=%s align=center><font size=%s>%s </font></td><td bgcolor=%s align=center><font size=%s>%s</font></td><td bgcolor= %s align=center><font size=%s>%s-%s</font></td><td bgcolor=%s><font size=%s>%s</ font></td><td bgcolor=%s><font size=%s>%s</font></td></th>\n",TxBgColor,FontSize ,uinfo->label,TxBgColor,FontSize,ip,TxBgColor,FontSize,data,hora,TxBgColor,FontS ize,url,TxBgColor,FontSize,smartcat); | fprintf(fp_user,"<tr><td bgcolor=%s align=center><font size=%s>%s </font></td><td bgcolor=%s align=center><font size=%s>%s</font></td><td bgcolor= %s align=center><font size=%s>%s-%s</font></td><td bgcolor=%s><font size=%s>%s</ font></td><td bgcolor=%s><font size=%s>%s</font></td></th>\n",TxBgColor,FontSize ,uinfo->label,TxBgColor,FontSize,ip,TxBgColor,FontSize,data,hora,TxBgColor,FontS ize,url,TxBgColor,FontSize,smartcat); | |||
fprintf(fp_ou,"<tr><td bgcolor=%s align=center><font size=%s>%s</ font></td><td bgcolor=%s align=center><font size=%s>%s</font></td><td bgcolor=%s align=center><font size=%s>%s-%s</font></td><td bgcolor=%s><font size=%s>%s</fo nt></td><td bgcolor=%s><font size=%s>%s</font></td></th>\n",TxBgColor,FontSize,u info->label,TxBgColor,FontSize,ip,TxBgColor,FontSize,data,hora,TxBgColor,FontSiz e,url,TxBgColor,FontSize,smartcat); | fprintf(fp_ou,"<tr><td bgcolor=%s align=center><font size=%s>%s</ font></td><td bgcolor=%s align=center><font size=%s>%s</font></td><td bgcolor=%s align=center><font size=%s>%s-%s</font></td><td bgcolor=%s><font size=%s>%s</fo nt></td><td bgcolor=%s><font size=%s>%s</font></td></th>\n",TxBgColor,FontSize,u info->label,TxBgColor,FontSize,ip,TxBgColor,FontSize,data,hora,TxBgColor,FontSiz e,url,TxBgColor,FontSize,smartcat); | |||
} | } | |||
fputs("</table>\n",fp_ou); | fputs("</table>\n",fp_ou); | |||
if(ShowSargInfo) { | if (ShowSargInfo) { | |||
zdate(ftime, sizeof(ftime), DateFormat); | zdate(ftime, sizeof(ftime), df); | |||
fputs("<br><br><div align=\"center\"><font size=\"-2\">",fp_ou); | fputs("<br><br><div align=\"center\"><font size=\"-2\">",fp_ou); | |||
fprintf(fp_ou,_("Generated by %s on %s"),pgmurl,ftime); | fprintf(fp_ou,_("Generated by <a href=\"%s\">%s-%s</a> on %s"),UR L,PGM,VERSION,ftime); | |||
fputs("</font></div>\n",fp_ou); | fputs("</font></div>\n",fp_ou); | |||
} | } | |||
fputs("</body>\n</html>\n",fp_user); | fputs("</body>\n</html>\n",fp_user); | |||
fclose(fp_ou); | if (fclose(fp_ou)==EOF) { | |||
if(fp_user) { | debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),report, | |||
strerror(errno)); | ||||
exit(EXIT_FAILURE); | ||||
} | ||||
if (fp_user) { | ||||
fputs("</table>\n",fp_user); | fputs("</table>\n",fp_user); | |||
if(ShowSargInfo) { | if (ShowSargInfo) { | |||
zdate(ftime, sizeof(ftime), DateFormat); | zdate(ftime, sizeof(ftime), df); | |||
fputs("<br><br><div align=\"center\"><font size=\"-2\">", fp_user); | fputs("<br><br><div align=\"center\"><font size=\"-2\">", fp_user); | |||
fprintf(fp_user,_("Generated by %s on %s"),pgmurl,ftime); | fprintf(fp_user,_("Generated by <a href=\"%s\">%s-%s</a> on %s"),URL,PGM,VERSION,ftime); | |||
fputs("</font></div>\n",fp_user); | fputs("</font></div>\n",fp_user); | |||
} | } | |||
fputs("</body>\n</html>\n",fp_user); | fputs("</body>\n</html>\n",fp_user); | |||
fclose(fp_user); | if (fclose(fp_user)==EOF) { | |||
debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n") | ||||
,smartuser,strerror(errno)); | ||||
exit(EXIT_FAILURE); | ||||
} | ||||
} | } | |||
if (!KeepTempLog && unlink(smart_ou)) { | if (!KeepTempLog && unlink(smart_ou)) { | |||
debuga(_("Cannot delete \"%s\": %s\n"),smart_ou,strerror(errno)); | debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),smart_ou ,strerror(errno)); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
return; | return; | |||
} | } | |||
End of changes. 32 change blocks. | ||||
52 lines changed or deleted | 55 lines changed or added |