From b278a7c1c38b9059c79a3069b76788f6c8a94c98 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Fri, 26 Apr 2019 01:35:58 +0200 Subject: Now able to handle quotemarks for fileinput --- src/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 68c1489..e77ae5f 100644 --- a/src/main.c +++ b/src/main.c @@ -85,7 +85,18 @@ int main(int argc, char* argv[]) for(unsigned int cntr = 1; cntr < argc; cntr++) { - char *filename = argv[cntr]; + char *filename; + + if (argv[cntr][0] == '"') + { + unsigned int len = strlen(&argv[cntr][1]); + filename = malloc(len); + strcpy(filename, &argv[cntr][1]); + filename[len - 2] = '\0'; + } + else + filename = argv[cntr]; + //Read magic val image = fopen(filename, "rb"); if(!image) -- cgit v1.2.3