diff --git a/peek/peek.c b/peek/peek.c index dad45e7..f792800 100644 --- a/peek/peek.c +++ b/peek/peek.c @@ -21,11 +21,6 @@ int main(int argc, char *argv[]){ int p[2] = {0, 0}; struct termios t; - /* terminal echo */ - tcgetattr(STDIN_FILENO, &t); - t.c_lflag ^= ECHO; - tcsetattr(STDIN_FILENO, TCSAFLUSH, &t); - if(argc < 1) goto usage; @@ -74,6 +69,11 @@ usage: fprintf(stderr, "Usage: %s (-1eno)" goto die; } + /* terminal echo */ + tcgetattr(STDIN_FILENO, &t); + t.c_lflag ^= ECHO; + tcsetattr(STDIN_FILENO, TCSAFLUSH, &t); + do{ if((c = getc(stdin)) != eof || include_eof) for(i = 0; i < (sizeof outputs)/(sizeof *outputs); ++i) if(outputs[i] != 0