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

Add case insensitive commands #5

Open
ark- opened this issue May 26, 2021 · 2 comments
Open

Add case insensitive commands #5

ark- opened this issue May 26, 2021 · 2 comments

Comments

@ark-
Copy link

ark- commented May 26, 2021

It would be nice if the command string wasn't case sensitive.

Something along the lines of adding it as an OPTIONAL parameter to addCommand().

This could be implemented by using strupr() or strlwr() in addCommand() when adding to the _commandList . Then use the same (lower or upper) function in the readSerial() function. Specifically here:

if (strncmp(command, _commandList[i].command, ST_NUM_COMMAND_CHARS) == 0) {

The conversion would only be carried out if configured to do so.

@Erriez
Copy link
Owner

Erriez commented May 26, 2021

Thanks for your feedback. What do you think of replacingstrncmp() with strncasecmp() to perform case insensitive comparison of all commands?

@ark-
Copy link
Author

ark- commented Jun 9, 2021

I think that would be a better solution 👍

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

No branches or pull requests

2 participants