diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-04-26 20:54:47 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-04-26 20:54:47 -0400 |
commit | 59c73efe2c924d4e142f5411fd40c41910d2116c (patch) | |
tree | 02afd97ba62136bec5e9a6900f993c611b7464bc | |
parent | 6ec488aea8b0177b8f665eb6d84a732e9abad97c (diff) |
actually read from stderr if possible, always end with a newline
-rw-r--r-- | more.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -777,6 +777,7 @@ static int more_cat(const char *path, void (*loop)(FILE *)) static void more_exit(void) { tcsetattr(fileno(more_in), TCSANOW, &more_term); + printf("\n"); } int main(int argc, char *argv[]) @@ -837,8 +838,8 @@ int main(int argc, char *argv[]) return ret; } - more_in = stderr; - if (1 || read(fileno(more_in), NULL, 0) == -1) { + more_in = fdopen(STDERR_FILENO, "r"); + if (more_in == NULL) { more_in = fopen("/dev/tty", "r"); } |