int main(int argc, char **argv) { static char *callback = NULL, *user; int i; extern int headers_initialized; if (argc < 2) { /* normal operation as a CGI application */ cgi_init(); atexit(cgi_end); cgi_process_form(); printf("Content-type: application/javascript; charset=utf-8\r\n\r\n"); } else interactive = 1; /* interactive mode for debugging */ wfdbquiet(); /* suppress WFDB library error messages */ atexit(cleanup); /* release allocated memory before exiting */ /* Define data sources to be accessed via this server. */ setrepos(); /* function defined in "setrepos.c" */ if (!(action = get_param("action"))) { print_file(LWDIR "/doc/about.txt"); exit(0); } if (!interactive && (callback = get_param("callback"))) { printf("%s(", callback); /* JSONP: "wrap" output in callback */ atexit(jsonp_end); /* close the output with ")" before exiting */ } if (strcmp(action, "dblist") == 0) dblist(); else if ((db = get_param("db")) == NULL) lwfail("Your request did not specify a database"); else if (strcmp(action, "rlist") == 0) rlist(); else if (strcmp(action, "alist") == 0) alist(); else if ((record = get_param("record")) == NULL) lwfail("Your request did not specify a record"); else if (strcmp(action, "info") == 0) info(); else if (strcmp(action, "fetch") == 0) fetch(); else lwfail("Your request did not specify a valid action"); exit(0); }
INTEGER wfdbquiet_(INTEGER *dummy) { wfdbquiet(); return (0L); }