Skip to content

Add -j opt to filter output by JID#2

Merged
Freaky merged 1 commit intoFreaky:masterfrom
zeylos:filter_jid
Feb 25, 2020
Merged

Add -j opt to filter output by JID#2
Freaky merged 1 commit intoFreaky:masterfrom
zeylos:filter_jid

Conversation

@zeylos
Copy link
Copy Markdown

@zeylos zeylos commented Feb 25, 2020

Hello,

As said in the title, I added the -j option to filter output by JID number.
I'm not a developer so my PR may be wrong (or even garbage), any criticism is welcomed.

Anyway thanks for the good work !

Copy link
Copy Markdown
Owner

@Freaky Freaky left a comment

Choose a reason for hiding this comment

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

A couple of nits, nothing serious. Not like Github breaking repeatedly trying to submit this review :P

Comment thread checkrestart.c
}

while ((ch = getopt(argc, argv, "bHw")) != -1) {
while ((ch = getopt(argc, argv, "bHwj:")) != -1) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Should be sorted alphabetically, so "bHj:w"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

(And sort the switch the same way)

Comment thread checkrestart.c
termwidth = 0;
break;
case 'j':
jid = atoi(optarg);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

From atoi(3):

The atoi() function has been deprecated by strtol() and should not be used in new code.

There's a parse_int() function in checkrestart to make it easier to handle correctly, e.g:

if (!parse_int(optarg, &jid) || jid < 0) {
    usage();
}

@Freaky Freaky merged commit 40419e6 into Freaky:master Feb 25, 2020
@Freaky
Copy link
Copy Markdown
Owner

Freaky commented Feb 25, 2020

Will make tweaks myself. Thanks!

@zeylos zeylos deleted the filter_jid branch February 26, 2020 10:26
@zeylos
Copy link
Copy Markdown
Author

zeylos commented Feb 26, 2020

Ah my bad I didn't know atoi was deprecated.
Thanks a lot for the explainations !

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.

2 participants