diff options
-rw-r--r-- | config.h | 8 | ||||
-rw-r--r-- | pages.c | 17 |
2 files changed, 23 insertions, 2 deletions
@@ -24,6 +24,7 @@ enum flag RSS = 1<<1, RSSIMAGES = 1<<2, PINNED = 1<<3, + GIRLNUMBERS = 1<<4, }; struct page @@ -106,6 +107,11 @@ static const int post_count = 10; static const char *base_url = "https://danieljon.es/posts/"; static const char *author_string = "daniel@danieljon.es (Daniel Jones)"; +/* girlnumbers for blog post count */ +static const char *girlnumber_url = "https://danieljon.es/"; +static const char *girlnumber_dir = "/media/numbers/"; +static const char *girlnumber_extension = ".gif"; + /* each page to be generated go into this array */ static const struct page pages[] = { /* function flags */ @@ -117,7 +123,7 @@ static const struct page pages[] = { {opinions_animepage, NONE}, {opinions_everythingpage, NONE}, {portfoliopage, NONE}, - {postspage, RSS|RSSIMAGES|PINNED}, /* flags: RSS feed, RSS images, pinned posts */ + {postspage, RSS|RSSIMAGES|PINNED|GIRLNUMBERS}, /* flags: RSS feed, RSS images, pinned posts, girl numbers */ }; #endif @@ -615,7 +615,22 @@ writeposts(const int *posts, size_t totalposts, const char *outfile, int current * we do this because we want page 1 to contain the last blog posts not actually the first and so on */ post = totalposts - posts[x]; - fprintf(tmp, "post #%d<br>\n<a href='direct/%d.html'>direct link</a><br>\n", post, post); + if (flags & GIRLNUMBERS) + { + char num[4] = {0}; /* will never have more than 999 posts */ + snprintf(num, 4, "%d", post); + num[3] = '\0'; + fprintf(tmp, "\n<a href='direct/%d.html'>", post); + for (int i = 0; i < strlen(num); i++) + { + fprintf(tmp, "<img height='70' src=\"%s/%s/%c%s\">", girlnumber_url, girlnumber_dir, num[i], girlnumber_extension); + } + fprintf(tmp, "</a>\n"); + } + else + { + fprintf(tmp, "post #%d<br>\n<a href='direct/%d.html'>direct link</a><br>\n", post, post); + } snprintf(source, 512, "%s%d.txt", posts_content, post); postfile = fopen(source, "r"); if (!postfile) |