diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-03-05 01:38:12 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-03-05 01:38:12 +0100 |
commit | 1390e77b0742a9fd38ca9986f76f04a7ffab16a4 (patch) | |
tree | d7d09cf64c9ed526372f1cf19136935d9379eb09 /src/blogc-runserver/main.c | |
parent | 326530ab1a26e2e09e2ab9143f9194eb96fc2829 (diff) | |
download | blogc-1390e77b0742a9fd38ca9986f76f04a7ffab16a4.tar.gz blogc-1390e77b0742a9fd38ca9986f76f04a7ffab16a4.tar.bz2 blogc-1390e77b0742a9fd38ca9986f76f04a7ffab16a4.zip |
runserver: implemented ipv6 support
Diffstat (limited to 'src/blogc-runserver/main.c')
-rw-r--r-- | src/blogc-runserver/main.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/blogc-runserver/main.c b/src/blogc-runserver/main.c index 4624527..0eef9f1 100644 --- a/src/blogc-runserver/main.c +++ b/src/blogc-runserver/main.c @@ -58,8 +58,8 @@ main(int argc, char **argv) int rv = 0; char *host = NULL; + char *port = NULL; char *docroot = NULL; - unsigned short port = 8080; size_t max_threads = 20; char *ptr; char *endptr; @@ -83,13 +83,9 @@ main(int argc, char **argv) break; case 'p': if (argv[i][2] != '\0') - ptr = argv[i] + 2; + port = bc_strdup(argv[i] + 2); else - ptr = argv[++i]; - port = strtoul(ptr, &endptr, 10); - if (*ptr != '\0' && *endptr != '\0') - fprintf(stderr, "blogc-runserver: warning: invalid value " - "for -p argument: %s. using %hu instead\n", ptr, port); + port = bc_strdup(argv[++i]); break; case 'm': if (argv[i][2] != '\0') @@ -141,10 +137,14 @@ main(int argc, char **argv) if (host == NULL) host = bc_strdup("127.0.0.1"); + if (port == NULL) + port = bc_strdup("8080"); + rv = br_httpd_run(host, port, docroot, max_threads); cleanup: free(host); + free(port); free(docroot); return rv; |