Mercurial > urweb
annotate src/c/static.c @ 1493:9cb923efea4d
Generated pretty-printed HTML for a simple tutorial source file
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 15 Jul 2011 16:50:55 -0400 |
parents | |
children | 8c32c7191bf0 |
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 |
adam@1493 | 10 static void log_debug(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 |
adam@1493 | 17 int main(int argc, char *argv[]) { |
adam@1493 | 18 uw_context ctx; |
adam@1493 | 19 failure_kind fk; |
adam@1493 | 20 |
adam@1493 | 21 if (argc != 2) { |
adam@1493 | 22 fprintf(stderr, "Pass exactly one argument: the URI to run\n"); |
adam@1493 | 23 return 1; |
adam@1493 | 24 } |
adam@1493 | 25 |
adam@1493 | 26 ctx = uw_init(0, NULL, log_debug); |
adam@1493 | 27 uw_set_app(ctx, &uw_application); |
adam@1493 | 28 fk = uw_begin(ctx, argv[1]); |
adam@1493 | 29 |
adam@1493 | 30 if (fk == SUCCESS) { |
adam@1493 | 31 uw_print(ctx, 1); |
adam@1493 | 32 puts(""); |
adam@1493 | 33 return 0; |
adam@1493 | 34 } else { |
adam@1493 | 35 fprintf(stderr, "Error!\n"); |
adam@1493 | 36 return 1; |
adam@1493 | 37 } |
adam@1493 | 38 } |
adam@1493 | 39 |
adam@1493 | 40 void *uw_init_client_data() { |
adam@1493 | 41 return NULL; |
adam@1493 | 42 } |
adam@1493 | 43 |
adam@1493 | 44 void uw_free_client_data(void *data) { |
adam@1493 | 45 } |
adam@1493 | 46 |
adam@1493 | 47 void uw_copy_client_data(void *dst, void *src) { |
adam@1493 | 48 } |
adam@1493 | 49 |
adam@1493 | 50 void uw_do_expunge(uw_context ctx, uw_Basis_client cli, void *data) { |
adam@1493 | 51 } |
adam@1493 | 52 |
adam@1493 | 53 void uw_post_expunge(uw_context ctx, void *data) { |
adam@1493 | 54 } |
adam@1493 | 55 |
adam@1493 | 56 int uw_supports_direct_status = 0; |