From b87440c3811445bfa60cc973663069cf42d4323d Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 24 Mar 2020 14:54:12 -0400 Subject: TTY check --- tests/test_str_print_banner.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_str_print_banner.c b/tests/test_str_print_banner.c index 0ca09fd..3a5de8b 100644 --- a/tests/test_str_print_banner.c +++ b/tests/test_str_print_banner.c @@ -5,6 +5,12 @@ const char *testFmt = "case %zu: '%s' is length %zu, expected %zu\n"; const char *testFmtChars = "case %zu: '%s' got '%c' (pos: %zu), expected '%c'\n"; int main(int argc, char *argv[]) { + char *tty_path = NULL; + if ((tty_path = ttyname(STDOUT_FILENO)) == NULL) { + perror("tty check"); + return 0; + } + const int max_banner = 'z'; const int max_banner_len = 80; char buf[BUFSIZ] = {0,}; @@ -40,4 +46,4 @@ int main(int argc, char *argv[]) { dup2(stdout_save, STDOUT_FILENO); setvbuf(stdout, NULL, _IONBF, 0); } -} \ No newline at end of file +} -- cgit