aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-runserver/main.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-09-03 20:42:17 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-09-03 20:42:17 +0200
commita319fe44f6d50d25f546e17ad9907eedd9a358a0 (patch)
tree4fdca76c71af9cc78ae2683fa3d8a1589a78d71c /src/blogc-runserver/main.c
parent6c5adce7b557c696cb6b5a5ebd4cd1e9380ac419 (diff)
downloadblogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.tar.gz
blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.tar.bz2
blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.zip
*: s/sb_/bc_/g
Diffstat (limited to 'src/blogc-runserver/main.c')
-rw-r--r--src/blogc-runserver/main.c26
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);