diff options
author | Jason Linehan <patientulysses@gmail.com> | 2012-06-06 21:12:35 -0400 |
---|---|---|
committer | Jason Linehan <patientulysses@gmail.com> | 2012-06-06 21:12:35 -0400 |
commit | 53ba2ea47220c5f726ccfd5bb3372f134fc22c93 (patch) | |
tree | b9133ea3bcb2bb810f0f4601a7a5b25173b8afea | |
parent | 4f0e7059ae007bca1833478742569f3108b7aac9 (diff) | |
download | cloth-53ba2ea47220c5f726ccfd5bb3372f134fc22c93.tar.gz cloth-53ba2ea47220c5f726ccfd5bb3372f134fc22c93.tar.bz2 cloth-53ba2ea47220c5f726ccfd5bb3372f134fc22c93.zip |
Movin' stuff around
-rw-r--r-- | cloth.c | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -176,24 +176,6 @@ void log(int type, char *msg, char *requester, int socket_num) * The main function called by the child process when a request is made * on the socket being listened to by the server. ******************************************************************************/ -/** - * Work out the file type and check we support it - */ -inline char *get_file_extension(char *buf, size_t buflen) -{ - size_t len; - int i; - - for (i=0; extensions[i].ext != NULL; i++) { - len = strlen(extensions[i].ext); - if (!strncmp(&buf[buflen-len], extensions[i].ext, len)) { - return extensions[i].filetype; - } - } - return NULL; -} - - /** * web -- child web process that gets forked (so we can exit on error) * @fd : socket file descriptor @@ -293,6 +275,24 @@ void web(int fd, int hit) * and then proceeds to listen on it for requests. It will serve the file * parameter given at program start if a valid request is received. ******************************************************************************/ +/** + * Work out the file type and check we support it + */ +inline char *get_file_extension(char *buf, size_t buflen) +{ + size_t len; + int i; + + for (i=0; extensions[i].ext != NULL; i++) { + len = strlen(extensions[i].ext); + if (!strncmp(&buf[buflen-len], extensions[i].ext, len)) { + return extensions[i].filetype; + } + } + return NULL; +} + + /** * main -- start the server, check the args, and fork into the background */ @@ -321,7 +321,7 @@ int main(int argc, char **argv) /* Check that directory exists */ if (chdir(argv[2]) == -1) { - printf("ERROR: Can't Change to directory %s\n", argv[2]); + printf("ERROR: Can't change to directory %s\n", argv[2]); exit(4); } |