version 1.37, 2015/03/23 12:31:19 |
version 1.38, 2019/06/28 13:35:02 |
|
|
int |
int |
ttraw(void) |
ttraw(void) |
{ |
{ |
if (tcgetattr(0, &oldtty) < 0) { |
if (tcgetattr(0, &oldtty) == -1) { |
dobeep(); |
dobeep(); |
ewprintf("ttopen can't get terminal attributes"); |
ewprintf("ttopen can't get terminal attributes"); |
return (FALSE); |
return (FALSE); |
|
|
newtty.c_oflag &= ~OPOST; |
newtty.c_oflag &= ~OPOST; |
newtty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); |
newtty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); |
|
|
if (tcsetattr(0, TCSASOFT | TCSADRAIN, &newtty) < 0) { |
if (tcsetattr(0, TCSASOFT | TCSADRAIN, &newtty) == -1) { |
dobeep(); |
dobeep(); |
ewprintf("ttopen can't tcsetattr"); |
ewprintf("ttopen can't tcsetattr"); |
return (FALSE); |
return (FALSE); |
|
|
ttcooked(void) |
ttcooked(void) |
{ |
{ |
ttflush(); |
ttflush(); |
if (tcsetattr(0, TCSASOFT | TCSADRAIN, &oldtty) < 0) { |
if (tcsetattr(0, TCSASOFT | TCSADRAIN, &oldtty) == -1) { |
dobeep(); |
dobeep(); |
ewprintf("ttclose can't tcsetattr"); |
ewprintf("ttclose can't tcsetattr"); |
return (FALSE); |
return (FALSE); |
|
|
{ |
{ |
int x; |
int x; |
|
|
return ((ioctl(0, FIONREAD, &x) < 0) ? 0 : x); |
return ((ioctl(0, FIONREAD, &x) == -1) ? 0 : x); |
} |
} |
|
|
/* |
/* |