Thu Apr 23 00:03:41 2020 UTC ()
Don't play #define games with extern, just have a separate list to avoid commons


(joerg)
diff -r1.22 -r1.23 src/libexec/telnetd/ext.h
diff -r1.8 -r1.9 src/libexec/telnetd/global.c

cvs diff -r1.22 -r1.23 src/libexec/telnetd/ext.h (expand / switch to unified diff)

--- src/libexec/telnetd/ext.h 2012/01/10 23:39:11 1.22
+++ src/libexec/telnetd/ext.h 2020/04/23 00:03:40 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ext.h,v 1.22 2012/01/10 23:39:11 joerg Exp $ */ 1/* $NetBSD: ext.h,v 1.23 2020/04/23 00:03:40 joerg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993 4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -169,27 +169,27 @@ extern void @@ -169,27 +169,27 @@ extern void
169 169
170extern int output_data(const char *, ...) 170extern int output_data(const char *, ...)
171 __attribute__((__format__(__printf__, 1, 2))); 171 __attribute__((__format__(__printf__, 1, 2)));
172extern int output_datalen(const char *, size_t); 172extern int output_datalen(const char *, size_t);
173 173
174#ifdef ENCRYPTION 174#ifdef ENCRYPTION
175extern char *nclearto; 175extern char *nclearto;
176#endif /* ENCRYPTION */ 176#endif /* ENCRYPTION */
177 177
178/* 178/*
179 * The following are some clocks used to decide how to interpret 179 * The following are some clocks used to decide how to interpret
180 * the relationship between various variables. 180 * the relationship between various variables.
181 */ 181 */
182extern struct { 182extern struct clockstate {
183 int 183 int
184 system, /* what the current time is */ 184 system, /* what the current time is */
185 echotoggle, /* last time user entered echo character */ 185 echotoggle, /* last time user entered echo character */
186 modenegotiated, /* last time operating mode negotiated */ 186 modenegotiated, /* last time operating mode negotiated */
187 didnetreceive, /* last time we read data from network */ 187 didnetreceive, /* last time we read data from network */
188 ttypesubopt, /* ttype subopt is received */ 188 ttypesubopt, /* ttype subopt is received */
189 tspeedsubopt, /* tspeed subopt is received */ 189 tspeedsubopt, /* tspeed subopt is received */
190 environsubopt, /* environ subopt is received */ 190 environsubopt, /* environ subopt is received */
191 oenvironsubopt, /* old environ subopt is received */ 191 oenvironsubopt, /* old environ subopt is received */
192 xdisplocsubopt, /* xdisploc subopt is received */ 192 xdisplocsubopt, /* xdisploc subopt is received */
193 baseline, /* time started to do timed action */ 193 baseline, /* time started to do timed action */
194 gotDM; /* when did we last see a data mark */ 194 gotDM; /* when did we last see a data mark */
195} clocks; 195} clocks;

cvs diff -r1.8 -r1.9 src/libexec/telnetd/global.c (expand / switch to unified diff)

--- src/libexec/telnetd/global.c 2003/08/07 09:46:51 1.8
+++ src/libexec/telnetd/global.c 2020/04/23 00:03:40 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: global.c,v 1.8 2003/08/07 09:46:51 agc Exp $ */ 1/* $NetBSD: global.c,v 1.9 2020/04/23 00:03:40 joerg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993 4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,28 +24,73 @@ @@ -24,28 +24,73 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34#if 0 34#if 0
35static char sccsid[] = "@(#)global.c 8.1 (Berkeley) 6/4/93"; 35static char sccsid[] = "@(#)global.c 8.1 (Berkeley) 6/4/93";
36#else 36#else
37__RCSID("$NetBSD: global.c,v 1.8 2003/08/07 09:46:51 agc Exp $"); 37__RCSID("$NetBSD: global.c,v 1.9 2020/04/23 00:03:40 joerg Exp $");
38#endif 38#endif
39#endif /* not lint */ 39#endif /* not lint */
40 40
41/* 41/*
42 * Allocate global variables. We do this 42 * Allocate global variables. We do this
43 * by including the header file that defines 43 * by including the header file that defines
44 * them all as externs, but first we define 44 * them all as externs, but first we define
45 * the keyword "extern" to be nothing, so that 45 * the keyword "extern" to be nothing, so that
46 * we will actually allocate the space. 46 * we will actually allocate the space.
47 */ 47 */
48 48
49#include <defs.h> 49#include <defs.h>
50#define extern 
51#include <ext.h> 50#include <ext.h>
 51
 52char options[256];
 53char do_dont_resp[256];
 54char will_wont_resp[256];
 55int linemode; /* linemode on/off */
 56#ifdef LINEMODE
 57int uselinemode; /* what linemode to use (on/off) */
 58int editmode; /* edit modes in use */
 59int useeditmode; /* edit modes to use */
 60int alwayslinemode; /* command line option */
 61# ifdef KLUDGELINEMODE
 62int lmodetype; /* Client support for linemode */
 63# endif /* KLUDGELINEMODE */
 64#endif /* LINEMODE */
 65int flowmode; /* current flow control state */
 66int restartany; /* restart output on any character state */
 67#ifdef DIAGNOSTICS
 68int diagnostic; /* telnet diagnostic capabilities */
 69#endif /* DIAGNOSTICS */
 70#ifdef SECURELOGIN
 71int require_secure_login;
 72#endif
 73#ifdef AUTHENTICATION
 74int auth_level;
 75#endif
 76
 77slcfun slctab[NSLC + 1]; /* slc mapping table */
 78char terminaltype[41];
 79
 80/*
 81 * I/O data buffers, pointers, and counters.
 82 */
 83char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
 84char netibuf[BUFSIZ], *netip;
 85char netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
 86char *neturg; /* one past last bye of urgent data */
 87int pcc, ncc;
 88int pty, net;
 89char *line;
 90int SYNCHing; /* we are in TELNET SYNCH mode */
 91
 92#ifdef ENCRYPTION
 93char *nclearto;
 94#endif /* ENCRYPTION */
 95
 96struct clockstate clocks;