Skip to content

Commit 9aff38b

Browse files
committed
[net] Don't discard output when ^C typed, use ^C^O instead
1 parent b220759 commit 9aff38b

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

elks/arch/i86/drivers/char/pty.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
/* /dev/ptyp0 master (PTY) open */
2121
int pty_open(struct inode *inode, struct file *file)
2222
{
23-
register struct tty *otty;
23+
register struct tty *tty;
2424

25-
if (!(otty = determine_tty(inode->i_rdev))) {
25+
if (!(tty = determine_tty(inode->i_rdev))) {
2626
debug("pty open fail NODEV\n");
2727
return -ENODEV;
2828
}
29-
if (otty->flags & TTY_OPEN) {
29+
if (tty->flags & TTY_OPEN) {
3030
debug("pty open fail BUSY\n");
3131
return -EBUSY;
3232
}
@@ -36,11 +36,11 @@ int pty_open(struct inode *inode, struct file *file)
3636
/* /dev/ptyp0 master close */
3737
void pty_release(struct inode *inode, struct file *file)
3838
{
39-
register struct tty *otty;
39+
register struct tty *tty;
4040

4141
debug("pty release\n");
42-
if ((otty = determine_tty(inode->i_rdev)))
43-
kill_pg(otty->pgrp, SIGHUP, 1);
42+
if ((tty = determine_tty(inode->i_rdev)))
43+
kill_pg(tty->pgrp, SIGHUP, 1);
4444
}
4545

4646
/* /dev/ptyp0 master select */
@@ -94,7 +94,7 @@ size_t pty_read (struct inode *inode, struct file *file, char *data, size_t len)
9494
break;
9595
}
9696

97-
put_user_char (tty_outproc (tty), (void *)(data++));
97+
put_user_char (tty_outproc (tty), data++);
9898
count++;
9999
}
100100

elks/net/ipv4/af_inet.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linuxmt/in.h>
2424
#include <linuxmt/tcpdev.h>
2525
#include <linuxmt/debug.h>
26+
#include <arch/irq.h>
2627

2728
#include "af_inet.h"
2829

@@ -369,7 +370,7 @@ static int inet_write(register struct socket *sock, char *ubuf, int size,
369370
if (ret == -ERESTARTSYS) {
370371
/* delay process 100ms*/
371372
current->state = TASK_INTERRUPTIBLE;
372-
current->timeout = jiffies + (HZ / 10); /* 1/10 sec = 100ms*/
373+
current->timeout = jiffies() + (HZ / 10); /* 1/10 sec = 100ms*/
373374
schedule();
374375
} else
375376
return ret;

elkscmd/inet/telnet.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
#include <sys/types.h>
1010
#include <sys/ioctl.h>
11-
#include <errno.h>
1211
#include <fcntl.h>
1312
#include <termios.h>
1413
#include <signal.h>
@@ -101,9 +100,12 @@ read_keyboard(void)
101100
fprintf(stderr, "\nSession terminated\n");
102101
finish();
103102
}
103+
#if DISABLED
104104
if (buffer[0] == CTRL('C'))
105105
discard = 1;
106-
else if (buffer[0] == CTRL('O')) {
106+
else
107+
#endif
108+
if (buffer[0] == CTRL('O')) {
107109
discard ^= 1;
108110
return;
109111
}
@@ -224,7 +226,7 @@ main(int argc, char **argv)
224226
termios.c_lflag &= ~ISIG; /* ISIG off to disable ^N/^O/^P */
225227
#ifdef RAWTELNET
226228
termios.c_iflag &= ~(ICRNL | IGNCR | INLCR | IXON | IXOFF);
227-
termios.c_lflag &= ~(ECHO | ECHONL | ICANON)
229+
termios.c_lflag &= ~(ECHO | ECHONL | ICANON);
228230
#endif
229231
tcsetattr(0, TCSANOW, &termios);
230232
nonblock = 1;
@@ -239,7 +241,7 @@ main(int argc, char **argv)
239241
FD_SET(0, &fdset);
240242
FD_SET(tcp_fd, &fdset);
241243
tv.tv_sec = 0;
242-
tv.tv_usec = 100000L;
244+
tv.tv_usec = 100000L; /* 100ms */
243245

244246
n = select(tcp_fd + 1, &fdset, NULL, NULL, &tv);
245247
if (n == 0) {

0 commit comments

Comments
 (0)