From c5bc9e33dfa64bcdad553ee7ce9920357c035d33 Mon Sep 17 00:00:00 2001 From: guenther Date: Sun, 20 Jul 2014 08:12:45 +0000 Subject: [PATCH] More encryption tentacles: intr_happened and intr_waiting vanish Push more includes into .c files Make ring.c only need ring.h --- usr.bin/telnet/commands.c | 7 ++++++- usr.bin/telnet/externs.h | 4 +--- usr.bin/telnet/main.c | 5 ++++- usr.bin/telnet/network.c | 5 ++++- usr.bin/telnet/ring.c | 7 ++++--- usr.bin/telnet/ring.h | 6 +++--- usr.bin/telnet/sys_bsd.c | 13 +++++-------- usr.bin/telnet/telnet.c | 5 ++++- usr.bin/telnet/telnet_locl.h | 11 +---------- usr.bin/telnet/terminal.c | 4 +++- usr.bin/telnet/utilities.c | 5 ++++- 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 #include #include #include +#include #include #include +#include #include #include #include +#include +#include #include 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 +#include +#include #include 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 +#include #include 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 +#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 +#include +#include +#include #include +#include #include /* @@ -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 #include #include +#include +#include #include #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 -#include - -#include #include #include #include -#include -#include #include -#include - -#include #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 +#include #include 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 #include #include #include +#include +#include FILE *NetTrace = 0; /* Not in bss, since needs to stay */ int prettydump; -- 2.20.1