-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix dos33.c getopt for BSAVE arguments #22
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
d03c721
to
05def98
Compare
Tested on Linux and MacOSX arm64, with and without optional BSAVE Also verifies this fixes Makefile targets that use dos33, for example project in
With this change, it now succeeds:
|
Hi @jquast, and thanks for giving attention to my issue! As mentioned in #18, there's no reason to avoid using Cheers! |
utils/dos33fs-utils/dos33.c
Outdated
retval = -ERROR_INVALID_PARAMATER; | ||
goto exit_and_close; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment on #22 for why this section is unnecessary.
aacd574
to
b2c43ea
Compare
deater#18 - tested on OSX and Debian arm64 - bugfix display of length when `-d` debug is used - small fixes to usage terms
b2c43ea
to
4fa77b5
Compare
@micahcowan Sorry that it took so long to reply, it is because I could not implement the code like you request. BSD and Linux differ very much in regards to While I was able to use getopt a second time, please review, it does require re-scanning for position of BSAVE in argv after it is mutated and resetting optind, and, re-parsing for All of this is described with a very long comment inline, but I will re-describe the most important issue here. Linux mutates argv after processing, while bsd does not, and this causes any second-pass processing of argv to be unreliable to perform on both systems.
while ((c = getopt(argc, argv, "a:l:t:s:dhvxy")) != -1)
argv[0]=../dos33
argv[1]=-d
- argv[2]=test.dsk
- argv[3]=BSAVE
- argv[4]=-a
- argv[5]=0x100
- argv[6]=-l
- argv[7]=1
+ argv[2]=-a
+ argv[3]=0x100
+ argv[4]=-l
+ argv[5]=1
+ argv[6]=test.dsk
+ argv[7]=BSAVE
argv[8]=SINCOS
argv[9]=abc
Also exclusive to linux, when While on BSD, things are much simpler, argv is not mutated, and |
@jquast Before we go any further, I should maybe point out that in my experience @deater hasn't had much of a tendency to respond to or incorporate pull requests, so probably won't see this anyway (I'm sorry I didn't point this out earlier, before you'd done the work). I'm not really clear on why GNU getopt's permuation of argv should present a problem for my proposed solution that re-invokes getopt, but somehow not for yours which does the same... not least because no actual reinvocation is necessary on the platform that actually does this permutation. But I guess it's time to stop explaining with words, and start showing code. #23 demonstrates the concept I meant. It's probably not perfect, but I believe it has the following advantages over this implementation (#22):
If you see the merit in this approach, please feel free to take it over and adapt it in your (this) pull request. Mine lacks your regression test, and could (IMO) be improved by moving the whole |
Fix dos33.c getopt for BSAVE arguments on non-linux systems, #18
-d
debug is used<>
pairs should be[]