diff options
Diffstat (limited to 'src/blogc-runserver/main.c')
-rw-r--r-- | src/blogc-runserver/main.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/blogc-runserver/main.c b/src/blogc-runserver/main.c index 2a756f1..93f404a 100644 --- a/src/blogc-runserver/main.c +++ b/src/blogc-runserver/main.c @@ -87,9 +87,9 @@ guess_content_type(const char *filename, int fd) const char* charset = magic_descriptor(magic_charset, newfd); close(newfd); if (charset != NULL) - return sb_strdup_printf("%s; charset=%s", supported, charset); + return bc_strdup_printf("%s; charset=%s", supported, charset); } - return sb_strdup(supported); + return bc_strdup(supported); } libmagic: @@ -100,9 +100,9 @@ libmagic: const char* content_type = magic_descriptor(magic_all, newfd); close(newfd); if (content_type != NULL) - return sb_strdup(content_type); + return bc_strdup(content_type); } - return sb_strdup("application/octet-stream"); + return bc_strdup("application/octet-stream"); } @@ -128,7 +128,7 @@ handler(struct evhttp_request *request, void *ptr) goto point1; } - char *abs_path = sb_strdup_printf("%s/%s", root, decoded_path); + char *abs_path = bc_strdup_printf("%s/%s", root, decoded_path); char *real_path = realpath(abs_path, NULL); free(abs_path); @@ -162,10 +162,10 @@ handler(struct evhttp_request *request, void *ptr) for (unsigned int i = 0; content_types[i].mimetype != NULL; i++) { if (content_types[i].index == NULL) continue; - char *f = sb_strdup_printf("%s/%s", real_path, + char *f = bc_strdup_printf("%s/%s", real_path, content_types[i].index); if (0 == access(f, F_OK)) { - found = sb_strdup(f); + found = bc_strdup(f); break; } free(f); @@ -200,7 +200,7 @@ handler(struct evhttp_request *request, void *ptr) struct evkeyvalq *headers = evhttp_request_get_output_headers(request); if (add_slash) { - char *tmp = sb_strdup_printf("%s/", path); + char *tmp = bc_strdup_printf("%s/", path); evhttp_add_header(headers, "Location", tmp); free(tmp); // production webservers usually returns 301 in such cases, but 302 is @@ -210,7 +210,7 @@ handler(struct evhttp_request *request, void *ptr) } evhttp_add_header(headers, "Content-Type", type); - char *content_length = sb_strdup_printf("%zu", st.st_size); + char *content_length = bc_strdup_printf("%zu", st.st_size); evhttp_add_header(headers, "Content-Length", content_length); free(content_length); @@ -313,9 +313,9 @@ main(int argc, char **argv) goto cleanup; case 't': if (argv[i][2] != '\0') - host = sb_strdup(argv[i] + 2); + host = bc_strdup(argv[i] + 2); else - host = sb_strdup(argv[++i]); + host = bc_strdup(argv[++i]); break; case 'p': if (argv[i][2] != '\0') @@ -340,7 +340,7 @@ main(int argc, char **argv) goto cleanup; } args++; - docroot = sb_strdup(argv[i]); + docroot = bc_strdup(argv[i]); } } @@ -353,7 +353,7 @@ main(int argc, char **argv) } if (host == NULL) - host = sb_strdup("127.0.0.1"); + host = bc_strdup("127.0.0.1"); magic_all = magic_open(MAGIC_MIME); magic_charset = magic_open(MAGIC_MIME_ENCODING); |