chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
02a51ab
)
util: reset nl/cr flags on terminal when resetting
author
Lennart Poettering
<lennart@poettering.net>
Tue, 13 Apr 2010 16:51:22 +0000
(18:51 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 13 Apr 2010 16:51:22 +0000
(18:51 +0200)
util.c
patch
|
blob
|
history
diff --git
a/util.c
b/util.c
index a1b9f1e0f1ed0cef45a420d60526cff3f0beb6cf..17ee09c1f7d23da9782c3db0b4432f505c7579d0 100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-1422,14
+1422,18
@@
int reset_terminal(int fd) {
assert(fd >= 0);
assert(fd >= 0);
- /* Set terminal
up for job control
*/
+ /* Set terminal
to some sane defaults
*/
if (tcgetattr(fd, &termios) < 0) {
r = -errno;
goto finish;
}
if (tcgetattr(fd, &termios) < 0) {
r = -errno;
goto finish;
}
- termios.c_iflag &= ~(IGNBRK | BRKINT);
+ /* We only reset the stuff that matters to the software. How
+ * hardware is set up we don't touch assuming that somebody
+ * else will do that for us */
+
+ termios.c_iflag &= ~(IGNBRK | BRKINT | ISTRIP | INLCR | IGNCR | IUCLC);
termios.c_iflag |= ICRNL | IMAXBEL | IUTF8;
termios.c_oflag |= ONLCR;
termios.c_cflag |= CREAD;
termios.c_iflag |= ICRNL | IMAXBEL | IUTF8;
termios.c_oflag |= ONLCR;
termios.c_cflag |= CREAD;
@@
-1446,6
+1450,8
@@
int reset_terminal(int fd) {
termios.c_cc[VLNEXT] = 026; /* ^V */
termios.c_cc[VWERASE] = 027; /* ^W */
termios.c_cc[VREPRINT] = 022; /* ^R */
termios.c_cc[VLNEXT] = 026; /* ^V */
termios.c_cc[VWERASE] = 027; /* ^W */
termios.c_cc[VREPRINT] = 022; /* ^R */
+ termios.c_cc[VEOL] = 0;
+ termios.c_cc[VEOL2] = 0;
termios.c_cc[VTIME] = 0;
termios.c_cc[VMIN] = 1;
termios.c_cc[VTIME] = 0;
termios.c_cc[VMIN] = 1;