From 4e82f1e44c418fa76530630a0b844aff4b89c11f Mon Sep 17 00:00:00 2001 From: prx Date: Wed, 9 Dec 2020 08:31:18 +0100 Subject: [PATCH] remove unused extension and fix warnings --- Makefile | 2 ++ main.c | 3 +-- mimes.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7db8e30..5225483 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ PREFIX?=/usr/local/ +CFLAGS += -pedantic -Wall -Wextra -Wmissing-prototypes \ + -Wstrict-prototypes -Wwrite-strings all: vger diff --git a/main.c b/main.c index 46d920c..2cec63a 100644 --- a/main.c +++ b/main.c @@ -97,7 +97,6 @@ display_file(const char *path, const char *lang) struct stat sb; ssize_t nread; char *buffer[BUFSIZ]; - char extension[10]; const char *file_mime; /* this is to check if path is a directory */ @@ -211,7 +210,7 @@ main(int argc, char **argv) if (pos != NULL) { /* if there is a / found */ int position = -1; - for (int i = 0; i < sizeof(request); i++) { + for (size_t i = 0; i < sizeof(request); i++) { if (*pos == request[i]) { position = i; break; diff --git a/mimes.c b/mimes.c index c58b6ce..2293551 100644 --- a/mimes.c +++ b/mimes.c @@ -120,7 +120,7 @@ static const struct { const char * get_file_mime(const char *path) { - int i; + size_t i; char *extension; if ((extension = strrchr(path, '.')) == NULL)