printpkgicon: print the last two changelog entries and rework function to optimize code

This commit is contained in:
Silvan Calarco 2012-05-17 12:12:45 +02:00
parent 222691ea78
commit 4d081e2ee6
2 changed files with 35 additions and 31 deletions

View File

@ -1,4 +1 @@
VERSION = 1.2
VERSION = 1.2.1

View File

@ -152,37 +152,44 @@ void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceLi
char buffer[PATH_MAX];
char strdate[16];
if (s->updrepository >= 0) {
fprintf(fout,
"<img src=\"%s/pkgup.png\" ",
configtag->configdefaults->url_dir);
} else {
fprintf(fout,
"<img src=\"%s/pkg.png\" ",
configtag->configdefaults->url_dir);
}
if (s->changelog) {
simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate);
if (s->updrepository >= 0) {
fprintf(fout,
"<img src=\"%s/pkgup.png\" title=\"%s - %s (%s)\n%s\n\nUpdates package in %s\">",
configtag->configdefaults->url_dir,
strdate,
s->changelog->pkg->name,
s->changelog->release,
htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX),
configtag->repository[s->updrepository]->tag);
} else {
fprintf(fout,
"<img src=\"%s/pkg.png\" title=\"%s - %s (%s)\n%s\">",
configtag->configdefaults->url_dir,
strdate,
s->changelog->pkg->name,
s->changelog->release,
htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX));
fprintf(fout,
"title=\"%s - %s (%s)\n%s",
strdate,
s->changelog->pkg->name,
s->changelog->release,
htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX));
if (s->changelog->next) {
simpleTimeToHuman(s->changelog->next->time, (humanDate *) & strdate);
fprintf(fout,
"\n%s - %s (%s)\n%s",
strdate,
s->changelog->next->pkg->name,
s->changelog->next->release,
htmlcleanNoBr(s->changelog->next->text,buffer,PATH_MAX));
}
} else {
if (s->updrepository >= 0) {
fprintf(fout,
"<img src=\"%s/pkgup.png\" title=\"WARNING: missing changelog\n\nUpdates package in %s\">",
configtag->configdefaults->url_dir,
configtag->repository[s->updrepository]->tag);
} else {
fprintf(fout,
"<img src=\"%s/pkg.png\" title=\"WARNING: missing changelog\">",
configtag->configdefaults->url_dir);
}
fprintf(fout,
"title=\"WARNING: missing changelog");
}
if (s->updrepository >= 0) {
fprintf(fout,
"\n\nUpdates package in %s\">",
configtag->repository[s->updrepository]->tag);
} else {
fprintf(fout, "\">");
}
}