On Fri, Sep 16, 2016, at 04:10 PM, Martin Kühne wrote: > a few gripes: > > atoi: personally I prefer strtol and range-checks on the result and/or > errno. > getenv(LINES) is a start, but you might also want to offer > ioctl(TIOCGWINSZ) where available. > always NULL-check the return value of getenv.
Thanks for your feedback. As far as I understand it, this code char *lines = getenv("LINES"); int page_size = lines ? atoi(lines) : 24; does indeed check the return value of getenv. I don't know why it would segfault. > what does your pager do on binary input and unexpected things? does it > filter ansi escape sequences? These are good questions. I'll look into it and get back to you. What do you think appropriate behavior for binary input would be? It is a pager so it is not supposed to be used on binary input. It could abort or it could just ignore are two ideas off the top of my head. > how does it treat lines wider than the screen width, and how does that > influence the line count calculation? It does not take into account long longer than screen width, so in those cases the output will scroll off the screen. Perhaps I'll add that feature. Thanks for good suggestions.