Skip to content

Commit

Permalink
Options: Allow filename at any location in option arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbbbr committed Oct 12, 2024
1 parent ab36f24 commit 14367b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
# Version 1.3.0
- `-b:HEXVAL:[...]` Set hex bytes treated as Empty in ROM files (.gb/etc) (default `FF`(255), ex use 255 AND 0: `-b:FF:00`
- Improve error messaging
- Allow filename at any location in option arguments

# Version 1.2.9
- `-nMEM` Hide memory regions with case sensitive substring (ex hide all RAM: `-nMEM:RAM`)
Expand Down
10 changes: 5 additions & 5 deletions src/romusage.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,8 @@ int handle_args(int argc, char * argv[]) {
return false;
}

// Copy input filename (if not preceded with option dash)
if (argv[1][0] != '-')
snprintf(filename_in, sizeof(filename_in), "%s", argv[1]);

// Start at first optional argument, argc is zero based
for (i = 1; i <= (argc -1); i++ ) {
for (i = 0; i <= (argc -1); i++ ) {

if (strstr(argv[i], "-h") == argv[i]) {
display_help(HELP_FULL);
Expand Down Expand Up @@ -238,6 +234,10 @@ int handle_args(int argc, char * argv[]) {
return false;
}

// Copy input filename (if not preceded with option dash)
else if (argv[i][0] != '-') {
snprintf(filename_in, sizeof(filename_in), "%s", argv[i]);
}
}

return true;
Expand Down

0 comments on commit 14367b1

Please sign in to comment.