Thu Apr 23 00:35:14 2020 UTC ()
Avoid using common symbol definitions.


(joerg)
diff -r1.62 -r1.63 src/usr.bin/tip/tip.c
diff -r1.33 -r1.34 src/usr.bin/tip/tip.h

cvs diff -r1.62 -r1.63 src/usr.bin/tip/tip.c (expand / switch to unified diff)

--- src/usr.bin/tip/tip.c 2019/02/28 17:41:27 1.62
+++ src/usr.bin/tip/tip.c 2020/04/23 00:35:14 1.63
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tip.c,v 1.62 2019/02/28 17:41:27 gson Exp $ */ 1/* $NetBSD: tip.c,v 1.63 2020/04/23 00:35:14 joerg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1983, 1993 4 * Copyright (c) 1983, 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.
@@ -32,38 +32,102 @@ @@ -32,38 +32,102 @@
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#include <ctype.h> 33#include <ctype.h>
34#include <libgen.h> 34#include <libgen.h>
35 35
36#ifndef lint 36#ifndef lint
37__COPYRIGHT("@(#) Copyright (c) 1983, 1993\ 37__COPYRIGHT("@(#) Copyright (c) 1983, 1993\
38 The Regents of the University of California. All rights reserved."); 38 The Regents of the University of California. All rights reserved.");
39#endif /* not lint */ 39#endif /* not lint */
40 40
41#ifndef lint 41#ifndef lint
42#if 0 42#if 0
43static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93"; 43static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
44#endif 44#endif
45__RCSID("$NetBSD: tip.c,v 1.62 2019/02/28 17:41:27 gson Exp $"); 45__RCSID("$NetBSD: tip.c,v 1.63 2020/04/23 00:35:14 joerg Exp $");
46#endif /* not lint */ 46#endif /* not lint */
47 47
48/* 48/*
49 * tip - UNIX link to other systems 49 * tip - UNIX link to other systems
50 * tip [-v] [-speed] system-name 50 * tip [-v] [-speed] system-name
51 * or 51 * or
52 * cu [options] [phone-number|"dir"] 52 * cu [options] [phone-number|"dir"]
53 */ 53 */
54#include "tip.h" 54#include "tip.h"
55#include "pathnames.h" 55#include "pathnames.h"
56 56
 57struct termios term;
 58struct termios defterm;
 59struct termios defchars;
 60
 61FILE *fscript;
 62
 63int attndes[2];
 64int fildes[2];
 65int repdes[2];
 66int FD;
 67#ifndef __lint__ /* not used by hayes.c, but used by some other dialers */
 68int AC;
 69#endif /*__lint__*/
 70int sfd;
 71int pid;
 72uid_t uid, euid;
 73gid_t gid, egid;
 74int stop;
 75int quit;
 76int stoprompt;
 77int timedout;
 78int cumode;
 79int bits8;
 80#define STRIP_PAR (bits8 ? 0377 : 0177)
 81
 82char fname[80];
 83char copyname[80];
 84char ccc;
 85
 86int odisc;
 87int vflag;
 88
 89char *DV;
 90char *EL;
 91char *CM;
 92char *IE;
 93char *OE;
 94char *CU;
 95char *AT;
 96char *PN;
 97char *DI;
 98char *PA;
 99
 100char *PH;
 101char *RM;
 102char *HO;
 103
 104long BR;
 105long FS;
 106
 107long DU;
 108long HW;
 109char *ES;
 110char *EX;
 111char *FO;
 112char *RC;
 113char *RE;
 114char *PR;
 115long DL;
 116long CL;
 117long ET;
 118long HD;
 119char DC;
 120
57__dead static void tipusage(void); 121__dead static void tipusage(void);
58 122
59int escape(void); 123int escape(void);
60__dead static void intprompt(int); 124__dead static void intprompt(int);
61__dead static void tipin(void); 125__dead static void tipin(void);
62 126
63char PNbuf[256]; /* This limits the size of a number */ 127char PNbuf[256]; /* This limits the size of a number */
64 128
65static char path_phones[] = _PATH_PHONES; 129static char path_phones[] = _PATH_PHONES;
66 130
67int 131int
68main(int argc, char *argv[]) 132main(int argc, char *argv[])
69{ 133{

cvs diff -r1.33 -r1.34 src/usr.bin/tip/tip.h (expand / switch to unified diff)

--- src/usr.bin/tip/tip.h 2013/10/21 14:47:46 1.33
+++ src/usr.bin/tip/tip.h 2020/04/23 00:35:14 1.34
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tip.h,v 1.33 2013/10/21 14:47:46 christos Exp $ */ 1/* $NetBSD: tip.h,v 1.34 2020/04/23 00:35:14 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 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -49,57 +49,57 @@ @@ -49,57 +49,57 @@
49#include <pwd.h> 49#include <pwd.h>
50#include <setjmp.h> 50#include <setjmp.h>
51#include <signal.h> 51#include <signal.h>
52#include <stdio.h> 52#include <stdio.h>
53#include <stdlib.h> 53#include <stdlib.h>
54#include <string.h> 54#include <string.h>
55#include <termios.h> 55#include <termios.h>
56#include <time.h> 56#include <time.h>
57#include <unistd.h> 57#include <unistd.h>
58 58
59/* 59/*
60 * Remote host attributes 60 * Remote host attributes
61 */ 61 */
62char *DV; /* UNIX device(s) to open */ 62extern char *DV; /* UNIX device(s) to open */
63char *EL; /* chars marking an EOL */ 63extern char *EL; /* chars marking an EOL */
64char *CM; /* initial connection message */ 64extern char *CM; /* initial connection message */
65char *IE; /* EOT to expect on input */ 65extern char *IE; /* EOT to expect on input */
66char *OE; /* EOT to send to complete FT */ 66extern char *OE; /* EOT to send to complete FT */
67char *CU; /* call unit if making a phone call */ 67extern char *CU; /* call unit if making a phone call */
68char *AT; /* acu type */ 68extern char *AT; /* acu type */
69char *PN; /* phone number(s) */ 69extern char *PN; /* phone number(s) */
70char *DI; /* disconnect string */ 70extern char *DI; /* disconnect string */
71char *PA; /* parity to be generated */ 71extern char *PA; /* parity to be generated */
72 72
73char *PH; /* phone number file */ 73extern char *PH; /* phone number file */
74char *RM; /* remote file name */ 74extern char *RM; /* remote file name */
75char *HO; /* host name */ 75extern char *HO; /* host name */
76 76
77long BR; /* line speed for conversation */ 77extern long BR; /* line speed for conversation */
78long FS; /* frame size for transfers */ 78extern long FS; /* frame size for transfers */
79 79
80long DU; /* this host is dialed up */ 80extern long DU; /* this host is dialed up */
81long HW; /* this device is hardwired, see hunt.c */ 81extern long HW; /* this device is hardwired, see hunt.c */
82char *ES; /* escape character */ 82extern char *ES; /* escape character */
83char *EX; /* exceptions */ 83extern char *EX; /* exceptions */
84char *FO; /* force (literal next) char*/ 84extern char *FO; /* force (literal next) char*/
85char *RC; /* raise character */ 85extern char *RC; /* raise character */
86char *RE; /* script record file */ 86extern char *RE; /* script record file */
87char *PR; /* remote prompt */ 87extern char *PR; /* remote prompt */
88long DL; /* line delay for file transfers to remote */ 88extern long DL; /* line delay for file transfers to remote */
89long CL; /* char delay for file transfers to remote */ 89extern long CL; /* char delay for file transfers to remote */
90long ET; /* echocheck timeout */ 90extern long ET; /* echocheck timeout */
91long HD; /* this host is half duplex - do local echo */ 91extern long HD; /* this host is half duplex - do local echo */
92char DC; /* this host is directly connected. */ 92extern char DC; /* this host is directly connected. */
93 93
94/* 94/*
95 * String value table 95 * String value table
96 */ 96 */
97typedef 97typedef
98 struct { 98 struct {
99 const char *v_name; /* whose name is it */ 99 const char *v_name; /* whose name is it */
100 uint8_t v_type; /* for interpreting set's */ 100 uint8_t v_type; /* for interpreting set's */
101 uint8_t v_access; /* protection of touchy ones */ 101 uint8_t v_access; /* protection of touchy ones */
102 const char *v_abrev; /* possible abreviation */ 102 const char *v_abrev; /* possible abreviation */
103 void *v_value; /* casted to a union later */ 103 void *v_value; /* casted to a union later */
104 /* 104 /*
105 * XXX: this assumes that the storage space 105 * XXX: this assumes that the storage space
@@ -213,57 +213,56 @@ extern value_t vtable[]; /* variable tab @@ -213,57 +213,56 @@ extern value_t vtable[]; /* variable tab
213#define HOME 21 213#define HOME 21
214#define ECHOCHECK 22 214#define ECHOCHECK 22
215#define DISCONNECT 23 215#define DISCONNECT 23
216#define TAND 24 216#define TAND 24
217#define LDELAY 25 217#define LDELAY 25
218#define CDELAY 26 218#define CDELAY 26
219#define ETIMEOUT 27 219#define ETIMEOUT 27
220#define RAWFTP 28 220#define RAWFTP 28
221#define HALFDUPLEX 29 221#define HALFDUPLEX 29
222#define LECHO 30 222#define LECHO 30
223#define PARITY 31 223#define PARITY 31
224#define HARDWAREFLOW 32 224#define HARDWAREFLOW 32
225 225
226struct termios term; /* current mode of terminal */ 226extern struct termios term; /* current mode of terminal */
227struct termios defterm; /* initial mode of terminal */ 227extern struct termios defterm; /* initial mode of terminal */
228struct termios defchars; /* current mode with initial chars */ 228extern struct termios defchars; /* current mode with initial chars */
229 229
230FILE *fscript; /* FILE for scripting */ 230extern FILE *fscript; /* FILE for scripting */
231 231
232int attndes[2]; /* coprocess wakeup channel */ 232extern int attndes[2]; /* coprocess wakeup channel */
233int fildes[2]; /* file transfer synchronization channel */ 233extern int fildes[2]; /* file transfer synchronization channel */
234int repdes[2]; /* read process synchronization channel */ 234extern int repdes[2]; /* read process synchronization channel */
235int FD; /* open file descriptor to remote host */ 235extern int FD; /* open file descriptor to remote host */
236#ifndef __lint__ /* not used by hayes.c, but used by some other dialers */ 236#ifndef __lint__ /* not used by hayes.c, but used by some other dialers */
237int AC; /* open file descriptor to dialer (v831 only) */ 237extern int AC; /* open file descriptor to dialer (v831 only) */
238#endif /*__lint__*/ 238#endif /*__lint__*/
239int vflag; /* print .tiprc initialization sequence */ 239extern int sfd; /* for ~< operation */
240int sfd; /* for ~< operation */ 240extern int pid; /* pid of tipout */
241int pid; /* pid of tipout */ 241extern uid_t uid, euid; /* real and effective user id's */
242uid_t uid, euid; /* real and effective user id's */ 242extern gid_t gid, egid; /* real and effective group id's */
243gid_t gid, egid; /* real and effective group id's */ 243extern int stop; /* stop transfer session flag */
244int stop; /* stop transfer session flag */ 244extern int quit; /* same; but on other end */
245int quit; /* same; but on other end */ 245extern int stoprompt; /* for interrupting a prompt session */
246int stoprompt; /* for interrupting a prompt session */ 246extern int timedout; /* ~> transfer timedout */
247int timedout; /* ~> transfer timedout */ 247extern int cumode; /* simulating the "cu" program */
248int cumode; /* simulating the "cu" program */ 248extern int bits8; /* terminal is in 8-bit mode */
249int bits8; /* terminal is in 8-bit mode */ 
250#define STRIP_PAR (bits8 ? 0377 : 0177) 249#define STRIP_PAR (bits8 ? 0377 : 0177)
251 250
252char fname[80]; /* file name buffer for ~< */ 251extern char fname[80]; /* file name buffer for ~< */
253char copyname[80]; /* file name buffer for ~> */ 252extern char copyname[80]; /* file name buffer for ~> */
254char ccc; /* synchronization character */ 253extern char ccc; /* synchronization character */
255 254
256int odisc; /* initial tty line discipline */ 255extern int odisc; /* initial tty line discipline */
257 256
258extern acu_t acutable[]; 257extern acu_t acutable[];
259extern esctable_t etable[]; 258extern esctable_t etable[];
260extern unsigned char evenpartab[]; 259extern unsigned char evenpartab[];
261 260
262void alrmtimeout(int); 261void alrmtimeout(int);
263int any(char, const char *); 262int any(char, const char *);
264void chdirectory(char); 263void chdirectory(char);
265void cleanup(int) __dead; 264void cleanup(int) __dead;
266const char *tip_connect(void); 265const char *tip_connect(void);
267void consh(char); 266void consh(char);
268char *ctrl(char); 267char *ctrl(char);
269void cumain(int, char **); 268void cumain(int, char **);