diff options
-rw-r--r-- | src/common.c | 10 | ||||
-rw-r--r-- | src/common.h | 2 | ||||
-rw-r--r-- | src/main.c | 2 |
3 files changed, 1 insertions, 13 deletions
diff --git a/src/common.c b/src/common.c index 15d1eae..b103cfe 100644 --- a/src/common.c +++ b/src/common.c @@ -32,16 +32,6 @@ int catfile(char* path) { } -int file_exists(char* path) { - FILE* fd; - fd = fopen(path, "r"); - if(!fd) - return 2; - fclose(fd); - return 1; -} - - int html_read_title(char* path, char* out) { char buf[TITLE_MAX]; int start = 0; diff --git a/src/common.h b/src/common.h index 03529dd..aef4d87 100644 --- a/src/common.h +++ b/src/common.h @@ -26,8 +26,6 @@ int catfile(char*); -int file_exists(char*); - int html_read_title(char*, char*); char* runsh(char*); @@ -67,7 +67,7 @@ int main(int argc, char* argv[], char* envp[]) { // If the file does not exist, set status to 404 and set the page to be // printed to the 404 page. - if(file_exists(path) == 2) { + if(access(path, F_OK) != 0) { status = 404; sprintf(path, "%s/%s.html", posts, "404"); strcpy(title, ": 404"); |