diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-04-26 01:35:58 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-04-26 01:35:58 +0200 |
commit | b278a7c1c38b9059c79a3069b76788f6c8a94c98 (patch) | |
tree | a78f3be7060359870665ca8422a8d940dbc85151 | |
parent | d5aef76ff4e96ed37792a32082930c43e2b881fc (diff) | |
download | headstripper-b278a7c1c38b9059c79a3069b76788f6c8a94c98.tar.gz |
Now able to handle quotemarks for fileinput
-rw-r--r-- | src/main.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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) |