if(LastLog > 0) mklastlog(outdir);
- if(strcmp(Index,"no") == 0) {
+ if(Index == INDEX_NO) {
sprintf(wdir,"%sindex.html",outdir);
if(access(wdir, R_OK) == 0) unlink(wdir);
return;
dirp = opendir(outdir);
while ((direntp = readdir( dirp )) != NULL) {
if(isdigit(direntp->d_name[0]) && isdigit(direntp->d_name[1])) {
- if(strcmp(IndexTree,"date") == 0)
+ if(IndexTree == INDEX_TREE_DATE)
file_index_to_date_index(direntp->d_name);
else
date_index_to_file_index(direntp->d_name);
}
closedir(dirp);
- if(strcmp(IndexTree,"date") == 0) {
+ if(IndexTree == INDEX_TREE_DATE) {
make_date_index();
} else {
make_file_index();
struct dirent *direntp;
struct dirent *direntp2;
struct dirent *direntp3;
- char hbc1[30];
char yearindex[MAXLEN];
char yeardir[MAXLEN];
char yearnum[10];
char monthnum[10];
char dayindex[MAXLEN];
char daynum[10];
+ char title[80];
int yearsort[150];
int nyears;
int year;
int order;
sprintf(yearindex,"%sindex.html",outdir);
- strcpy(hbc1,"class=\"header\"");
nyears=0;
dirp = opendir(outdir);
fprintf(stderr, "SARG: (index) %s: %s - %s\n",text[45],yearindex,strerror(errno));
exit(1);
}
- write_html_header(fp_ou, ".");
- fprintf(fp_ou,"<tr><th %s>%s</th><th %s>%s</th></tr>\n",hbc1,text[130],hbc1,text[132]);
+ write_html_header(fp_ou,0,"SARG reports");
+ close_html_header(fp_ou);
+ fputs("<div class=\"index\"><table cellpadding=\"1\" cellspacing=\"2\">\n<tr><td></td><td></td></tr>\n",fp_ou);
+ fprintf(fp_ou,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",text[130],text[132]);
for (y=0 ; y<nyears ; y++) {
if (order>0)
year=yearsort[y];
fprintf(stderr, "SARG: (index) %s: %s - %s\n",text[45],monthindex,strerror(errno));
exit(1);
}
- write_html_header(fp_ou2,"..");
- fprintf(fp_ou2,"<tr><th %s>%s/%s</th></tr>\n",hbc1,text[130],text[131]);
+ snprintf(title,sizeof(title),"SARG: report for %04d",year);
+ write_html_header(fp_ou2,1,title);
+ close_html_header(fp_ou2);
+ fputs("<div class=\"index\"><table cellpadding=\"1\" cellspacing=\"2\">\n<tr><td></td><td></td></tr>\n",fp_ou2);
+ fprintf(fp_ou2,"<tr><th class=\"header_l\">%s/%s</th></tr>\n",text[130],text[131]);
for (m=0 ; m<nmonths ; m++) {
if (order>0)
month=monthsort[m];
fprintf(stderr, "SARG: (index) %s: %s - %s\n",text[45],dayindex,strerror(errno));
exit(1);
}
- write_html_header(fp_ou3,"../..");
- fprintf(fp_ou3,"<tr><th %s>%s/%s/%s</th></tr>\n",hbc1,text[130],text[131],text[127]);
+ snprintf(title,sizeof(title),"SARG: report for %04d/%02d",year,month);
+ write_html_header(fp_ou3,2,title);
+ close_html_header(fp_ou3);
+ fputs("<div class=\"index\"><table cellpadding=\"1\" cellspacing=\"2\">\n<tr><td></td><td></td></tr>\n",fp_ou3);
+ fprintf(fp_ou3,"<tr><th class=\"header_l\">%s/%s/%s</th></tr>\n",text[130],text[131],text[127]);
for (d=0 ; d<ndays ; d++) {
if (order>0)
day=daysort[d];
}
fprintf(fp_ou3,"<tr><td class=\"data2\"><a href=\"%s/index.html\">%s %s %s</a></td></tr>\n",daynum,yearnum,nmonth,daynum);
}
+ fputs("</table></div>\n",fp_ou3);
write_html_trailer(fp_ou3);
fclose(fp_ou3);
}
+ fputs("</table></div>\n",fp_ou2);
write_html_trailer(fp_ou2);
fclose(fp_ou2);
}
+ fputs("</table></div>\n",fp_ou);
write_html_trailer(fp_ou);
fclose(fp_ou);
}
} **sortlist, *item, **tempsort;
sprintf(wdir,"%sindex.html",outdir);
- strcpy(hbc1,"class=\"header\"");
order=(strcmp(IndexSortOrder,"A") == 0) ? 1 : -1;
*/
getword_start(&gwarea,data);
if (getword_skip(16,&gwarea,' ')<0) {
- printf("SARG: Maybe you have a broken week day in your %s%s/sarg-date file.\n",outdir,direntp->d_name);
+ debuga(_("Maybe you have a broken week day in your %s%s/sarg-date file"),outdir,direntp->d_name);
exit(1);
}
if (getword_multisep(mon,sizeof(mon),&gwarea,' ')<0) {
- printf("SARG: Maybe you have a broken month in your %s%s/sarg-date file.\n",outdir,direntp->d_name);
+ debuga(_("Maybe you have a broken month in your %s%s/sarg-date file"),outdir,direntp->d_name);
exit(1);
}
if (getword_multisep(day,sizeof(day),&gwarea,' ')<0) {
- printf("SARG: Maybe you have a broken day in your %s%s/sarg-date file.\n",outdir,direntp->d_name);
+ debuga(_("Maybe you have a broken day in your %s%s/sarg-date file"),outdir,direntp->d_name);
exit(1);
}
if (getword_multisep(hour,sizeof(hour),&gwarea,' ')<0) {
- printf("SARG: Maybe you have a broken time in your %s%s/sarg-date file.\n",outdir,direntp->d_name);
+ debuga(_("Maybe you have a broken time in your %s%s/sarg-date file"),outdir,direntp->d_name);
exit(1);
}
do {
if (getword_multisep(year,sizeof(year),&gwarea,' ')<0) {
- printf("SARG: Maybe you have a broken year in your %s%s/sarg-date file.\n",outdir,direntp->d_name);
+ debuga(_("Maybe you have a broken year in your %s%s/sarg-date file"),outdir,direntp->d_name);
exit(1);
}
} while (year[0] && !isdigit(year[0])); //skip time zone information with spaces until the year is found
if (sscanf(hour,"%d:%d:%d",&ihour,&iminute,&isecond)!=3) {
- printf("SARG: Maybe you have a broken time in your %s%s/sarg-date file.\n",outdir,direntp->d_name);
+ debuga(_("Maybe you have a broken time in your %s%s/sarg-date file"),outdir,direntp->d_name);
exit(1);
}
buildymd(day,mon,year,ftime);
fprintf(stderr, "SARG: (index) %s: %s\n",text[45],wdir);
exit(1);
}
- write_html_header(fp_ou,".");
- fprintf(fp_ou,"<tr><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th></tr>\n",hbc1,text[101],hbc1,text[102],hbc1,text[103],hbc1,text[93],hbc1,text[96]);
+ write_html_header(fp_ou,0,"SARG reports");
+ close_html_header(fp_ou);
+ fputs("<div class=\"index\"><table cellpadding=\"1\" cellspacing=\"2\">\n<tr><td></td><td></td></tr>\n",fp_ou);
+ fprintf(fp_ou,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",text[101],text[102],text[103],text[93],text[96]);
for (i=0 ; i<nsort ; i++) {
if (order>0)
item=sortlist[i];
obttotal(outdir,item->dirname,tbytes,tuser,media);
fprintf(fp_ou,"<tr><td class=\"data2\"><a href='%s/%s'>%s</a></td><td class=\"data2\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",item->dirname,ReplaceIndex,item->dirname,item->date,tuser,tbytes,media);
}
+ fputs("</table></div>\n",fp_ou);
write_html_trailer(fp_ou);
fclose(fp_ou);