7 "AWeather is a free real-time weather data viewer that "
8 "supports Level-II NEXRAD files, polarimetric radars, "
9 "and volume rendering.";
13 {"about", "About", print_about, 0.7, NULL},
14 {"news", "News", print_news, 0.3, NULL},
15 {"manual", "Manual", print_manual, 0.5, NULL},
16 {"screenshots", "Screenshots", print_screenshots, 0.5, NULL},
17 {"download", "Download", print_download, 0.7, NULL},
18 {"development", "Development", print_development, 0.3, NULL},
19 {NULL, NULL, NULL, 0.0, NULL},
22 {"grits", "Grits", print_grits, 0.8, NULL},
23 {"rsl", "RSL", print_rsl, 0.3, NULL},
24 {NULL, NULL, NULL, 0.0, NULL},
27 {"contact", "Contact", print_contact, 0.2, NULL},
28 {NULL, NULL, NULL, 0.0, NULL},
31 {"", NULL, print_index, 1.0, desc},
32 {"oldnews", "Old News", print_oldnews, 0.2, NULL},
33 {NULL, "Not found", print_notfound, -1.0, NULL},
34 {NULL, NULL, NULL, 0.0, NULL},
36 const page_t *everything[] = {header, other, footer, special, NULL};
37 const page_t *index = &special[0];
38 const page_t *notfound = &special[2];
40 /* Helper functions */
41 void print_file(char *file)
44 FILE *fd = fopen(file, "r");
46 size_t size = fread(data, 1, sizeof(data), fd);
47 fwrite(data, 1, size, stdout);
52 int main(int argc, char **argv)
56 const char *name = getenv("PATH_INFO");
57 if (name == NULL || name[0] == '\0' || name[1] == '\0')
58 return print_page(index), 0;
60 /* Look up a specific page */
61 for (int i = 0; everything[i]; i++)
62 for (int j = 0; everything[i][j].link; j++) {
63 const page_t *page = &everything[i][j];
64 if (!strcmp(name+1, page->link))
65 return print_page(page), 0;
68 /* Print sitemap by itself */
69 if (!strcmp(name+1, "sitemap.xml"))
70 return print_sitemap(everything), 0;
73 return print_page(notfound), 0;