summaryrefslogtreecommitdiff
path: root/usr.bin/telnet
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-07-20 08:12:47 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-07-20 08:12:47 +0000
commit6feff68679fa79fb1ff1752324c2c2ef565a69e9 (patch)
tree3e55324d1a678cd3d3c3159f452d0e3c13a7d4ef /usr.bin/telnet
parent5611d5d792f8e87d9e53bcbf77927c3e325e09f6 (diff)
More encryption tentacles: intr_happened and intr_waiting vanish
Push more includes into .c files Make ring.c only need ring.h
Diffstat (limited to 'usr.bin/telnet')
-rw-r--r--usr.bin/telnet/commands.c7
-rw-r--r--usr.bin/telnet/externs.h4
-rw-r--r--usr.bin/telnet/main.c5
-rw-r--r--usr.bin/telnet/network.c5
-rw-r--r--usr.bin/telnet/ring.c7
-rw-r--r--usr.bin/telnet/ring.h6
-rw-r--r--usr.bin/telnet/sys_bsd.c13
-rw-r--r--usr.bin/telnet/telnet.c5
-rw-r--r--usr.bin/telnet/telnet_locl.h11
-rw-r--r--usr.bin/telnet/terminal.c4
-rw-r--r--usr.bin/telnet/utilities.c5
11 files changed, 39 insertions, 33 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index a3e360b6d4e..7e81c725371 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.61 2014/07/20 07:35:04 guenther Exp $ */
+/* $OpenBSD: commands.c,v 1.62 2014/07/20 08:12:45 guenther Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -32,15 +32,20 @@
#include "telnet_locl.h"
+#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
+#include <arpa/telnet.h>
#include <ctype.h>
#include <err.h>
+#include <errno.h>
#include <netdb.h>
#include <pwd.h>
#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
int tos = -1;
diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h
index 0ba00ae3d59..b8b1aee8b8c 100644
--- a/usr.bin/telnet/externs.h
+++ b/usr.bin/telnet/externs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: externs.h,v 1.21 2014/07/20 07:35:04 guenther Exp $ */
+/* $OpenBSD: externs.h,v 1.22 2014/07/20 08:12:45 guenther Exp $ */
/* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
/*
@@ -64,8 +64,6 @@ extern int
termdata, /* Print out terminal data flow */
debug; /* Debug level */
-extern volatile sig_atomic_t intr_happened, intr_waiting; /* for interrupt handling */
-
extern cc_t escape; /* Escape to command mode */
extern cc_t rlogin; /* Rlogin mode escape character */
#ifdef KLUDGELINEMODE
diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c
index e4faa49d323..abc6ef1b328 100644
--- a/usr.bin/telnet/main.c
+++ b/usr.bin/telnet/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.25 2014/07/20 06:39:41 guenther Exp $ */
+/* $OpenBSD: main.c,v 1.26 2014/07/20 08:12:45 guenther Exp $ */
/* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */
/*
@@ -32,6 +32,9 @@
#include "telnet_locl.h"
+#include <sys/socket.h>
+#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
int family = AF_UNSPEC;
diff --git a/usr.bin/telnet/network.c b/usr.bin/telnet/network.c
index f14ad7d754f..5cf14bb4e7c 100644
--- a/usr.bin/telnet/network.c
+++ b/usr.bin/telnet/network.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: network.c,v 1.12 2014/07/20 06:24:19 guenther Exp $ */
+/* $OpenBSD: network.c,v 1.13 2014/07/20 08:12:46 guenther Exp $ */
/* $NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $ */
/*
@@ -31,6 +31,9 @@
*/
#include "telnet_locl.h"
+
+#include <sys/socket.h>
+#include <errno.h>
#include <poll.h>
Ring netoring, netiring;
diff --git a/usr.bin/telnet/ring.c b/usr.bin/telnet/ring.c
index c08f604fe4f..d6833e8d744 100644
--- a/usr.bin/telnet/ring.c
+++ b/usr.bin/telnet/ring.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ring.c,v 1.7 2014/07/20 06:24:19 guenther Exp $ */
+/* $OpenBSD: ring.c,v 1.8 2014/07/20 08:12:46 guenther Exp $ */
/* $NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $ */
/*
@@ -30,7 +30,8 @@
* SUCH DAMAGE.
*/
-#include "telnet_locl.h"
+#include <string.h>
+#include "ring.h"
/*
* This defines a structure for a ring buffer.
@@ -66,7 +67,7 @@
* to ZERO on allocation, we need to make sure, when interpreting the
* clock, that when the times are EQUAL, then the buffer is FULL.
*/
-static u_long ring_clock = 0;
+static unsigned long ring_clock = 0;
#define ring_empty(d) (((d)->consume == (d)->supply) && \
diff --git a/usr.bin/telnet/ring.h b/usr.bin/telnet/ring.h
index bc8266849de..16526d0ad0a 100644
--- a/usr.bin/telnet/ring.h
+++ b/usr.bin/telnet/ring.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ring.h,v 1.8 2014/07/20 06:24:19 guenther Exp $ */
+/* $OpenBSD: ring.h,v 1.9 2014/07/20 08:12:46 guenther Exp $ */
/* $NetBSD: ring.h,v 1.5 1996/02/28 21:04:09 thorpej Exp $ */
/*
@@ -49,8 +49,8 @@ typedef struct {
unsigned char *top; /* highest address+1 in buffer */
unsigned char *mark; /* marker (user defined) */
int size; /* size in bytes of buffer */
- u_long consumetime; /* help us keep straight full, empty, etc. */
- u_long supplytime;
+ unsigned long consumetime; /* help us keep straight full, empty, etc. */
+ unsigned long supplytime;
} Ring;
/* Here are some functions and macros to deal with the ring buffer */
diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c
index 1c63e5db5a3..5ab638771ef 100644
--- a/usr.bin/telnet/sys_bsd.c
+++ b/usr.bin/telnet/sys_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_bsd.c,v 1.19 2014/07/20 07:35:04 guenther Exp $ */
+/* $OpenBSD: sys_bsd.c,v 1.20 2014/07/20 08:12:46 guenther Exp $ */
/* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */
/*
@@ -33,7 +33,11 @@
#include "telnet_locl.h"
#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <arpa/telnet.h>
+#include <errno.h>
#include <poll.h>
+#include <string.h>
#include <unistd.h>
/*
@@ -578,18 +582,11 @@ deadpeer(sig)
longjmp(peerdied, -1);
}
-volatile sig_atomic_t intr_happened = 0;
-volatile sig_atomic_t intr_waiting = 0;
-
/* ARGSUSED */
void
intr(sig)
int sig;
{
- if (intr_waiting) {
- intr_happened = 1;
- return;
- }
if (localchars) {
intp();
return;
diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c
index 4793180a814..f582f059963 100644
--- a/usr.bin/telnet/telnet.c
+++ b/usr.bin/telnet/telnet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: telnet.c,v 1.23 2014/07/20 06:39:41 guenther Exp $ */
+/* $OpenBSD: telnet.c,v 1.24 2014/07/20 08:12:46 guenther Exp $ */
/* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */
/*
@@ -32,8 +32,11 @@
#include "telnet_locl.h"
+#include <arpa/telnet.h>
#include <ctype.h>
#include <curses.h>
+#include <stdlib.h>
+#include <string.h>
#include <term.h>
#define strip(x) (eight ? (x) : ((x) & 0x7f))
diff --git a/usr.bin/telnet/telnet_locl.h b/usr.bin/telnet/telnet_locl.h
index a3c177f6fee..c6e02599ca1 100644
--- a/usr.bin/telnet/telnet_locl.h
+++ b/usr.bin/telnet/telnet_locl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: telnet_locl.h,v 1.8 2014/07/20 07:35:04 guenther Exp $ */
+/* $OpenBSD: telnet_locl.h,v 1.9 2014/07/20 08:12:46 guenther Exp $ */
/* $KTH: telnet_locl.h,v 1.13 1997/11/03 21:37:55 assar Exp $ */
/*
@@ -39,19 +39,10 @@
* SUCH DAMAGE.
*/
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <errno.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <termios.h>
-#include <time.h>
-
-#include <arpa/telnet.h>
#include "ring.h"
#include "externs.h"
diff --git a/usr.bin/telnet/terminal.c b/usr.bin/telnet/terminal.c
index 16d0b390d7d..988f327d3f8 100644
--- a/usr.bin/telnet/terminal.c
+++ b/usr.bin/telnet/terminal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: terminal.c,v 1.9 2014/07/20 07:35:04 guenther Exp $ */
+/* $OpenBSD: terminal.c,v 1.10 2014/07/20 08:12:46 guenther Exp $ */
/* $NetBSD: terminal.c,v 1.5 1996/02/28 21:04:17 thorpej Exp $ */
/*
@@ -32,6 +32,8 @@
#include "telnet_locl.h"
+#include <arpa/telnet.h>
+#include <errno.h>
#include <unistd.h>
Ring ttyoring, ttyiring;
diff --git a/usr.bin/telnet/utilities.c b/usr.bin/telnet/utilities.c
index 3f1757f960c..4fdf36bc8ff 100644
--- a/usr.bin/telnet/utilities.c
+++ b/usr.bin/telnet/utilities.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utilities.c,v 1.15 2014/07/20 07:34:43 guenther Exp $ */
+/* $OpenBSD: utilities.c,v 1.16 2014/07/20 08:12:46 guenther Exp $ */
/* $NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $ */
/*
@@ -37,9 +37,12 @@
#include "telnet_locl.h"
+#include <arpa/telnet.h>
#include <ctype.h>
#include <limits.h>
#include <poll.h>
+#include <stdlib.h>
+#include <string.h>
FILE *NetTrace = 0; /* Not in bss, since needs to stay */
int prettydump;