Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | #include "includes.h" | - |
39 | | - |
40 | #include <sys/types.h> | - |
41 | #include <stdio.h> | - |
42 | #include <termios.h> | - |
43 | #include <pwd.h> | - |
44 | | - |
45 | #include "sshpty.h" | - |
46 | | - |
47 | static struct termios _saved_tio; | - |
48 | static int _in_raw_mode = 0; | - |
49 | | - |
50 | struct termios * | - |
51 | get_saved_tio(void) | - |
52 | { | - |
53 | return _in_raw_mode ? &_saved_tio : NULL; never executed: return _in_raw_mode ? &_saved_tio : ((void *)0) ; TRUE | never evaluated | FALSE | never evaluated |
| 0 |
54 | } | - |
55 | | - |
56 | void | - |
57 | leave_raw_mode(int quiet) | - |
58 | { | - |
59 | if (!_in_raw_mode)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
60 | return; never executed: return; | 0 |
61 | if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
62 | if (!quiet)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
63 | perror("tcsetattr"); never executed: perror("tcsetattr"); | 0 |
64 | } else never executed: end of block | 0 |
65 | _in_raw_mode = 0; never executed: _in_raw_mode = 0; | 0 |
66 | } | - |
67 | | - |
68 | void | - |
69 | enter_raw_mode(int quiet) | - |
70 | { | - |
71 | struct termios tio; | - |
72 | | - |
73 | if (tcgetattr(fileno(stdin), &tio) == -1) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
74 | if (!quiet)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
75 | perror("tcgetattr"); never executed: perror("tcgetattr"); | 0 |
76 | return; never executed: return; | 0 |
77 | } | - |
78 | _saved_tio = tio; | - |
79 | tio.c_iflag |= IGNPAR; | - |
80 | tio.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXANY | IXOFF); | - |
81 | #ifdef IUCLC | - |
82 | tio.c_iflag &= ~IUCLC; | - |
83 | #endif | - |
84 | tio.c_lflag &= ~(ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHONL); | - |
85 | #ifdef IEXTEN | - |
86 | tio.c_lflag &= ~IEXTEN; | - |
87 | #endif | - |
88 | tio.c_oflag &= ~OPOST; | - |
89 | tio.c_cc[VMIN] = 1; | - |
90 | tio.c_cc[VTIME] = 0; | - |
91 | if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
92 | if (!quiet)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
93 | perror("tcsetattr"); never executed: perror("tcsetattr"); | 0 |
94 | } else never executed: end of block | 0 |
95 | _in_raw_mode = 1; never executed: _in_raw_mode = 1; | 0 |
96 | } | - |
| | |