annotate src/c/static.c @ 2253:d665925acff8

Factor out [Monoize.Fm] to make it accessible to [Sqlcache].
author Ziv Scully <ziv@mit.edu>
date Mon, 21 Sep 2015 14:54:07 -0400
parents c39c48696393
children
rev   line source
adam@1493 1 #include "config.h"
adam@1493 2
adam@1493 3 #include <stdio.h>
adam@1493 4 #include <stdarg.h>
adam@1493 5
adam@1493 6 #include "urweb.h"
adam@1493 7
adam@1493 8 extern uw_app uw_application;
adam@1493 9
grrwlf@1997 10 static void log_(void *data, const char *fmt, ...) {
adam@1493 11 va_list ap;
adam@1493 12 va_start(ap, fmt);
adam@1493 13
adam@1493 14 vprintf(fmt, ap);
adam@1493 15 }
adam@1493 16
grrwlf@1997 17 static uw_loggers loggers = {NULL, log_, log_};
grrwlf@1997 18
adam@2137 19 static char *get_header(void *data, const char *h) {
adam@2137 20 return NULL;
adam@2137 21 }
adam@2137 22
adam@1493 23 int main(int argc, char *argv[]) {
adam@1493 24 uw_context ctx;
adam@1493 25 failure_kind fk;
adam@1493 26
adam@1493 27 if (argc != 2) {
adam@1493 28 fprintf(stderr, "Pass exactly one argument: the URI to run\n");
adam@1493 29 return 1;
adam@1493 30 }
adam@1493 31
grrwlf@1997 32 ctx = uw_init(0, &loggers);
adam@1493 33 uw_set_app(ctx, &uw_application);
adam@2137 34 uw_set_headers(ctx, get_header, NULL);
adam@1814 35 uw_initialize(ctx);
adam@1493 36
adam@1498 37 while (1) {
adam@1498 38 fk = uw_begin(ctx, argv[1]);
adam@1498 39
julian@2162 40 if (fk == SUCCESS || fk == RETURN_INDIRECTLY) {
adam@1498 41 uw_print(ctx, 1);
adam@1498 42 puts("");
adam@1498 43 return 0;
adam@1498 44 } else if (fk != UNLIMITED_RETRY) {
adam@1498 45 fprintf(stderr, "Error: %s\n", uw_error_message(ctx));
adam@1498 46 return 1;
adam@1498 47 }
adam@1502 48
adam@1502 49 uw_reset(ctx);
adam@1493 50 }
adam@1493 51 }
adam@1493 52
adam@1493 53 void *uw_init_client_data() {
adam@1493 54 return NULL;
adam@1493 55 }
adam@1493 56
adam@1493 57 void uw_free_client_data(void *data) {
adam@1493 58 }
adam@1493 59
adam@1493 60 void uw_copy_client_data(void *dst, void *src) {
adam@1493 61 }
adam@1493 62
adam@1493 63 void uw_do_expunge(uw_context ctx, uw_Basis_client cli, void *data) {
adam@1493 64 }
adam@1493 65
adam@1493 66 void uw_post_expunge(uw_context ctx, void *data) {
adam@1493 67 }
adam@1493 68
adam@1493 69 int uw_supports_direct_status = 0;