diff options
-rw-r--r-- | bios_extract.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bios_extract.c b/bios_extract.c index 4075b96..0bd4dd9 100644 --- a/bios_extract.c +++ b/bios_extract.c @@ -39,14 +39,21 @@ HelpPrint(char *name) } unsigned char * MMapOutputFile(char *filename, int size) { unsigned char* Buffer; + char *tmp; int fd; + /* all slash signs '/' in filenames will be replaced by a + backslash sign '\' */ + tmp = filename; + while ((tmp = strchr(tmp, '/')) != NULL) + tmp[0] = '\\'; + fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (fd < 0) { fprintf(stderr, "Error: unable to open %s: %s\n\n", filename, strerror(errno)); return NULL; } @@ -107,13 +114,13 @@ main(int argc, char *argv[]) unsigned char *BIOSImage = NULL; int fd; uint32_t Offset1, Offset2; int i, len; unsigned char *tmp; - if ((argc != 2) || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){ + if ((argc != 2) || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){ HelpPrint(argv[0]); return 1; } fd = open(argv[1], O_RDONLY); if (fd < 0) { |