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

Document the use of the V* constants for the c_cc field #8

Closed
notthetup opened this issue Nov 29, 2021 · 4 comments · Fixed by #9
Closed

Document the use of the V* constants for the c_cc field #8

notthetup opened this issue Nov 29, 2021 · 4 comments · Fixed by #9

Comments

@notthetup
Copy link

notthetup commented Nov 29, 2021

The use of the V* constants like VMIN and VTIME isn't well documented and can lead to an off-by-one error since Julian arrays are 1-based indexed, while the constants are the same as the libc versions which are for 0-based indexing arrays.

So doing something like this, which is very intuitive, sets the incorrect value in the struct.

opts = T.termios()
opts.c_cc[T.VMIN] = 0
opts.c_cc[T.VTIME] = 1
@kdheepak
Copy link
Owner

I see, that makes sense, I didn’t think about that. Would you like to submit a PR? It’s only a couple of lines that you’ll have to modify.

@notthetup
Copy link
Author

notthetup commented Nov 30, 2021

Sure. I can raise a PR. What do you think is a better approach to fix this?

  • Change the values of the V* constants.
  • Do the index conversion in the getindex, setindex methods.

I am leaning towards the later..

I'll also try to add an example to the documentation.

@kdheepak
Copy link
Owner

I'm up for the latter! Thanks for offering to submit a PR!

@notthetup
Copy link
Author

Thanks @kdheepak!

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 a pull request may close this issue.

2 participants