Mercurial > urweb
annotate src/c/static.c @ 1922:5890ba37827c
Add -print-cinlude command line option
author | Sergey Mironov <grrwlf@gmail.com> |
---|---|
date | Wed, 06 Nov 2013 13:54:07 +0400 |
parents | 2d9f831d45c9 |
children | c93fbd139732 |
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@1814 | 28 uw_initialize(ctx); |
adam@1493 | 29 |
adam@1498 | 30 while (1) { |
adam@1498 | 31 fk = uw_begin(ctx, argv[1]); |
adam@1498 | 32 |
adam@1498 | 33 if (fk == SUCCESS) { |
adam@1498 | 34 uw_print(ctx, 1); |
adam@1498 | 35 puts(""); |
adam@1498 | 36 return 0; |
adam@1498 | 37 } else if (fk != UNLIMITED_RETRY) { |
adam@1498 | 38 fprintf(stderr, "Error: %s\n", uw_error_message(ctx)); |
adam@1498 | 39 return 1; |
adam@1498 | 40 } |
adam@1502 | 41 |
adam@1502 | 42 uw_reset(ctx); |
adam@1493 | 43 } |
adam@1493 | 44 } |
adam@1493 | 45 |
adam@1493 | 46 void *uw_init_client_data() { |
adam@1493 | 47 return NULL; |
adam@1493 | 48 } |
adam@1493 | 49 |
adam@1493 | 50 void uw_free_client_data(void *data) { |
adam@1493 | 51 } |
adam@1493 | 52 |
adam@1493 | 53 void uw_copy_client_data(void *dst, void *src) { |
adam@1493 | 54 } |
adam@1493 | 55 |
adam@1493 | 56 void uw_do_expunge(uw_context ctx, uw_Basis_client cli, void *data) { |
adam@1493 | 57 } |
adam@1493 | 58 |
adam@1493 | 59 void uw_post_expunge(uw_context ctx, void *data) { |
adam@1493 | 60 } |
adam@1493 | 61 |
adam@1493 | 62 int uw_supports_direct_status = 0; |