/[imapfilter]/imapfilter/tty.c
ViewVC logotype

Diff of /imapfilter/tty.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9.2.1 by lefcha, Fri Aug 8 00:28:03 2003 UTC revision 1.12 by lefcha, Fri Feb 13 13:18:38 2004 UTC
# Line 19  static struct termios otio, ntio;      /* Ori Line 19  static struct termios otio, ntio;      /* Ori
19  int  int
20  tty_store(void)  tty_store(void)
21  {  {
22    
23          if (isatty(fileno(stdin))) {          if (isatty(fileno(stdin))) {
24                  flags |= FLAG_TTY;                  flags |= FLAG_TTY;
25    
# Line 35  tty_store(void) Line 36  tty_store(void)
36   * Disable echo.   * Disable echo.
37   */   */
38  int  int
39  tty_disable_echo(void)  tty_noecho(void)
40  {  {
41    
42          if (!(flags & FLAG_TTY))          if (!(flags & FLAG_TTY))
43                  return 0;                  return 0;
44    
45          ntio = otio;          ntio = otio;
46          ntio.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);          ntio.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
47    
48          flags |= FLAG_TTY_MODIFIED;          flags |= FLAG_TTYMOD;
49    
50          if (tcsetattr(fileno(stdin), TCSAFLUSH, &ntio)) {          if (tcsetattr(fileno(stdin), TCSAFLUSH, &ntio)) {
51                  error("setting term attributes; %s\n", strerror(errno));                  error("setting term attributes; %s\n", strerror(errno));
# Line 59  tty_disable_echo(void) Line 61  tty_disable_echo(void)
61  int  int
62  tty_restore(void)  tty_restore(void)
63  {  {
64          if (!(flags & FLAG_TTY) || !(flags & FLAG_TTY_MODIFIED))  
65            if (!(flags & FLAG_TTY) || !(flags & FLAG_TTYMOD))
66                  return 0;                  return 0;
67    
68          if (tcsetattr(fileno(stdin), TCSAFLUSH, &otio)) {          if (tcsetattr(fileno(stdin), TCSAFLUSH, &otio)) {
69                  error("setting term attributes; %s\n", strerror(errno));                  error("setting term attributes; %s\n", strerror(errno));
70                  return ERROR_TERMIO;                  return ERROR_TERMIO;
71          }          }
72          flags &= ~(FLAG_TTY_MODIFIED);          flags &= ~(FLAG_TTYMOD);
73    
74          return 0;          return 0;
75  }  }

Legend:
Removed from v.1.9.2.1  
changed lines
  Added in v.1.12

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26