From: Francois Fleuret Date: Tue, 17 Mar 2009 19:31:00 +0000 (+0100) Subject: Added a test to check we do have a tty (and not a pipe in). X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=951d423cb3aa421a271c287d45702fb0072d4681;p=selector.git Added a test to check we do have a tty (and not a pipe in). --- diff --git a/selector.cc b/selector.cc index 9dafd4d..cfb583e 100644 --- a/selector.cc +++ b/selector.cc @@ -388,6 +388,12 @@ void update_screen(int *current_line, int *temporary_line, int motion, ////////////////////////////////////////////////////////////////////// int main(int argc, char **argv) { + + if(!ttyname(STDIN_FILENO)) { + cerr << "Error: the standard input is not a tty." << endl; + exit(1); + } + char buffer[buffer_size]; int color_fg_modeline, color_bg_modeline; int color_fg_highlight, color_bg_highlight;