X-Git-Url: http://pileus.org/git/?p=~andy%2Faweather-web;a=blobdiff_plain;f=index.c;h=32423a36d23f5f0976a0fcf0b2120b9789630cb7;hp=d66adffaab86e0da1dac99035dcf4931dc417e24;hb=61fb4b6e914bea7713f072876ee221d755a7d016;hpb=49bfe2490d94cf946b9fd521c69ee1ea46a3ee67 diff --git a/index.c b/index.c index d66adff..32423a3 100644 --- a/index.c +++ b/index.c @@ -1,32 +1,38 @@ #include #include "html.h" +const char desc[] = + "AWeather is a free real-time weather data viewer that " + "supports Level-II NEXRAD files, polarimetric radars, " + "and volume rendering."; + /* Page data */ page_t header[] = { - {"about", "About", print_about}, - {"news", "News", print_news}, - {"screenshots", "Screenshots", print_screenshots}, - {"download", "Download", print_download}, - {"development", "Development", print_development}, - {NULL, NULL, NULL}, + {"about", "About", print_about, 0.7, NULL}, + {"news", "News", print_news, 0.3, NULL}, + {"screenshots", "Screenshots", print_screenshots, 0.5, NULL}, + {"download", "Download", print_download, 0.7, NULL}, + {"development", "Development", print_development, 0.3, NULL}, + {NULL, NULL, NULL, 0.0, NULL}, }; -page_t grits[] = { - {"grits", "Grits", print_grits}, - {NULL, NULL, NULL}, +page_t other[] = { + {"grits", "Grits", print_grits, 0.8, NULL}, + {"rsl", "RSL", print_rsl, 0.3, NULL}, + {NULL, NULL, NULL, 0.0, NULL}, }; page_t footer[] = { - {"contact", "Contact", print_contact}, - {"legal", "Legal", print_legal}, - {NULL, NULL, NULL}, + {"contact", "Contact", print_contact, 0.2, NULL}, + {NULL, NULL, NULL, 0.0, NULL}, }; page_t special[] = { - {"index.cgi", NULL, print_index}, - {"notfound", "Not found", print_notfound}, - {NULL, NULL, NULL}, + {"", NULL, print_index, 1.0, desc}, + {"oldnews", "Old News", print_oldnews, 0.2, NULL}, + {NULL, "Not found", print_notfound, -1.0, NULL}, + {NULL, NULL, NULL, 0.0, NULL}, }; -page_t *everything[] = {header, grits, footer, special, NULL}; -const page_t *index = &special[0]; -const page_t *notfound = &special[1]; +const page_t *everything[] = {header, other, footer, special, NULL}; +const page_t *index = &special[0]; +const page_t *notfound = &special[1]; /* Main */ int main(int argc, char **argv) @@ -40,11 +46,15 @@ int main(int argc, char **argv) /* Look up a specific page */ for (int i = 0; everything[i]; i++) for (int j = 0; everything[i][j].link; j++) { - page_t *page = &everything[i][j]; - if (g_str_equal(page->link, name+1)) + const page_t *page = &everything[i][j]; + if (g_str_equal(name+1, page->link)) return print_page(page), 0; } + /* Print sitemap by itself */ + if (g_str_equal(name+1, "sitemap.xml")) + return print_sitemap(everything), 0; + /* 404 */ return print_page(notfound), 0; }