aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-04-26 01:35:58 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-04-26 01:35:58 +0200
commitb278a7c1c38b9059c79a3069b76788f6c8a94c98 (patch)
treea78f3be7060359870665ca8422a8d940dbc85151
parentd5aef76ff4e96ed37792a32082930c43e2b881fc (diff)
downloadheadstripper-b278a7c1c38b9059c79a3069b76788f6c8a94c98.tar.gz
Now able to handle quotemarks for fileinput
-rw-r--r--src/main.c13
1 files changed, 12 insertions, 1 deletions
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)