int main(int argc, char** argv) { webserver_initialise(); int rc = parseargs(argc, argv); if (rc)return rc; logconsole(PKGBANNER); logconsole(PKGBUILD); rc = opendb(); if (rc)return rc; webserver_set_defaults(); webserver_add_search_int("/stanox", corpus_find_stanox); webserver_add_search_int("/nlc", corpus_find_nlc); webserver_add_search_int("/uic", corpus_find_uic); webserver_add_search_str("/3alpha", corpus_find_3alpha); webserver_add_search_str("/tiploc", corpus_find_tiploc); logconsole("Starting webserver on port %d", webserver.port); webserver_start(); while (1) { sleep(60); } }
int webcam_run() { #ifdef HAVE_CAMERA // Our mandatory renderers, ensures they are run first being registered last struct Node *n = cameras.l_head; while (list_isNode(n)) { CAMERA camera = (CAMERA) n; n = n->n_succ; // Put annotated last list_addTail(&camera->renderers.renderers, &create_annotatedrenderer()->node); // These go first list_addHead(&camera->renderers.renderers, &create_thumbnailrenderer()->node); list_addHead(&camera->renderers.renderers, &create_rawrenderer()->node); } #endif // Now start the system up webserver_initialise(config); #ifdef HAVE_CAMERA // Initialise the renderers n = cameras.l_head; while (list_isNode(n)) { CAMERA camera = (CAMERA) n; n = n->n_succ; imagerenderer_init(camera); } #endif // Initialise the loggers logger_start(); // Finish off configuring the webserver, default port etc webserver_set_defaults(); #ifdef HAVE_CAMERA n = cameras.l_head; while (list_isNode(n)) { CAMERA camera = (CAMERA) n; n = n->n_succ; imagerenderer_postinit(camera); } #endif sensor_postinit(); // The camera home page //create_homepage(); // Start everything up webserver_start(); #ifdef HAVE_CAMERA camera_start(); #endif // Now the main loop, monitor for sensor updates //sensor_loop(); while (1) sleep(60); // Shutdown - we never actually get here webserver_stop(); logger_stop(); #ifdef HAVE_CAMERA camera_stop(); #endif return 0; }