svn commit: r314685 - head/bin/ps
Ed Schouten
ed at nuxi.nl
Sun Mar 5 20:19:33 UTC 2017
Hi Conrad,
2017-03-05 0:08 GMT+01:00 Conrad Meyer <cem at freebsd.org>:
>> - If something is a TTY, then our implementation of the TTY layer
>> guarantees that TIOCGWINSZ always works.
>
> Do you know if it did in 1990 too? It's hard to tell why Marc@ made
> this change way back then. I wasn't sure so I left it alone.
I can't tell. :-)
>> - If we're only interested in testing stdout whether it's a TTY, I
>> think it makes little sense to check TIOCGWINSZ on stdin, stderr.
>>
>> I think there would therefore be very little harm to use something like this:
>>
>> | if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0')
>> | termwidth = atoi(cols);
>> | else if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) ==
>> -1 && ws.ws_row == 0)
>
> Shouldn't this remain || ws.ws_row == 0?
Err, yes. ||, not &&.
--
Ed Schouten <ed at nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
More information about the svn-src-head
mailing list