From b1c49cd2e29db9e2f71e31018f58eec480fec709 Mon Sep 17 00:00:00 2001 From: m0gg Date: Sun, 10 Dec 2006 12:23:40 +0000 Subject: Documentation enhancements --- examples/nanohttp/http_server.c | 46 +++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'examples') diff --git a/examples/nanohttp/http_server.c b/examples/nanohttp/http_server.c index 37ed073..a00c982 100644 --- a/examples/nanohttp/http_server.c +++ b/examples/nanohttp/http_server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: http_server.c,v 1.11 2006/12/02 21:50:47 m0gg Exp $ +* $Id: http_server.c,v 1.12 2006/12/10 12:23:45 m0gg Exp $ * * CSOAP Project: A http client/server library in C (example) * Copyright (C) 2003 Ferhat Ayaz @@ -142,45 +142,51 @@ int main(int argc, char **argv) herror_t status; hlog_set_level(HLOG_INFO); - if (httpd_init(argc, argv)) { - + if (httpd_init(argc, argv)) + { fprintf(stderr, "Cannot init httpd\n"); - return 1; + httpd_destroy(); + exit(1); } - if ((status = httpd_register("/", root_service)) != H_OK) { - + if ((status = httpd_register("/", root_service)) != H_OK) + { fprintf(stderr, "Cannot register service (%s)\n", herror_message(status)); herror_release(status); - return 1; + httpd_destroy(); + exit(1); } - if ((status = httpd_register_secure("/secure", secure_service, simple_authenticator)) != H_OK) { - + if ((status = httpd_register_secure("/secure", secure_service, simple_authenticator)) != H_OK) + { fprintf(stderr, "Cannot register secure service (%s)\n", herror_message(status)); herror_release(status); - return 1; + httpd_destroy(); + exit(1); } - if ((status = httpd_register("/headers", headers_service)) != H_OK) { - + if ((status = httpd_register("/headers", headers_service)) != H_OK) + { fprintf(stderr, "Cannot register headers service (%s)\n", herror_message(status)); herror_release(status); - return 1; + httpd_destroy(); + exit(1); } - if ((status = httpd_register_default("/error", default_service)) != H_OK) { - + if ((status = httpd_register_default("/error", default_service)) != H_OK) + { fprintf(stderr, "Cannot register default service (%s)\n", herror_message(status)); herror_release(status); - return 1; + httpd_destroy(); + exit(1); } - if (httpd_run()) { - - fprintf(stderr, "Cannot run httpd\n"); + if ((status = httpd_run()) != H_OK) + { + fprintf(stderr, "Cannot run httpd (%s)\n", herror_message(status)); herror_release(status); - return 1; + httpd_destroy(); + exit(1); } httpd_destroy(); -- cgit v1.1-32-gdbae