Skip to content
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

Added port ranges to received specifications #48

Merged
merged 1 commit into from
Jul 8, 2017

Conversation

cfsmp3
Copy link
Contributor

@cfsmp3 cfsmp3 commented Apr 19, 2017

So now this is legal:

127.0.0.1/7301
also this
127.0.0.1/7301-7310 (means create receivers on port 7301 to 7310 inclusive)
also this
127.0.0.1/7301+10 (means create 10 receivers starting at 7310, so it's the same as above).

Copy link
Owner

@sleinen sleinen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for your contribution!

I'll merge this, but it would be nice if you could send another PR to address my comment about return 1 vs. return -1, and also add a few tests to parsetest.c to verify the new code—and to make sure that it won't be broken by later changes.

{
char *newarg=(char *) malloc (strlen (argv[j]+1));
if (!newarg)
return 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer return -1, because that's the convention for error codes in the rest of the code. (Repeats here in a few places.)

suffix++;
for (int k=first;k<=last;k++)
{
char *newarg=(char *) malloc (strlen (argv[j]+1));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to convince myself that this length is always sufficient. The (decimal representation of) the port number can become larger by incrementing, but the total length should not exceed the original length when you include the range specification. So that looks fine.

@sleinen sleinen merged commit c8695b7 into sleinen:master Jul 8, 2017
@sleinen sleinen mentioned this pull request Nov 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants