@@ -29,7 +29,6 @@ kbhit(void) {
29
29
30
30
int byteswaiting ;
31
31
struct termios term ;
32
- term .c_cc [VERASE ] = 127 ;
33
32
tcgetattr (0 , & term );
34
33
fd_set fds ;
35
34
struct timespec ts = {0 };
@@ -54,9 +53,7 @@ raw(char *fmt, ...) {
54
53
va_start (ap , fmt );
55
54
vsnprintf (sbuf , BUFF , fmt , ap );
56
55
va_end (ap );
57
-
58
56
if (verb ) printf ("<< %s" , sbuf );
59
-
60
57
write (conn , sbuf , strlen (sbuf ));
61
58
}
62
59
@@ -162,7 +159,6 @@ main(int argc, char **argv) {
162
159
163
160
int fd [2 ], cval ;
164
161
165
-
166
162
while ((cval = getopt (argc , argv , "s:p:n:k:c:w:W:vV" )) != -1 ) {
167
163
switch (cval ) {
168
164
case 'v' : puts ("kirc 0.0.1" ); break ;
@@ -200,23 +196,27 @@ main(int argc, char **argv) {
200
196
pars (sl , sbuf );
201
197
if (read (fd [0 ], u , cmax ) > 0 ) {
202
198
for (i = 0 ; u [i ] != '\n' ; i ++ ) continue ;
203
- if (u [0 ] != ':' ) {
204
- raw ("%-*.*s\r\n" , i , i , u );
205
- printf ("\x1b[1A\x1b[K\x1b[36m%-*.*s\x1b[0m\n" , i , i , u );
206
- }
199
+ if (u [0 ] != ':' ) raw ("%-*.*s\r\n" , i , i , u );
207
200
}
208
201
}
209
- printf ("%*s \x1b[31mpress <RETURN> key to quit... \x1b[0m" , gutl , " " );
202
+ printf ("%*s \x1b[31mpress <RETURN> key to exit \x1b[0m\n " , gutl , " " );
210
203
}
211
204
else {
212
205
char usrin [cmax ], val1 [cmax ], val2 [20 ];
206
+ struct termios tp , save ;
207
+
208
+ tcgetattr (STDIN_FILENO , & tp );
209
+ save = tp ;
210
+ tp .c_cc [VERASE ] = 127 ;
213
211
214
212
while (waitpid (pid , NULL , WNOHANG ) == 0 ) {
215
213
while (!kbhit () && waitpid (pid , NULL , WNOHANG ) == 0 ) {
216
214
dprintf (fd [1 ], ":\n" );
217
215
}
218
216
217
+ tcsetattr (STDIN_FILENO , TCSANOW , & tp );
219
218
fgets (usrin , cmax , stdin );
219
+ tcsetattr (STDIN_FILENO , TCSANOW , & save );
220
220
221
221
if (usrin [0 ] == ':' ) {
222
222
switch (usrin [1 ]) {
0 commit comments