fixed
This commit is contained in:
parent
d0844c7fd6
commit
ec9f656358
1 changed files with 7 additions and 12 deletions
19
img.c
19
img.c
|
@ -12,14 +12,10 @@
|
||||||
|
|
||||||
struct DB_STR {
|
struct DB_STR {
|
||||||
char *filename;
|
char *filename;
|
||||||
char *desc;
|
|
||||||
|
|
||||||
struct stat stat;
|
|
||||||
char stat_filled;
|
|
||||||
|
|
||||||
char **tags;
|
char **tags;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
char *desc;
|
||||||
|
time_t birthtime;
|
||||||
struct DB_STR *next;
|
struct DB_STR *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -233,12 +229,11 @@ struct DB_STR *new_db_value(char *str) {
|
||||||
char new_path[PATH_MAX + 1];
|
char new_path[PATH_MAX + 1];
|
||||||
snprintf(new_path, sizeof(new_path) - 1, "%s/%s", ROOT, db->filename);
|
snprintf(new_path, sizeof(new_path) - 1, "%s/%s", ROOT, db->filename);
|
||||||
|
|
||||||
if (stat(new_path, &db->stat) < 0)
|
struct stat sb;
|
||||||
|
if (stat(new_path, &sb) < 0)
|
||||||
fprintf(stderr, "8img: stat: %s: %s\n", db->filename, strerror(errno));
|
fprintf(stderr, "8img: stat: %s: %s\n", db->filename, strerror(errno));
|
||||||
|
|
||||||
else
|
db->birthtime = sb.st_mtime;
|
||||||
db->stat_filled = 1;
|
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
|
|
||||||
NDV_CLOSE:
|
NDV_CLOSE:
|
||||||
|
@ -327,7 +322,7 @@ struct DB_STR *build_html_page(FILE *fp, const char *file, const struct UNIQ_TAG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp, "<a href='%s'>\n<img src='%s' alt='%s'></a><br>\n%s<br>\n", p->filename, p->filename, p->filename, GetDate(p->stat.st_ctime));
|
fprintf(fp, "<a href='%s'>\n<img src='%s' alt='%s'></a><br>\n%s<br>\n", p->filename, p->filename, p->filename, GetDate(p->birthtime));
|
||||||
for (size_t i = 0; i < p->size; i++)
|
for (size_t i = 0; i < p->size; i++)
|
||||||
fprintf(fp, " • <a href='%s.html'>%s</a>", p->tags[i], p->tags[i]);
|
fprintf(fp, " • <a href='%s.html'>%s</a>", p->tags[i], p->tags[i]);
|
||||||
|
|
||||||
|
@ -444,7 +439,7 @@ void build_xml(const char *file, struct DB_STR *db) {
|
||||||
p->filename,
|
p->filename,
|
||||||
LINK, CHECK_URL(LINK), p->filename,
|
LINK, CHECK_URL(LINK), p->filename,
|
||||||
LINK, CHECK_URL(LINK), p->filename,
|
LINK, CHECK_URL(LINK), p->filename,
|
||||||
GetDate(p->stat.st_ctime),
|
GetDate(p->birthtime),
|
||||||
LINK, CHECK_URL(LINK), p->filename);
|
LINK, CHECK_URL(LINK), p->filename);
|
||||||
|
|
||||||
/* Tags */
|
/* Tags */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue