Open
Conversation
fix -6 and -q option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
getoptsparsing so-6is treated as a flag (not as an option with an argument), and declare that-qexpects a value per usage.Background / Problem
When using
-6(Force IPv6), subsequent options are ignored. Example:Expected:
-n,-C,-xshould apply (fping-style output with-C, one sample with-x 1).Actual:
-6consumes the next flag (e.g.,-n), option parsing stops early, and output falls back to default traceroute lines.Root Cause
In the
getoptsstring,-6is mistakenly defined as requiring an argument:The
:after6makes-6consume the next token.Fix
Remove the
:after6, and add:afterqsince-qexpects a value per usage:Testing
Manually tested:
Output format matches
-Cand-x 1as expected.Note
This PR description (including the proposed fix) was generated by AI for reference and has been manually tested.